Skip to content

[adapters] FastMCP Catalog bridge — auto-ingest tools from FastMCP servers #114

@dgenio

Description

@dgenio

Problem

FastMCP is the dominant MCP framework, powering ~70% of MCP servers and downloaded a million times a day. Currently, there is no direct way to load a FastMCP server's tool list into contextweaver's Catalog — users must manually convert each tool definition. This friction blocks adoption among FastMCP users.

Related: #87 tracks a narrower FastMCP CodeMode adapter; this issue covers the broader catalog bridge.

Proposal

Add adapters/fastmcp.py with utilities to bridge FastMCP servers and contextweaver Catalogs:

  1. fastmcp_tools_to_catalog(tools) — Convert a list of FastMCP tool definitions to SelectableItems and register in a Catalog, preserving namespaces (FastMCP uses namespace_toolname convention)
  2. load_fastmcp_catalog(server_url_or_config) — Connect to a running FastMCP server via MCP tools/list, convert all tools, and return a populated Catalog
  3. Namespace inference — Detect FastMCP namespace prefixes (e.g., github_search_repos → namespace=github, name=search_repos)
  4. Tag mapping — Map FastMCP tool tags to SelectableItem.tags for tag-based filtering

Dependency strategy

  • Core conversion functions work with plain dicts (no FastMCP import needed)
  • Add contextweaver[fastmcp] optional extra for live server discovery
  • Keep the adapter usable without the extra by accepting tool definitions as dicts

Acceptance Criteria

  • fastmcp_tools_to_catalog() converts FastMCP tool definitions to Catalog items
  • Namespace prefixes correctly inferred from FastMCP naming convention
  • Tags, descriptions, and schemas preserved during conversion
  • contextweaver[fastmcp] optional extra defined in pyproject.toml
  • Live server discovery works when FastMCP is installed (via tools/list)
  • Core dict-based conversion works without FastMCP installed
  • Tests cover namespace inference, tag mapping, and schema preservation
  • Example recipe added (or cross-referenced from cookbook issue)

Implementation Notes

  • FastMCP composition docs: https://gofastmcp.com/servers/composition
  • Namespace convention: {namespace}_{tool_name} (underscore-delimited)
  • Reuse mcp_tool_to_selectable() internally — add namespace extraction on top
  • Consider #43 (MCP namespace inference) overlap — this issue supersedes it for FastMCP

File Paths

  • src/contextweaver/adapters/fastmcp.py (new)
  • src/contextweaver/adapters/__init__.py (edit — re-export)
  • pyproject.toml (edit — add fastmcp optional extra)
  • tests/test_adapters.py (edit — add FastMCP tests)
  • examples/ (edit or new — FastMCP integration example)

Cross-references

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adaptersProtocol adapters: MCP, A2Aarea/routingRouting engine: catalog, graph, router, cardscomplexity/averageStandard effort, moderate familiarity neededenhancementNew feature or requestmilestone/v0.3v0.3 — Production readinesspriority/highHigh priority — closes a critical gap

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions