feat(mark3labs): add adapter for mark3labs/mcp-go [AP-14]#7
Closed
RobertoIskandarani wants to merge 1 commit into
Closed
feat(mark3labs): add adapter for mark3labs/mcp-go [AP-14]#7RobertoIskandarani wants to merge 1 commit into
RobertoIskandarani wants to merge 1 commit into
Conversation
Mirrors the python-sdk authplane-fastmcp package: a parallel adapter for the popular community Go MCP library, alongside the existing official-SDK adapter at go-sdk/mcp/. Validates JWTs, serves RFC 9728 PRM, bridges verified claims into the per-tool-call MCP context via HTTPContextFunc, and maps RFC 8693 consent errors to URLElicitationError (with a documented propagation caveat for mark3labs/mcp-go's tool error coercion). - pkg/authplanemark3labs: Adapter, AuthMiddleware, HTTPContextFunc, PRM handler, ClaimsFromContext/TokenFromContext, TokenExchange, ConsentElicitationError, URLElicitationError - demo/: calculator service using mark3labs/mcp-go server + adapter - README.md + docs/user-guide.md - go.work: register module, bump go floor to 1.25.5 (mark3labs/mcp-go v0.54.0 requires it) 27 tests, all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
RobertoIskandarani
deleted the
robertoiskandarani/ap-14-build-adapter-for-mark3labsmcp-go
branch
May 19, 2026 20:29
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.
Summary
github.com/authplane/go-sdk/mark3labs— Authplane adapter formark3labs/mcp-go, parallel to the existing official-SDK adapter atgo-sdk/mcp/. Mirrors the Pythonauthplane-fastmcppackage referenced as the example in the ticket.Adapter,NewAdapter,AuthMiddleware,HTTPContextFunc(bridges claims into the mark3labs per-tool-call context viaserver.WithHTTPContextFunc(...)),ProtectedResourceMetadataHandler,ClaimsFromContext/TokenFromContext,TokenExchange,ConsentElicitationError, typedURLElicitationError.Design notes
WWW-Authenticatedone directly inAuthMiddleware— noauth.RequireBearerTokenshim needed, since mark3labs/mcp-go doesn't use it. Header is RFC 6750 §3.1 quoted from the start (no quoter post-processor), anderror_descriptionis sanitised so verifier messages can't inject extra header lines.adapter.HTTPContextFunc()is paired withserver.WithHTTPContextFunc(...)to forward claims/token from the HTTP request context into the per-tool-call MCP context (without this option mark3labs/mcp-go gives tool handlers a fresh ctx).-32603(INTERNAL_ERROR); custom codes like-32042don't propagate. Documented prominently indocs/user-guide.md §7.2anddemo/README.md, alongside the recommendedIsError: trueCallToolResultworkaround — same trade-off the Python FastMCP adapter calls out.ProtectedResourceMetadataHandlerinstead of mark3labs' built-inserver.WithProtectedResourceMetadata(...)so the PRM JSON stays byte-identical across Authplane adapters.Module / workspace changes
go-sdk/mark3labs/registered ingo.work.go.workGo floor bumped1.25.0 → 1.25.5(mark3labs/mcp-go v0.54.0 requires>= 1.25.5). Sibling modules (core,http,mcp) continue to build and pass tests.Test plan
cd mark3labs && go build ./...— cleancd mark3labs && go vet ./...— cleancd mark3labs && go test ./...— 27 tests passing (bearer parsing, claims injection, ES256, expired/missing tokens, PRM, introspection regression,HTTPContextFuncbridge, consent→elicitation mapping,MarshalDatapayload shape)core,http,mcpall green after the go.work bumpdemo/against the local authserver (reviewer)🤖 Generated with Claude Code