Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1171 +/- ##
==========================================
+ Coverage 94.75% 95.04% +0.29%
==========================================
Files 25 30 +5
Lines 5224 5833 +609
==========================================
+ Hits 4950 5544 +594
- Misses 269 284 +15
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
robtme
force-pushed
the
mcp
branch
5 times, most recently
from
November 15, 2026 18:56
93d1418 to
9f7ca98
Compare
Adds an optional mcp package serving the Model Context Protocol over Streamable HTTP, covering both the stateless revision and the handshake-based ones. Operations opt in with mcp.Tool(), or in bulk via Options.ExposeVisible / ExposeHidden. Tool calls execute by round-tripping through the API's own router, so request parsing, validation, middleware and response marshalling are reused unchanged, and a tool is authenticated exactly as its operation already was. The package imports nothing outside the standard library and Huma. Authorization covers discovery only: the package serves RFC 9728 Protected Resource Metadata, provides Server.SetChallenge for auth middleware to point connectors at it before writing a 401 with huma.WriteErr, and turns a tool call's 401 into a transport-level challenge. It validates no tokens and issues none; that stays with your middleware, as it does for the rest of Huma. Includes an mcp-auth example and a docs page.
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.
Adds an optional
mcppackage that serves operations as Model Context Protocol tools over Streamable HTTP. Tool calls are replayed through the API's own router, so validation, middleware and auth apply unchanged. It only imports the stdlib and Huma.It's intentionally a sub-package rather than part of core, like
sseandautopatch: most users won't need it, and it doesn't rely on anything internal to core.Server.SetChallengeto call before your usual 401); validating or issuing tokens stays with your middleware.Attachon the root API before registering operations, since hidden operations are only seen through the API it returns. Create groups from that API;Attachpanics on a group.ForwardHeaders(e.g.Authorization) aren't tool arguments, so the caller's own header is always used.Docs page under Extra Packages, plus
examples/mcp-auth.