-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Add MCP (Model Context Protocol) support for Feast feature server #5406
New issue
Have 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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ba1feb6
Revert "fix: Update milvus connect function to work with remote insta…
franciscojavierarceo 86b6a20
test: Add Operator E2E tests for Feast Apply and Materialize function…
Srihari1192 1ed32d4
fix: Updating milvus connect function to work with remote instance (#…
Fiona-Waters 2bb7248
feat: Add MCP support to feature server configuration
YassinNouh21 479eb7a
fix linter
YassinNouh21 edbb58f
add example
YassinNouh21 a8b17e1
test: add test cases for the mcp server
YassinNouh21 bc00dba
fix linter
YassinNouh21 e3a30d7
formatting
YassinNouh21 8a644b5
docs: update README for MCP setup instructions
YassinNouh21 08c4dd6
fix: update transformation service endpoint and refactor MCP integration
YassinNouh21 6c6f6ee
feat: add Model Context Protocol (MCP) support and update documentation
YassinNouh21 c3043c1
fix: update entity key serialization version and improve README clarity
YassinNouh21 8b26804
Merge branch 'master' into feat/mcp
YassinNouh21 1bec81f
fix: refactor MCP imports to use the correct module path
YassinNouh21 8aa31a7
feat: Add MCP server implementation files
YassinNouh21 9409e6a
test: MCP server unit tests and integration tests
YassinNouh21 426744b
fix formatting
YassinNouh21 c40809b
fix formatting
YassinNouh21 6135cde
adding compiled requirements
franciscojavierarceo b31cc87
Merge branch 'master' into feat/mcp
franciscojavierarceo b9a84f3
fix linter
franciscojavierarceo dc71713
reverting duckdb change
franciscojavierarceo ba6f51a
needed to do file source and duckdb
franciscojavierarceo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add example
Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
- Loading branch information
commit edbb58f6c477d416e5faf68a351dddbce926d6d1
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| # 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 feature store through standardized MCP interfaces. | ||
|
YassinNouh21 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Python 3.8+ | ||
| 2. Feast installed | ||
| 3. FastAPI MCP library | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. Install Feast if you haven't already: | ||
| ```bash | ||
| pip install feast | ||
| ``` | ||
|
|
||
| 2. Install the MCP dependencies: | ||
| ```bash | ||
| pip install fastapi_mcp | ||
| ``` | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Initialize the Feast repository: | ||
| ```bash | ||
| feast init feast_mcp_example | ||
| cd feast_mcp_example | ||
| ``` | ||
|
|
||
| 2. Replace the default `feature_store.yaml` with the MCP-enabled configuration: | ||
| ```bash | ||
| cp ../feature_store.yaml . | ||
| ``` | ||
|
|
||
| 3. Apply the feature store configuration: | ||
| ```bash | ||
| feast apply | ||
| ``` | ||
|
|
||
| 4. Materialize some sample data (optional): | ||
| ```bash | ||
| feast materialize-incremental $(date +%Y-%m-%d) | ||
| ``` | ||
|
|
||
| ## 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 server exposes the following MCP tools that can be used by AI agents: | ||
|
|
||
| - `get_online_features`: Retrieve feature values for entities | ||
| - `list_feature_views`: List all available feature views | ||
| - `list_feature_services`: List all available feature services | ||
| - `get_feature_store_info`: Get information about the feature store | ||
|
|
||
| ## Available MCP Resources | ||
|
|
||
| - `feast://feature-views`: JSON resource with all feature views | ||
| - `feast://feature-services`: JSON resource with all feature services | ||
|
|
||
| ## Testing MCP Functionality | ||
|
|
||
| You can test the MCP functionality by connecting an MCP-compatible client to the server endpoint. The exact method depends on your MCP client. | ||
|
|
||
| ## Example MCP Client Interaction | ||
|
|
||
| ```python | ||
| # Example of how an MCP client might interact with the server | ||
| # (This would be implemented by your MCP client library) | ||
|
|
||
| # Get feature store information | ||
| store_info = await mcp_client.call_tool("get_feature_store_info") | ||
| print(f"Feature store: {store_info}") | ||
|
|
||
| # List available feature views | ||
| feature_views = await mcp_client.call_tool("list_feature_views") | ||
| print(f"Available feature views: {feature_views}") | ||
|
|
||
| # Get features for specific entities | ||
| features = await mcp_client.call_tool("get_online_features", { | ||
| "entities": {"driver_id": [1001, 1002]}, | ||
| "features": ["driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate"] | ||
| }) | ||
| print(f"Features: {features}") | ||
| ``` | ||
|
|
||
| ## 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" | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### MCP not working | ||
| - Ensure `fastapi_mcp` is installed: `pip list | grep fastapi_mcp` | ||
| - Check that `mcp_enabled: true` in your `feature_store.yaml` | ||
| - Look for error messages in the server logs | ||
|
|
||
| ### Server starts but no MCP support | ||
| - Verify the feature server type is set to "mcp" | ||
| - Check that both `enabled: true` and `mcp_enabled: true` are set | ||
| - Make sure the fastapi_mcp library is properly installed | ||
|
|
||
| ### Dependencies missing | ||
| If you see warnings about missing dependencies: | ||
| ```bash | ||
| pip install fastapi_mcp | ||
| ``` | ||
|
|
||
| Then restart the server. | ||
|
|
||
| ## Next Steps | ||
|
|
||
| 1. Integrate with your preferred MCP client | ||
| 2. Customize the MCP server configuration for your use case | ||
| 3. Add authentication and security as needed for production deployment | ||
| 4. Explore additional MCP tools and resources as they become available | ||
|
|
||
| ## Security Note | ||
|
|
||
| In production environments, ensure proper authentication and authorization are configured for your Feast deployment when exposing MCP endpoints. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: 2 | ||
|
YassinNouh21 marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thank 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]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.
@franciscojavierarceo done can u check it