We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contactedHave a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| @@ -0,0 +1,77 @@ | ||
| # Feast MCP Feature Server Example | ||
|
|
||
| This example demonstrates how to enable MCP (Model Context Protocol) support in Feast, allowing AI agents and applications to interact with your features through standardized MCP interfaces. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Python 3.8+ | ||
| 2. Feast installed | ||
| 3. FastAPI MCP library | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. Install Feast with MCP support: | ||
| ```bash | ||
| pip install feast[mcp] | ||
| ``` | ||
|
|
||
| Alternatively, you can install the dependencies separately: | ||
| ```bash | ||
| pip install feast | ||
| pip install fastapi_mcp | ||
| ``` | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Navigate to this example directory within your cloned Feast repository: | ||
| ```bash | ||
| cd examples/mcp_feature_store | ||
| ``` | ||
|
|
||
| 2. Initialize a Feast repository in this directory. We'll use the existing `feature_store.yaml` that's already configured for MCP: | ||
| ```bash | ||
| feast init . | ||
| ``` | ||
| This will create a `data` subdirectory and a `feature_repo` subdirectory if they don't exist, and will use the `feature_store.yaml` present in the current directory (`examples/mcp_feature_store`). | ||
|
|
||
| 3. Apply the feature store configuration: | ||
| ```bash | ||
| cd feature_repo | ||
| feast apply | ||
| cd .. # Go back to examples/mcp_feature_store for the next steps | ||
| ``` | ||
|
|
||
| ## Starting the MCP-Enabled Feature Server | ||
|
|
||
| Start the Feast feature server with MCP support: | ||
|
|
||
| ```bash | ||
| feast serve --host 0.0.0.0 --port 6566 | ||
| ``` | ||
|
|
||
| If MCP is properly configured, you should see a log message indicating that MCP support has been enabled: | ||
|
|
||
| ``` | ||
| INFO:feast.feature_server:MCP support has been enabled for the Feast feature server | ||
| ``` | ||
|
|
||
| ## Available MCP Tools | ||
|
|
||
| The fastapi_mcp integration automatically exposes your Feast feature server's FastAPI endpoints as MCP tools. This means AI assistants can: | ||
|
|
||
| - **Call `/get-online-features`** to retrieve features from the feature store | ||
| - **Use `/health`** to check server status | ||
|
|
||
|
|
||
| ## Configuration Details | ||
|
|
||
| The key configuration that enables MCP support: | ||
|
|
||
| ```yaml | ||
| feature_server: | ||
| type: mcp # Use MCP feature server type | ||
| enabled: true # Enable feature server | ||
| mcp_enabled: true # Enable MCP protocol support | ||
| mcp_server_name: "feast-feature-store" | ||
| mcp_server_version: "1.0.0" | ||
| ``` | ||
| @@ -0,0 +1,22 @@ | ||
| project: feast_mcp_example | ||
| registry: data/registry.db | ||
| provider: local | ||
|
|
||
| online_store: | ||
| type: sqlite | ||
| path: data/online_store.db | ||
|
|
||
| offline_store: | ||
| type: file | ||
|
|
||
| # MCP Feature Server Configuration | ||
| feature_server: | ||
| type: mcp | ||
| enabled: true | ||
| mcp_enabled: true # Enable MCP support - defaults to false | ||
| mcp_server_name: "feast-feature-store" | ||
| mcp_server_version: "1.0.0" | ||
| feature_logging: | ||
| enabled: false | ||
|
|
||
| entity_key_serialization_version: 3 | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentas mcp will only implement onlinstore, instead of make new section with feature_server is that possible we can add into into onlinstore section WDYT ? online_store:
type: sqlite
path: data/online_store.db
mcp:
enabled: true
server_name: "feast-feature-store"
server_version: "1.0.0"
feature_logging:
enabled: false```
Sorry, something went wrong.
👍
1
franciscojavierarceo reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentWhile embedding MCP config in the online_store section might seem logical, I'd recommend using a separate feature_server section instead: online_store:
type: sqlite
path: data/online_store.db
feature_server:
type: mcp
enabled: true
mcp_enabled: true
mcp_server_name: "feast-feature-store"
mcp_server_version: "1.0.0"
feature_logging:
enabled: false
Why this approach is better:
What do u think @franciscojavierarceo @ntkathole
Sorry, something went wrong.
👍
1
franciscojavierarceo reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentI'm good with it.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentWhat is the purpose of these 3 fields type: mcp
enabled: true
mcp_enabled: true
my suggestion was if we change the name for example mcp_server then maybe we don't required these field. you can look mcp_server section if user added that section then it will be enabled else by default it will disabled/null. Let me know if that make sense or the current approach is more better. Thanks
Sorry, something went wrong.
👍
1
franciscojavierarceo reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment+1
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentWhat @redhatHameed suggested 👍
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentIn short MCP online store config looks like: feature_server:
type: mcp
mcp_server_name: "feast-feature-store"
mcp_server_version: "1.0.0"
feature_logging: enabled: false
No hassle of enabling explicitely.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commenteven if we can make like, that will remove extra type field. mcp_server:
mcp_server_name: "feast-feature-store"
mcp_server_version: "1.0.0"
feature_logging: enabled: false
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment@redhatHameed mind addressing in a follow up PR? I think this is good enough as an MVP
Sorry, something went wrong.
👍
1
redhatHameed reacted with thumbs up emoji
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment@YassinNouh21 this item. Removing the type field from the mcp_server object.
Sorry, something went wrong.
👍
1
YassinNouh21 reacted with thumbs up emoji
All reactions
|
||
| @@ -0,0 +1,9 @@ | ||
| # MCP (Model Context Protocol) server implementations for Feast | ||
|
|
||
| from .mcp_config import McpFeatureServerConfig | ||
| from .mcp_server import add_mcp_support_to_app | ||
|
|
||
| __all__ = [ | ||
| "McpFeatureServerConfig", | ||
| "add_mcp_support_to_app", | ||
| ] |
| @@ -0,0 +1,27 @@ | ||
| from typing import Literal, Optional | ||
|
|
||
| from pydantic import StrictBool, StrictStr | ||
|
|
||
| from feast.infra.feature_servers.base_config import BaseFeatureServerConfig | ||
|
|
||
|
|
||
| class McpFeatureServerConfig(BaseFeatureServerConfig): | ||
| """MCP (Model Context Protocol) Feature Server configuration.""" | ||
|
|
||
| # Feature server type selector | ||
| type: Literal["mcp"] = "mcp" | ||
|
|
||
| # Enable MCP server support - defaults to False as requested | ||
| mcp_enabled: StrictBool = False | ||
|
|
||
| # MCP server name for identification | ||
| mcp_server_name: StrictStr = "feast-mcp-server" | ||
|
|
||
| # MCP server version | ||
| mcp_server_version: StrictStr = "1.0.0" | ||
|
|
||
| # Optional MCP transport configuration | ||
| mcp_transport: Optional[StrictStr] = None | ||
|
|
||
| # The endpoint definition for transformation_service (inherited from base) | ||
| transformation_service_endpoint: StrictStr = "localhost:6566" |
| @@ -0,0 +1,58 @@ | ||
| """ | ||
| MCP (Model Context Protocol) integration for Feast Feature Server. | ||
|
|
||
| This module provides MCP support for Feast by integrating with fastapi_mcp | ||
| to expose Feast functionality through the Model Context Protocol. | ||
| """ | ||
|
|
||
| import logging | ||
| from typing import Optional | ||
|
|
||
| from feast.feature_store import FeatureStore | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| try: | ||
| from fastapi_mcp import FastApiMCP | ||
|
|
||
| MCP_AVAILABLE = True | ||
| except ImportError: | ||
| logger.warning( | ||
| "fastapi_mcp is not installed. MCP support will be disabled. " | ||
| "Install it with: pip install fastapi_mcp" | ||
| ) | ||
| MCP_AVAILABLE = False | ||
| # Create placeholder classes for testing | ||
| FastApiMCP = None | ||
|
|
||
|
|
||
| def add_mcp_support_to_app(app, store: FeatureStore, config) -> Optional["FastApiMCP"]: | ||
| """Add MCP support to the FastAPI app if enabled in configuration.""" | ||
| if not MCP_AVAILABLE: | ||
| logger.warning("MCP support requested but fastapi_mcp is not available") | ||
| return None | ||
|
|
||
| try: | ||
| # Create MCP server from the FastAPI app | ||
| mcp = FastApiMCP( | ||
| app, | ||
| name=getattr(config, "mcp_server_name", "feast-feature-store"), | ||
| description="Feast Feature Store MCP Server - Access feature store data and operations through MCP", | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment@YassinNouh21 can we check if we can use other parameters like describe_full_response_schema=True,
describe_all_responses=True,
Sorry, something went wrong.
👍
1
YassinNouh21 reacted with thumbs up emoji
All reactions
|
||
| ) | ||
|
|
||
| # Mount the MCP server to the FastAPI app | ||
| mcp.mount() | ||
|
|
||
| logger.info( | ||
| "MCP support has been enabled for the Feast feature server at /mcp endpoint" | ||
| ) | ||
| logger.info( | ||
| f"MCP integration initialized for {getattr(config, 'mcp_server_name', 'feast-feature-store')} " | ||
| f"v{getattr(config, 'mcp_server_version', '1.0.0')}" | ||
| ) | ||
|
|
||
| return mcp | ||
|
|
||
| except Exception as e: | ||
| logger.error(f"Failed to initialize MCP integration: {e}") | ||
| return None | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentThank you for this!
I'd also add this to the GenAI docs and make it an extra that we enable with pip install feast[mcp]
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment@franciscojavierarceo done can u check it
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.