Skip to content

Migrate MCP server from fastapi_mcp to MCP Python SDK #6252

@patelchaitany

Description

@patelchaitany

Problem

fastapi_mcp crashes with RecursionError on any self-referencing Pydantic model in the OpenAPI schema (no cycle detection in resolve_schema_references()). This is app-wide — one recursive route kills the entire MCP server. It also generates LLM-unfriendly schemas ($ref/$defs) and HTTP-derived tool names (post_get_online_features).

Solution

Replace fastapi_mcp with the MCP Python SDK (FastMCP). Define tools explicitly via @mcp.tool(), calling FeatureStore methods directly (no internal HTTP round-trip).

Benefits

  • Unblocks recursive Pydantic models (compound filters, nested types) on HTTP routes without breaking MCP
  • Flat, LLM-friendly tool schemas (no $ref/$defs)
  • Semantic tool names (get_online_features, not post_get_online_features)
  • New registry discovery tools (list_feature_views, list_entities, list_feature_services, list_data_sources)
  • No HTTP noise (health checks, static files, WebSocket routes not exposed)
  • Direct FeatureStore calls instead of internal HTTP round-trip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions