Skip to content

Commit 6c6f6ee

Browse files
committed
feat: add Model Context Protocol (MCP) support and update documentation
Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
1 parent 08c4dd6 commit 6c6f6ee

File tree

4 files changed

+61
-44
lines changed

4 files changed

+61
-44
lines changed

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* [Validating historical features with Great Expectations](tutorials/validating-historical-features.md)
5454
* [Building streaming features](tutorials/building-streaming-features.md)
5555
* [Retrieval Augmented Generation (RAG) with Feast](tutorials/rag-with-docling.md)
56+
* [MCP Feature Store Example - AI Agent Integration](../examples/mcp_feature_store/README.md)
5657

5758
## How-to Guides
5859

@@ -146,6 +147,7 @@
146147
* [Feature servers](reference/feature-servers/README.md)
147148
* [Python feature server](reference/feature-servers/python-feature-server.md)
148149
* [\[Alpha\] Go feature server](reference/feature-servers/go-feature-server.md)
150+
* [MCP Feature Server](reference/feature-servers/mcp-feature-server.md)
149151
* [Offline Feature Server](reference/feature-servers/offline-feature-server.md)
150152
* [Registry server](reference/feature-servers/registry-server.md)
151153
* [\[Beta\] Web UI](reference/alpha-web-ui.md)

docs/getting-started/genai.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,61 @@ This integration enables:
105105
- Efficiently materializing features to vector databases
106106
- Scaling RAG applications to enterprise-level document repositories
107107

108+
## Model Context Protocol (MCP) Support
109+
110+
Feast supports the Model Context Protocol (MCP), which enables AI agents and applications to interact with your feature store through standardized MCP interfaces. This allows seamless integration with LLMs and AI agents for GenAI applications.
111+
112+
### Key Benefits of MCP Support
113+
114+
* **Standardized AI Integration**: Enable AI agents to discover and use features dynamically without hardcoded definitions
115+
* **Easy Setup**: Add MCP support with a simple configuration change and `pip install feast[mcp]`
116+
* **Agent-Friendly APIs**: Expose feature store capabilities through MCP tools that AI agents can understand and use
117+
* **Production Ready**: Built on top of Feast's proven feature serving infrastructure
118+
119+
### Getting Started with MCP
120+
121+
1. **Install MCP support**:
122+
```bash
123+
pip install feast[mcp]
124+
```
125+
126+
2. **Configure your feature store** to use MCP:
127+
```yaml
128+
feature_server:
129+
type: mcp
130+
enabled: true
131+
mcp_enabled: true
132+
mcp_server_name: "feast-feature-store"
133+
mcp_server_version: "1.0.0"
134+
```
135+
136+
### How It Works
137+
138+
The MCP integration uses the `fastapi_mcp` library to automatically transform your Feast feature server's FastAPI endpoints into MCP-compatible tools. When you enable MCP support:
139+
140+
1. **Automatic Discovery**: The integration scans your FastAPI application and discovers all available endpoints
141+
2. **Tool Generation**: Each endpoint becomes an MCP tool with auto-generated schemas and descriptions
142+
3. **Dynamic Access**: AI agents can discover and call these tools dynamically without hardcoded definitions
143+
4. **Standard Protocol**: Uses the Model Context Protocol for standardized AI-to-API communication
144+
145+
### Available MCP Tools
146+
147+
The fastapi_mcp integration automatically exposes your Feast feature server's FastAPI endpoints as MCP tools. This means AI assistants can:
148+
149+
* **Call `/get-online-features`** to retrieve features from the feature store
150+
* **Use `/health`** to check server status
151+
152+
For a complete example, see the [MCP Feature Store Example](../../examples/mcp_feature_store/).
153+
108154
## Learn More
109155

110156
For more detailed information and examples:
111157

112158
* [Vector Database Reference](../reference/alpha-vector-database.md)
113159
* [RAG Tutorial with Docling](../tutorials/rag-with-docling.md)
114160
* [Milvus Quickstart Example](https://github.com/feast-dev/feast/tree/master/examples/rag/milvus-quickstart.ipynb)
161+
* [MCP Feature Store Example](../../examples/mcp_feature_store/)
162+
* [MCP Feature Server Reference](../reference/feature-servers/mcp-feature-server.md)
115163
* [Spark Data Source](../reference/data-sources/spark.md)
116164
* [Spark Offline Store](../reference/offline-stores/spark.md)
117165
* [Spark Batch Materialization](../reference/batch-materialization/spark.md)

examples/mcp_feature_store/README.md

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ This example demonstrates how to enable MCP (Model Context Protocol) support in
1010

1111
## Installation
1212

13-
1. Install Feast if you haven't already:
13+
1. Install Feast with MCP support:
1414
```bash
15-
pip install feast
15+
pip install feast[mcp]
1616
```
1717

18-
2. Install the MCP dependencies:
18+
Alternatively, you can install the dependencies separately:
1919
```bash
20+
pip install feast
2021
pip install fastapi_mcp
2122
```
2223

@@ -35,12 +36,6 @@ This will create a `data` subdirectory and a `feature_repo` subdirectory if they
3536

3637
3. Apply the feature store configuration:
3738
```bash
38-
# Make sure you are in the directory where feature_store.yaml is located
39-
# (examples/mcp_feature_store after running 'feast init .')
40-
# Then, navigate into the 'feature_repo' directory created by 'feast init'
41-
# This is where your feature definitions would typically reside.
42-
# For this example, we don't have separate feature definition files yet,
43-
# but 'feast apply' still needs to be run from within a Feast project context.
4439
cd feature_repo
4540
feast apply
4641
cd .. # Go back to examples/mcp_feature_store for the next steps
@@ -62,43 +57,11 @@ INFO:feast.feature_server:MCP support has been enabled for the Feast feature ser
6257

6358
## Available MCP Tools
6459

65-
The server exposes the following MCP tools that can be used by AI agents:
66-
67-
- `get_online_features`: Retrieve feature values for entities
68-
- `list_feature_views`: List all available feature views
69-
- `list_feature_services`: List all available feature services
70-
- `get_feature_store_info`: Get information about the feature store
71-
72-
## Available MCP Resources
73-
74-
- `feast://feature-views`: JSON resource with all feature views
75-
- `feast://feature-services`: JSON resource with all feature services
76-
77-
## Testing MCP Functionality
60+
The fastapi_mcp integration automatically exposes your Feast feature server's FastAPI endpoints as MCP tools. This means AI assistants can:
7861

79-
You can test the MCP functionality by connecting an MCP-compatible client to the server endpoint. The exact method depends on your MCP client.
62+
- **Call `/get-online-features`** to retrieve features from the feature store
63+
- **Use `/health`** to check server status
8064

81-
## Example MCP Client Interaction
82-
83-
```python
84-
# Example of how an MCP client might interact with the server
85-
# (This would be implemented by your MCP client library)
86-
87-
# Get feature store information
88-
store_info = await mcp_client.call_tool("get_feature_store_info")
89-
print(f"Feature store: {store_info}")
90-
91-
# List available feature views
92-
feature_views = await mcp_client.call_tool("list_feature_views")
93-
print(f"Available feature views: {feature_views}")
94-
95-
# Get features for specific entities
96-
features = await mcp_client.call_tool("get_online_features", {
97-
"entities": {"driver_id": [1001, 1002]},
98-
"features": ["driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate"]
99-
})
100-
print(f"Features: {features}")
101-
```
10265

10366
## Configuration Details
10467

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@
173173

174174
CLICKHOUSE_REQUIRED = ["clickhouse-connect>=0.7.19"]
175175

176+
MCP_REQUIRED = ["fastapi_mcp"]
177+
176178
CI_REQUIRED = (
177179
[
178180
"build",
@@ -247,6 +249,7 @@
247249
+ DOCLING_REQUIRED
248250
+ TORCH_REQUIRED
249251
+ CLICKHOUSE_REQUIRED
252+
+ MCP_REQUIRED
250253
)
251254
MINIMAL_REQUIRED = (
252255
GCP_REQUIRED
@@ -346,6 +349,7 @@
346349
"pytorch": TORCH_REQUIRED,
347350
"nlp": NLP_REQUIRED,
348351
"clickhouse": CLICKHOUSE_REQUIRED,
352+
"mcp": MCP_REQUIRED,
349353
},
350354
include_package_data=True,
351355
license="Apache",

0 commit comments

Comments
 (0)