feat(server): add AuthPlane OAuth provider - #1
Open
muralx wants to merge 1 commit into
Open
Conversation
Add `oauthAuthPlaneProvider({ issuer })` as a direct resource-server adapter
for self-hosted AuthPlane authorization servers, exported from
`mcp-use/oauth/authplane`.
AuthPlane audience-binds every access token to the RFC 8707 resource indicator
the client requested, so the resolved canonical MCP resource is the expected
audience and no audience option is needed.
Two departures from the sibling adapters, both deliberate:
- Accepted signing algorithms are pinned to ES256 and RS256, the only two the
authorization server issues. With a remote JWKS an unpinned verifier accepts
whatever algorithm the matching key declares.
- A token carrying an RFC 9449 `cnf` confirmation claim is rejected rather than
accepted as a plain bearer credential. mcp-use has no DPoP proof validation,
so accepting one would discard the sender constraint and make an exfiltrated
token replayable.
AuthPlane access tokens are RFC 9068 authorization tokens with no profile
claims, so the typed user exposes the subject plus the RFC 8693 delegation
chain (`act`, `agent_id`, `agent_chain`) instead of email and name.
Includes provider tests, a type-level contract, spec updates, a V2 docs page,
and a runnable example.
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.
Language / Project Scope
Check all that apply:
Changes
Adds
oauthAuthPlaneProvider— a new OAuth provider for usingAuthPlane as an authorization server
in MCP servers. AuthPlane is an open-source, self-hosted OAuth 2.1 authorization
server for MCP. Uses DCR-direct mode: MCP clients register and authenticate
directly with AuthPlane, and the MCP server verifies AuthPlane-issued JWTs via
JWKS.
Review Readiness
Implementation Details
src/oauth/authplane.tswith JWKS-based JWT verification, exported asoauthAuthPlaneProviderfrommcp-use/oauth/authplane(package.jsonexport and
tsup.config.tsentry)no
audienceoption to configure — verification binds to the resolved MCPresource
ES256/RS256— the algorithms authserversigns access tokens with. With a remote JWKS, an unpinned verifier would
accept whatever the matching key declares
cnfclaim is rejected rather than accepted asa bearer credential. authserver can issue DPoP-bound tokens, mcp-use has no
proof validation, and accepting one would drop the sender constraint the
token was issued with
AuthPlaneOAuthUserexposes the subject plus AuthPlane's delegation claims(
agentId,agentChain,act). AuthPlane access tokens carry no OIDCprofile claims, so there is no
email/nameto map; raw claims stay onctx.auth.payloadexamples/auth/authplane/specs/AUTH_SPEC.mdandspecs/AUTH_IMPLEMENTATION.md, followingfeat(server): add Better Auth OAuth provider mcp-use/mcp-use#1921 and the package's
CLAUDE.md. Additions are AuthPlane-scopedTypeScript Checklist
Packages Modified
docstestsclicreate-mcp-use-appmcp-use(server)mcp-use(client)inspectorPre-commit Checklist
pnpm lint:fixto auto-fix linting issuespnpm formatto format code with Prettierpnpm buildand build succeeds without errorspnpm changesetto create a changeset (if this PR includes user-facing changes)docs/folder if neededExample Usage (Before)
// No AuthPlane OAuth provider availableExample Usage (After)
Documentation Updates
docs/v2/typescript/server/authentication/providers/authplane.mdx— newprovider guide
docs/v2/typescript/server/authentication/index.mdx— provider table rowdocs/docs.json— nav entry in the V2 OAuth Providers groupexamples/auth/README.md,examples/README.md— index rows for the newexample
Testing
tests/oauth-direct-providers.test.tscovering metadata,ES256/RS256 verification, rejection of an unadvertised algorithm, rejection of
a token minted for a different resource, rejection of a
cnf-bearing token,delegation-claim mapping, and a missing subject
tests/oauth-wiring-types.test.tsauthplane/authserver:latest: advertisedmetadata matches the real discovery document field for field; real tokens
verify through a remote JWKS fetch; a token minted for a different resource is
rejected at both the provider and HTTP layers; unauthenticated requests return
401with the correctresource_metadata; and a full authorization-code +PKCE flow completes through the mcp-use Inspector, which self-registers via DCR
accepted by an equivalent provider without the
cnfcheckBackwards Compatibility
Fully backwards compatible — new export only.
Related Issues
Proposed upstream in mcp-use#2152. This PR is internal review only; it
does not target
mcp-use/mcp-use.