Replace FastMCP with toolregistry-server: multi-protocol, profiles, policy tags#63
Replace FastMCP with toolregistry-server: multi-protocol, profiles, policy tags#63Oaklight wants to merge 2 commits into
Conversation
Swap the server engine from FastMCP to toolregistry + toolregistry-server, enabling multi-transport MCP (stdio/SSE/HTTP), optional OpenAPI/REST, namespace grouping, two-profile tool surface (core / deferred-full), policy tags, and BM25 discovery. No tool implementation code (tools/, domain/, remote/) is modified. Provenance, HPC dispatch, session/workflow state, and fallback semantics are all preserved. Closes #2
|
Hey Peng, thanks so much for putting this together. Really nice that this removes the fastmcp dependency and goes to the Anthropic MCP SDK directly — cleaner dependency chain overall. Ran it locally end-to-end: 304 tests pass, both packages install cleanly from PyPI, admin panel defaults to localhost, and One thing that needs a decision: Smaller things:
|
|
Is this targeted to work only with claude code? |
- Fix discover_tools ranking: enrich search hints for compute tools, reword prompt-tool docstrings to avoid keyword overlap with the actual computation tools they describe. - Bump version to 0.2.0 (pyproject.toml + __init__.py). - Clean remaining FastMCP references in docs/architecture.md and code comments in execution_control.py / remote_tools.py.
|
Thanks for running it end-to-end and the detailed feedback. Pushed a follow-up commit addressing everything below. Namespace prefixes on the wire: Keeping the prefixed names ( For now I'd leave the prefixes as-is and see if any client actually has trouble with them. LLMs handle Version bump: Bumped to BM25 ranking fix: Good catch. The issue was that
Before: Docs cleanup: Cleaned up remaining fastmcp references in toolregistry-server maintenance: I maintain the toolregistry ecosystem (toolregistry, toolregistry-server, toolregistry-hub) including PyPI releases and Docker images. For any issues or patches, open an issue or PR on the relevant repo — happy to discuss and review. No need to plan for a fork. |
Hey @rljacob Robert, good to see you here! Not Claude-only —
Users pick whichever protocol fits their stack. The tool implementations, provenance, and HPC dispatch are shared across all transports. |
Summary
Replace the FastMCP-based
server.pywith atoolregistry+toolregistry-serverimplementation. Same tool functions, same Claude Desktop experience by default, but the server now supports:pip install uxarray-mcp[openapi])session/,hpc/,io/,prompt/,compute/, ...)coredefault and opt-indeferred-fullwith BM25 discoveryREAD_ONLY,FILE_SYSTEM,NETWORK,SLOW,experimental,stateful)fastmcpis no longer a dependency. No tool implementation code (tools/,domain/,remote/) was modified — provenance, HPC dispatch, session/workflow state, and fallback semantics are all unchanged.What changed
src/uxarray_mcp/registry.pybuild_registry(profile=...)with namespace plan, policy tags, BM25 search hints, prompt-as-tool wiringsrc/uxarray_mcp/server.pymake_registry(),make_mcp_server(),run(transport=...)replacing FastMCPsrc/uxarray_mcp/__init__.pymake_registry/make_mcp_serverinstead ofmcpsrc/uxarray_mcp/cli.pyservegains--profile,--transport,--host,--portpyproject.tomlfastmcp→toolregistry+toolregistry-server[mcp]; added[openapi]optional extratests/test_server.pytests/test_vector_calc.pyfrom server import mcptomake_registry()AGENTS.mdCHANGELOG.md[Unreleased]sectionCONTRIBUTING.mdfastmcp→toolregistryconda/recipe/meta.yamlfastmcp→toolregistrydepsdocs/conf.pyfastmcpautodoc mockTwo profiles
core(default, 27 tools visible)export_to_netcdf/export_to_csvare reachable in core viarun_analysis(operation="export", ...).deferred-full(58 loaded, 28 visible + 30 deferred)Core set stays visible. 30 raw implementation tools (
compute/,shape/,inspect/,plot/,io/,agent/) loaded withdefer=True. Agents find them viadiscover_tools(BM25 search). Operators promote from admin panel.Prompt → tool conversion
The 3
@mcp.prompt()decorators are now regular tools underprompt/namespace. They return the same instruction text as before — the LLM callsprompt-first_look(path="...")and gets a multi-step analysis plan to execute.Backward compatibility
uxarray-mcp servestill starts MCP stdio with the same default tool surfacemcpServerssnippets work unchangedpython -m uxarray_mcpstill defaults toserveuxarray_mcp.toolsbehave identicallyNew capabilities are opt-in:
Test results
The 3 failures (
test_plot_mesh_healpix,test_plot_mesh_healpix_custom_size,test_analyze_dataset_includes_plots_by_default) reproduce identically on upstreammain— they are a shapelyGEOSExceptionunrelated to this PR.Design decisions (discussed via Slack)
list_datasets+ prompts per maintainer specrun_scientific_agentstays deferred/experimental until explicitly promotedexport_to_*stays behindrun_analysisdispatcher in core; direct calls in deferreduse_remote→NETWORK) and explicit overridesdiscover_toolsdefault top_k controlled by the calling LLM; BM25 search hints added for domain synonyms (e.g. "vorticity" →calculate_curl)How to try