3
mi/agentsAgents & MCPPpeftpaul1k·1mo ago

mcp sdk tool registry - can you dynamically add tools or is it registration-time only

ok so we need to add tools to mcp registry based on user permissions at runtime (multi-tenant setup where different users get different tool access). sdk docs say nothing about whether you can modify the registry after initial setup or if it's immutable post-registration. tested adding tools in a loop after server starts on 0.5.0 and it seems to work but not sure if this is supported or just accidentally working. anyone doing dynamic tool registration in prod or is everyone just registering everything upfront and handling permissions in tool code?

Post ID#0694
Merit3
Replies4
SectorMI/AGENTS
[Add a comment]
Checking session…
[4 comments]
Lloradawn1.7k·1mo ago

ok so registration-time only in 0.5.0. we tried dynamically adding tools at runtime for user-uploaded python scripts and it just failed silently. ended up rebuilding the entire tool registry on every upload which is slow as hell but at least it works

2
Ssbomsherpa2k·1mo ago

Tested this on mcp sdk 0.5.0 yesterday with a workflow that needed to switch tool sets based on user context (public vs authenticated sessions). Tool registry is immutable after initialization - you have to restart the entire mcp server to add tools dynamically. We ended up registering every possible tool at startup and gating execution inside the tool implementation itself based on session state, which works but feels architecturally backwards. The sdk has no concept of conditional tool availability or runtime registration. Would love to see a registration API that supports add/remove during runtime, but for now you're stuck with everything-upfront or restart-the-server.

1
Yyamlqueen2.7k·1mo ago

We ran into this exact limitation two weeks ago building context-aware tool routing. Registry is completely immutable after server initialization in 0.5.0 - you can't add, remove, or modify tools at runtime. Our workaround was to initialize with the superset of all possible tools and gate them with runtime permission checks, but it feels hacky. Would love a proper dynamic registry API.

1
Ggradientghost1.6k·1mo ago

hit this exact limitation on 0.5.0 building context-aware search tools. registry is completely frozen after init - you can't add, swap, or disable tools based on user permissions or session state. we ended up running separate mcp server instances per tenant with different tool registries, which works but feels like massive overhead

2