-
Notifications
You must be signed in to change notification settings - Fork 633
Dynamic servers #572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you referring to this PR? modelcontextprotocol/python-sdk#728 It's under active debate in the low-level repo. I am not sure that global enable/disable of tools is the right way to handle this. We are pursuing a more dynamic approach. |
Thanks @jlowin, but it's not the same. That PR is about disabling tools that were defined by "@mcp.tool" annotating functions. What I mean is having capabilities to dynamically define the tools in runtime. An example usecase would be an MCP wrapper for a "legacy" integration marketplace. For ex MuleSoft, etc.. Flow:
|
Ah ok this is similar to #443 but will need more work to fully support a dynamic server. However I like the enhancement now that I understand it better. Unless I'm mistaken you can not do this in the official SDK though? |
I was reading #443 just now and that seems to be about tools that return a stream of results. So maybe I'm a bit confused? Servers with a dynamically-generated list of tools are available in the official SDK when you use Server, and not with FastMCP 1.0. See https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-tool/mcp_simple_tool/server.py#L42 In there, the list of tools is just returning always the same one tool. But you can imagine how you can easily make that method retrieve the tools from a DB, or an external vendor, etc. |
+1 for this feature. Is there a recommended way to intercept the |
Enhancement Description
In the official Python SDK you can use
@mcp.list_tools()
and@mcp.call_tool()
to create a server that servers a dynamic list of tools. One use case is a server that reads a JWT from a header or even URL segment and then serves a different set of tools based on the user permissions as per the JWT claims.I have not found a way to do this with FastMCP 2.0. I understand the idea of FastMCP 2.0 is to serve tools based on annotating code, but the lack of support for dynamic tools is keeping me locked into the official Python SDK.
Use Case
No response
Proposed Implementation
The text was updated successfully, but these errors were encountered: