Visitar URL original
feat: Support HTTP in MCP by Anarion-zuo · Pull Request #6109 · feast-dev/feast · GitHub
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
format
Signed-off-by: aaronzuo <anarionzuo@outlook.com>
  • Loading branch information
Anarion-zuo authored and ntkathole committed Apr 5, 2026
commit e69098e62a5fcf9ca03cdf463c9ca7976e490b2f
47 changes: 47 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,53 @@ jobs:
- name: Minimize uv cache
run: uv cache prune --ci

mcp-feature-server-runtime:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should go in integration tests please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is it this one? .github/workflows/pr_integration_tests.yml

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
architecture: x64
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
- name: Install dependencies
run: make install-python-dependencies-ci
- name: Start feature server (MCP HTTP)
run: |
cd examples/mcp_feature_store
uv run python -m feast.cli.cli serve --host 127.0.0.1 --port 6566 --workers 1 --no-access-log &
SERVER_PID=$!
echo $SERVER_PID > /tmp/feast_server_pid
for i in $(seq 1 60); do
if curl -fsS http://127.0.0.1:6566/health >/dev/null; then
break
fi
sleep 1
done
curl -fsS http://127.0.0.1:6566/health >/dev/null
- name: Validate MCP endpoint
run: |
curl -sS -D /tmp/mcp_headers -o /dev/null --max-time 2 -H "Accept: text/event-stream" http://127.0.0.1:6566/mcp || true
grep -E "^HTTP/.* 200" /tmp/mcp_headers
grep -i "^content-type: text/event-stream" /tmp/mcp_headers
- name: Stop feature server
if: always()
run: |
if [ -f /tmp/feast_server_pid ]; then
kill "$(cat /tmp/feast_server_pid)" || true
fi
- name: Minimize uv cache
if: always()
run: uv cache prune --ci

unit-test-ui:
runs-on: ubuntu-latest
env:
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/feast/infra/mcp_servers/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def add_mcp_support_to_app(app, store: FeatureStore, config) -> Optional["FastAp
description="Feast Feature Store MCP Server - Access feature store data and operations through MCP",
)

transport: Literal["sse", "http"] = getattr(config, "mcp_transport", "sse") or "sse"
transport: Literal["sse", "http"] = (
getattr(config, "mcp_transport", "sse") or "sse"

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.

or "sse" handles None but mcp_transport is now Literal["sse", "http"] so None is impossible. Can simplify to getattr(config, "mcp_transport", "sse").

)
if transport == "http":
mount_http = getattr(mcp, "mount_http", None)
if mount_http is None:
Expand Down
12 changes: 9 additions & 3 deletions sdk/python/tests/unit/infra/feature_servers/test_mcp_server.py
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def test_add_mcp_support_http_transport(self, mock_fast_api_mcp):

mock_app = Mock()
mock_store = Mock(spec=FeatureStore)
mock_config = SimpleNamespace(mcp_server_name="test-server", mcp_transport="http")
mock_config = SimpleNamespace(
mcp_server_name="test-server", mcp_transport="http"
)

mock_mcp_instance = Mock(spec_set=["mount_http"])
mock_fast_api_mcp.return_value = mock_mcp_instance
Expand Down Expand Up @@ -155,7 +157,9 @@ def test_add_mcp_support_with_exception(self, mock_logger, mock_fast_api_mcp):

mock_app = Mock()
mock_store = Mock(spec=FeatureStore)
mock_config = SimpleNamespace(mcp_server_name="test-server", mcp_transport="sse")
mock_config = SimpleNamespace(
mcp_server_name="test-server", mcp_transport="sse"
)

# Mock FastApiMCP to raise an exception
mock_fast_api_mcp.side_effect = Exception("MCP initialization failed")
Expand All @@ -177,7 +181,9 @@ def test_add_mcp_support_mount_exception(self, mock_fast_api_mcp):

mock_app = Mock()
mock_store = Mock(spec=FeatureStore)
mock_config = SimpleNamespace(mcp_server_name="test-server", mcp_transport="sse")
mock_config = SimpleNamespace(
mcp_server_name="test-server", mcp_transport="sse"
)

mock_mcp_instance = Mock(spec_set=["mount"])
mock_mcp_instance.mount.side_effect = Exception("Mount failed")
Expand Down