Skip to content

Commit f0a5d8b

Browse files
committed
Replace fastapi_mcp with the MCP Python SDK (FastMCP) to fix RecursionError on recursive Pydantic models, expose explicit @mcp.tool() handlers that call FeatureStore directly, and add registry discovery, data access, and materialization tools with flat LLM-friendly schemas.
Signed-off-by: Chaitany patel <patelchaitany93@gmail.com> Rerun-CI: true
1 parent de67bdd commit f0a5d8b

7 files changed

Lines changed: 625 additions & 279 deletions

File tree

sdk/python/feast/feature_server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,14 @@ async def lifespan(app: FastAPI):
353353

354354
await store.initialize()
355355
async_refresh()
356+
357+
mcp_sm = getattr(app.state, "mcp_session_manager", None)
356358
try:
357-
yield
359+
if mcp_sm:
360+
async with mcp_sm.run():
361+
yield
362+
else:
363+
yield
358364
finally:
359365
stop_refresh()
360366
if offline_batcher is not None:
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# MCP (Model Context Protocol) server implementations for Feast
22

33
from .mcp_config import McpFeatureServerConfig
4-
from .mcp_server import add_mcp_support_to_app
4+
from .mcp_server import add_mcp_support_to_app, create_mcp_server
55

66
__all__ = [
77
"McpFeatureServerConfig",
88
"add_mcp_support_to_app",
9+
"create_mcp_server",
910
]

sdk/python/feast/infra/mcp_servers/mcp_config.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@
88
class McpFeatureServerConfig(BaseFeatureServerConfig):
99
"""MCP (Model Context Protocol) Feature Server configuration."""
1010

11-
# Feature server type selector
1211
type: Literal["mcp"] = "mcp"
1312

14-
# Enable MCP server support - defaults to False as requested
1513
mcp_enabled: StrictBool = False
1614

17-
# MCP server name for identification
1815
mcp_server_name: StrictStr = "feast-mcp-server"
1916

20-
# MCP server version
2117
mcp_server_version: StrictStr = "1.0.0"
2218

2319
mcp_transport: Literal["sse", "http"] = "sse"
2420

25-
# The endpoint definition for transformation_service (inherited from base)
21+
mcp_base_path: StrictStr = "/mcp"
22+
2623
transformation_service_endpoint: StrictStr = "localhost:6566"

0 commit comments

Comments
 (0)