Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
Signed-off-by: aaronzuo <anarionzuo@outlook.com>
  • Loading branch information
Anarion-zuo authored and ntkathole committed Apr 5, 2026
commit 58cddeb3628aeb01a9bb9d37caa90c5b976feb74
18 changes: 14 additions & 4 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ async def websocket_endpoint(websocket: WebSocket):

def _add_mcp_support_if_enabled(app, store: "feast.FeatureStore"):
"""Add MCP support to the FastAPI app if enabled in configuration."""
mcp_transport_not_supported_error = None
try:
# Check if MCP is enabled in feature server config
if (
Expand All @@ -738,7 +739,16 @@ def _add_mcp_support_if_enabled(app, store: "feast.FeatureStore"):
and store.config.feature_server.type == "mcp"
and getattr(store.config.feature_server, "mcp_enabled", False)
):
from feast.infra.mcp_servers.mcp_server import add_mcp_support_to_app
try:
from feast.infra.mcp_servers.mcp_server import (
McpTransportNotSupportedError,
add_mcp_support_to_app,
)

mcp_transport_not_supported_error = McpTransportNotSupportedError
except Exception as e:
Copy link
Copy Markdown
Collaborator

@YassinNouh21 YassinNouh21 Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except Exception here catches SyntaxError, AttributeError, etc. — not just a missing package. Use except ImportError so real bugs in mcp_server.py are not silently swallowed. @franciscojavierarceo worth fixing before merge.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.error(f"Error checking/adding MCP support: {e}")
return

mcp_server = add_mcp_support_to_app(app, store, store.config.feature_server)

Expand All @@ -749,9 +759,9 @@ def _add_mcp_support_if_enabled(app, store: "feast.FeatureStore"):
else:
logger.debug("MCP support is not enabled in feature server configuration")
except Exception as e:
from feast.infra.mcp_servers.mcp_server import McpTransportNotSupportedError

if isinstance(e, McpTransportNotSupportedError):
if mcp_transport_not_supported_error and isinstance(
e, mcp_transport_not_supported_error
):
raise
logger.error(f"Error checking/adding MCP support: {e}")
# Don't fail the entire server if MCP fails to initialize
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/ui_server.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import threading
import uvicorn
from importlib import resources as importlib_resources
from typing import Callable, Optional

import uvicorn
from fastapi import FastAPI, Response, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
Expand Down