You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, MCP tools registered in McpServerToolCollection lack built-in version metadata or request-scoped filtering capabilities. Developers needing phased canary/beta rollouts must manually intercept tools/list and mutate ServerOptions.ToolCollection at runtime, which is error-prone and causes concurrency/state-bleed issues across sessions.
Proposed Design Alignment
To bridge the static endpoint scoping (#1216) and runtime header gating (#1557), we propose:
[McpServerTool] Metadata Extension:
Add optional string? Version or string? Group.
Add optional string? RequiredHeader and string? HeaderPattern (or route constraints).
Scoped IToolFilter / Request Predicate:
Instead of mutating ToolCollection during tools/list, introduce a non-destructive filter hook Func<McpContext, ToolMetadata, bool> in McpServerOptions.
When handling tools/list and tools/call, evaluate the active request context against registered predicates.
Non-matching tools are excluded from the enumeration and return standard MethodNotFound / -32601 if called directly without the qualifying header.
Static route-mapped toolsets and dynamic header-gated tools share the same underlying filter contract.
This avoids destructive list mutation and cleanly supports progressive opt-in deployments.
AI assistance disclosure: AI was used to discover this opportunity and draft the change or text. The submission was checked against the prepared artifact and recorded verification evidence.
Proposal: Declarative Tool Versioning & Runtime Header/Endpoint Gating
Motivation & Context
Addressing #1557 in conjunction with #1216.
Currently, MCP tools registered in
McpServerToolCollectionlack built-in version metadata or request-scoped filtering capabilities. Developers needing phased canary/beta rollouts must manually intercepttools/listand mutateServerOptions.ToolCollectionat runtime, which is error-prone and causes concurrency/state-bleed issues across sessions.Proposed Design Alignment
To bridge the static endpoint scoping (#1216) and runtime header gating (#1557), we propose:
[McpServerTool]Metadata Extension:string? Versionorstring? Group.string? RequiredHeaderandstring? HeaderPattern(or route constraints).Scoped
IToolFilter/ Request Predicate:ToolCollectionduringtools/list, introduce a non-destructive filter hookFunc<McpContext, ToolMetadata, bool>inMcpServerOptions.tools/listandtools/call, evaluate the active request context against registered predicates.MethodNotFound/-32601if called directly without the qualifying header.Coexistence with Version-Based Tool Registration for MCP Server #1216:
This avoids destructive list mutation and cleanly supports progressive opt-in deployments.