Repository navigation
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
Definitions register through a non-exported symbol instead of a public `build` method. The request context and the auth, origin, session and limits options are toolkit interfaces rather than h3-mcp aliases. `McpOAuth` drops the fields derived from an absolute `resource`, and its metadata handler accepts a Nitro 2 event. Extension plugins are documented as experimental. Amp-Thread-ID: https://ampcode.com/threads/T-01a212c1-2657-766d-9319-d6a1eada641c Co-authored-by: Amp <amp@ampcode.com>
HugoRCD
force-pushed
the
v1-10-engine-seams
branch
from
November 25, 2026 13:51
1691362 to
9a2a836
Compare
This branch was successfully deployed
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.
The beta's public types still followed h3-mcp's shapes even after #420 renamed them, so moving to another engine after 1.0 would break users. Each definition carried a public
build(identity, into, notify)whose buckets are typed from h3-mcp'sHandlerOptions.McpRequestContextand the auth, origin, session and limits options were aliases of h3-mcp types.McpOAuthexposed values computed from an absoluteresourcefixed at startup, which would get in the way of derivingresourcefrom the request later. This PR makes the definition shape data-only, writes those types out as toolkit interfaces with the same fields, trimsMcpOAuthto fields that don't depend on the request, and documents extension plugins as experimental because they are h3-mcp's plugin contract.To try it in a Nitro or Nuxt app, install the PR build:
Before and after
The same script on #421 (
v1-09-oauth-challenges) and on this branch. It defines a tool and an OAuth resource server, prints their public keys, and serves a spread copy of the tool under a new name:Registration now sits under a symbol the package does not export. Spreading a definition and
Object.assignkeep it, which the generated registry and the provider adapters rely on. To serve the metadata document from your own route, call the handler; it now also accepts a Nitro 2 event:Breaking changes
buildmethod.McpOAuthdropsresource,resourceMetadataUrl,metadataandchallengeScope. The challenge URL remains atoauth.auth.resourceMetadataUrl.The rewritten interfaces keep the same fields.
logandlogLevelstay onMcpRequestContextbecause the docs, playground and tests use them; whether to drop protocol logging before stable is a separate decision. Type tests now pin the public keys ofMcpToolandMcpOAuth. The tsconfig also mapsnitro-mcp-toolkit/oauth/*and/testingto source, so typecheck no longer depends on a builtdist.Left out on purpose:
resource. Taking the audience from theHostheader would accept tokens issued for another origin's/mcp, so it needs a trusted origin source first.X-MCP-Toolssupport.createMcpHandlerpasses h3-mcp an options function, and h3-mcp's_resolveLazyArraythen runsPromise.allover every definition on each request. Serving header-less requests from a second engine would split legacy sessions, task plugin state and cancellation, so the fix belongs upstream. On a patched copy of h3-mcp 0.2.0, 1,000-tooltools/callwith options from a function went from 2,253 to 8,230 req/s (static options: 7,051 to 7,593). That was a local measurement and is not part of this PR.Checks I ran myself, beyond CI:
pnpm test:packagepassed (packed Nitro 2/3 consumers and the Better Auth fixture on both protocol eras), and a throwaway Nuxt route showedoauth.metadataHandler(event)now typechecks with a Nitro 2 event. Nobody has tried this with a real MCP client or on nuxt.com yet.ELI5
The toolkit sits on top of an engine that speaks MCP. Some of the toolkit's public pieces were really the engine's pieces wearing a toolkit label, so swapping engines would have broken people's code. This PR keeps those pieces private or describes them in the toolkit's own words, so the engine can change later without breaking anyone.