fix(mcp): derive MCP endpoint path dynamically from MCP_SERVER_URL#1051
Conversation
When MCP_SERVER_URL has a path component (e.g. /cloud-mcp), the LB strips it, so serve at root. When running locally without a prefix (default http://localhost:8080), keep FastMCP default /mcp. Mirrors airbytehq/airbyte-ops-mcp#1002. Co-Authored-By: AJ Steers <aj@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou can test this version of PyAirbyte using the following: # Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1782754405-mcp-endpoint-root-path' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1782754405-mcp-endpoint-root-path'PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe HTTP MCP entry point now derives its mount path from ChangesDynamic MCP path routing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the MCP HTTP endpoint is mounted so that deployments behind a path-stripping load balancer don’t require users to append an extra /mcp suffix to the public URL.
Changes:
- Derives the
streamable-httpmountpathdynamically fromMCP_SERVER_URL’s URL path component. - Extends startup logging to include the effective
mcp_path.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage OverviewLanguages: Python Python / code-coverage/pytest-fastThe overall coverage in the branch is 67%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytest-no-credsThe overall coverage in the branch is 67%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytestThe overall coverage in the branch is 72%. The coverage in the branch is 71%. Show a code coverage summary of the most impacted files.
Updated |
…ation Co-Authored-By: AJ Steers <aj@airbyte.io>
Summary
Mirrors airbytehq/airbyte-ops-mcp#1002 for the cloud-mcp deployment.
The hosted cloud-mcp server is behind a path-stripping LB (
/cloud-mcp/*→/*), but FastMCP defaults to mounting the streamable-http endpoint at/mcp. This forces users to configurehttps://mcp.internal.airbyte.ai/cloud-mcp/mcp— the trailing/mcpis redundant.The fix derives the endpoint path from
MCP_SERVER_URL:MCP_SERVER_URL=https://…/cloud-mcp→ serves at/→ public URL is/cloud-mcpMCP_SERVER_URL=http://localhost:8080(default) → keeps/mcpOIDC routes are unaffected — they're derived from
base_url, not the MCP endpoint path.Link to Devin session: https://app.devin.ai/sessions/5bfc7d5ac9544cf1be05a9b1631cc890
Requested by: Aaron ("AJ") Steers (@aaronsteers)
Summary by CodeRabbit
/; otherwise it uses the default/mcproute.Important
Auto-merge enabled.
This PR is set to merge automatically when all requirements are met.