Skip to content

fix(mcp): derive MCP endpoint path dynamically from MCP_SERVER_URL#1051

Merged
Aaron ("AJ") Steers (aaronsteers) merged 2 commits into
mainfrom
devin/1782754405-mcp-endpoint-root-path
Jun 29, 2026
Merged

fix(mcp): derive MCP endpoint path dynamically from MCP_SERVER_URL#1051
Aaron ("AJ") Steers (aaronsteers) merged 2 commits into
mainfrom
devin/1782754405-mcp-endpoint-root-path

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Jun 29, 2026

Copy link
Copy Markdown
Member

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 configure https://mcp.internal.airbyte.ai/cloud-mcp/mcp — the trailing /mcp is redundant.

The fix derives the endpoint path from MCP_SERVER_URL:

mcp_path = "/" if urlparse(server_url).path.strip("/") else "/mcp"
  • MCP_SERVER_URL=https://…/cloud-mcp → serves at / → public URL is /cloud-mcp
  • MCP_SERVER_URL=http://localhost:8080 (default) → keeps /mcp

OIDC 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

  • New Features
    • The MCP HTTP service now automatically serves its endpoint based on the configured public base URL, including support for deployments behind a path-aware proxy.
    • If the public URL includes a path, the MCP endpoint is exposed at /; otherwise it uses the default /mcp route.
  • Bug Fixes
    • Improved startup behavior and logging to reflect the active MCP route.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

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-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You 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 Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@aaronsteers Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review June 29, 2026 17:39
Copilot AI review requested due to automatic review settings June 29, 2026 17:39
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e6446000-7091-4adc-b2f9-61bf0c0d0436

📥 Commits

Reviewing files that changed from the base of the PR and between 6ec1f98 and 10f0f44.

📒 Files selected for processing (1)
  • airbyte/mcp/http_main.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • airbyte/mcp/http_main.py

📝 Walkthrough

Walkthrough

The HTTP MCP entry point now derives its mount path from MCP_SERVER_URL, logs the selected path, and passes it into app.run(). The module docstring was updated to describe this path behavior.

Changes

Dynamic MCP path routing

Layer / File(s) Summary
Imports and dynamic path computation in main()
airbyte/mcp/http_main.py
Updates the module docstring, adds os and urlparse imports, reads MCP_SERVER_URL_ENV, derives mcp_path from the URL path, logs it, and passes path=mcp_path to app.run(...).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • airbytehq/PyAirbyte#1046: Adds the HTTP http_main.py entry point and the surrounding app.run(...) startup path that this PR now extends with dynamic path selection.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: deriving the MCP endpoint path from MCP_SERVER_URL.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1782754405-mcp-endpoint-root-path

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-http mount path dynamically from MCP_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.

Comment thread airbyte/mcp/http_main.py
@github-code-quality

github-code-quality Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest-fast

The overall coverage in the branch is 67%. The coverage in the branch is 65%.

Show a code coverage summary of the most impacted files.
File d9f652f 10f0f44 +/-
airbyte/_util/api_util.py 36% 37% +1%
airbyte/registry.py 70% 72% +2%
airbyte/mcp/_tool_utils.py 72% 77% +5%
airbyte/mcp/int...c_history_ui.py 0% 36% +36%
airbyte/mcp/int...hared_models.py 0% 81% +81%
airbyte/cloud/models.py 0% 91% +91%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/mcp/int...ive/__init__.py 0% 100% +100%
airbyte/mcp/int...tive/_prefab.py 0% 100% +100%

Python / code-coverage/pytest-no-creds

The overall coverage in the branch is 67%. The coverage in the branch is 65%.

Show a code coverage summary of the most impacted files.
File d9f652f 10f0f44 +/-
airbyte/_util/api_util.py 36% 37% +1%
airbyte/registry.py 70% 72% +2%
airbyte/mcp/_tool_utils.py 72% 77% +5%
airbyte/mcp/int...c_history_ui.py 0% 36% +36%
airbyte/mcp/int...hared_models.py 0% 81% +81%
airbyte/cloud/models.py 0% 91% +91%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/mcp/int...ive/__init__.py 0% 100% +100%
airbyte/mcp/int...tive/_prefab.py 0% 100% +100%

Python / code-coverage/pytest

The overall coverage in the branch is 72%. The coverage in the branch is 71%.

Show a code coverage summary of the most impacted files.
File d9f652f 10f0f44 +/-
airbyte/registry.py 70% 72% +2%
airbyte/mcp/_tool_utils.py 72% 77% +5%
airbyte/mcp/server.py 69% 76% +7%
airbyte/mcp/int...c_history_ui.py 0% 36% +36%
airbyte/mcp/int...hared_models.py 0% 81% +81%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/cloud/models.py 0% 93% +93%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/mcp/int...ive/__init__.py 0% 100% +100%
airbyte/mcp/int...tive/_prefab.py 0% 100% +100%

Updated June 29, 2026 18:08 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

…ation

Co-Authored-By: AJ Steers <aj@airbyte.io>
@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit 8b89e34 into main Jun 29, 2026
22 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1782754405-mcp-endpoint-root-path branch June 29, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants