Open
Conversation
mcpAuthClerk - authentication middleware oauthCorsMiddleware - cors for the oauth metadata handlers protectedResourceHandlerClerk - handler that returns metadata for the resource server (Hono app) authServerMetadataHandlerClerk - handler that returns Clerk auth server metadata
brettimus
commented
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a new folder
hono/with utilities and examples for building an authenticated (Hono-based) MCP server with Clerk.At the moment, this PR focuses on Clerk utilities only, and does not export general-purpose helpers like the
express/module does.Worth Noting
Web Standard api frameworks like Hono do not play nicely with the
@modelcontextprotocol/sdktypescript package, since that package is rather Express-and-Node.js specific.(This is why Hono has its own package for building MCP servers, which re-implements the StreamableHTTPTransport under the hood.)
Currently, the Hono mcp middleware does not have a way to pass auth down to tools (it's WIP), but this is something that the
mcp-liteSDK does (disclosure: I am a maintainer), which is why I included it in an example.Exports of
@clerk/mcp-tools/honomcpAuthClerk- Hono authentication middlewareoauthCorsMiddleware- cors middleware for the oauth metadata handlersprotectedResourceHandlerClerk- handler that returns metadata for the resource server (Hono app)authServerMetadataHandlerClerk- handler that returns Clerk auth server metadataHow I tested
I published this package under a different scope (
@bretterplane/mcp-tools) and made sure the example from the Hono README worked in the repo here without import or type errors.To configure Clerk, I created an application, then enabled OAuth + DCR.
To test the auth flow, I ran the
@modelcontextprotocol/inspectorand used the guided OAuth flow to check each step. (Discovery, client registration, etc.)Finally, I used the inspector to execute the authenticated tool, and it worked (fetching auth'd user info from Clerk).
TODOs
hono/README.mdto fixget_clerk_user_datatoolhono/README.mdto documentoauthCorsMiddleware