Repository navigation
Description
What happened?
fastmcp.contrib.component_manager.set_up_component_manager documents POST /tools/{name}/disable[?version=v1] as one of the routes it installs. Using that documented ?version=v1 form returns HTTP 200 and reports success, but it permanently breaks the server: every subsequent tools/list fails with an internal error, for all clients (over a real HTTP transport, a client tools/list after the POST fails with MCPError: Internal server error).
Output of the MRE below:
HTTP response: {"message":"Disabled tool: mytool"}
tools/list raises: AttributeError: 'str' object has no attribute 'matches'
Expected: the documented ?version=v1 form should work, and tools/list should keep working afterwards. Provider.enable/disable take version: VersionSpec | None (fastmcp/server/providers/base.py:604), but the route handler passes the raw query string through at fastmcp/contrib/component_manager/component_manager.py:115; the stored str later reaches self.version.matches(...) in fastmcp/server/transforms/visibility.py:179. Without ?version=, the same route works fine — the string is the trigger.
Example Code
import asyncio
from starlette.requests import Request
from fastmcp import FastMCP
from fastmcp.contrib.component_manager import set_up_component_manager
def make_request(query: bytes, path_params: dict) -> Request:
return Request(
{
"type": "http",
"method": "POST",
"path": "/tools/mytool/disable",
"raw_path": b"/tools/mytool/disable",
"query_string": query,
"headers": [],
"path_params": path_params,
}
)
async def main():
mcp = FastMCP("test")
@mcp.tool
def mytool() -> str:
return "hi"
set_up_component_manager(mcp)
route = next(
r
for r in mcp._additional_http_routes
if getattr(r, "path", "") == "/tools/{name}/disable"
)
# documented route: POST /tools/mytool/disable?version=v1
response = await route.endpoint(make_request(b"version=v1", {"name": "mytool"}))
print("HTTP response:", response.body.decode())
try:
tools = await mcp.list_tools()
print("tools/list ok:", [t.name for t in tools])
except Exception as e:
print(f"tools/list raises: {type(e).__name__}: {e}")
asyncio.run(main())Version Information
fastmcp 4.0.11.dev1+0ebabc0c (main @ 0ebabc0ceafafa2885484bdbf316695148b22f42)
mcp 2.0.0 / starlette 1.3.1
Python 3.12.14
macOS 15 (Darwin 25.6.0, arm64)
Happy to open a PR — either wrap the query param as VersionSpec(eq=version) in the handler, or coerce a str in Provider.enable/disable.
Related: #4050 reported the same str-vs-VersionSpec gap via call_tool (closed after no MRE was added); this is the same pattern reached through the component_manager routes.
Report prepared with LLM assistance; the MRE and the output above are verbatim from my runs against the commit cited above.
Activity
BlueX888 commentedon Oct 7, 2026
Reproduced this. Root cause: fastmcp/contrib/component_manager/component_manager.py:115 passes the raw ?version= query string into Provider.enable/disable (version: VersionSpec | None); the stored str later reaches self.version.matches(...) in fastmcp/server/transforms/visibility.py:179, so every tools/list raises.
Minimal reproduction:
Observed output:
Fix is ready on
BlueX888:fix/prep-component-manager-version-str-poisons-list(commit1b128e0d). Converts the query param to VersionSpec(eq=version) in the component-manager route handler before calling enable/disable.Verified with:
uv run pytest tests/contrib/test_component_manager.pyHappy to open the PR once you confirm the approach or assign this to me.
Convert the component manager's version query param to a VersionSpec (P…