Repository navigation
feat(mcp): serve MCP 2026-07-28 only, with origin checks and tool rate limits - #336
Merged
Merged
Conversation
…e limits Fanout now serves MCP protocol version 2026-07-28 over stateless Streamable HTTP. Requests without the protocol header or with an earlier version are rejected; sessions, initialize and GET streams are gone. The browser MCP client and the in-process agent use the modern protocol, and MCP Apps support is read from request-scoped client capabilities. - Requests to /mcp and /api/mcp with an untrusted or malformed Origin receive 403 before authentication. The trusted origin is the RFC 6454 serialization of FANOUT_PUBLIC_URL; without one, only same-authority loopback origins are accepted. - tools/call is rate limited per user and OAuth client (20 per second, burst 100, bounded and evicted when idle) with 429 and Retry-After. The in-process agent is not limited. - Scope checks and the limiter read the Mcp-Method and Mcp-Name headers, which the SDK requires to match the decoded body, instead of a second, case-insensitive body parse. - The insufficient_scope challenge lists every scope the call needs. - Client disconnects cancel in-flight tool calls down to DuckDB. Claude-Session: https://claude.ai/code/session_018HfyEXHyGD1utmKF4CQtyQ
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
Fanout now serves MCP protocol version 2026-07-28 only, over stateless Streamable HTTP. There is no backward compatibility: requests without
MCP-Protocol-Versionor with an earlier version are rejected, and sessions,initializeand GET streams are removed. The browser MCP client and the in-process agent use the modern protocol, and MCP Apps support is read from request-scoped client capabilities./mcpand/api/mcpwith an untrusted or malformedOriginreceive 403 before authentication. The trusted origin is the RFC 6454 serialization ofFANOUT_PUBLIC_URL; without one, only same-authority loopback origins are accepted. Requests withoutOriginare unaffected.tools/callis limited per user and OAuth client (20 per second, burst 100, bounded and evicted when idle), answered with 429 andRetry-After(MCP 2026-07-28 tools security considerations; RFC 6585 §4). The in-process agent is not limited.Mcp-MethodandMcp-Name, which the SDK requires to match the decoded body. This replaces a second, case-insensitive body parse that a case-variant key could steer. Dashboard tools keep their owndashboard:managecheck.insufficient_scopelists every scope the call needs.Verification
ui://resource read; older protocol versions rejected.go test ./..., race tests on the MCP, API, agent and auth packages,just check,just e2e(68 passed).