Skip to content

app/: MCP answers on VISUALCI_MCP_URL's host (production 403 after cutover) - #115

Open
ndbroadbent wants to merge 1 commit into
mainfrom
app-mcp-allowed-hosts
Open

ndbroadbent wants to merge 1 commit into
mainfrom
app-mcp-allowed-hosts

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

After cutover, production MCP refused every request: POST https://mcp.visualci.com/mcp answered 403 "Host header is not allowed". That's rmcp's DNS-rebinding guard. service() in app/src/mcp/mod.rs gave it localhost, app_url() and APP_URL, but never VISUALCI_MCP_URL's host, which is where MCP clients connect. Production is running on VISUALCI_MCP_HOSTS=mcp.visualci.com for now.

Fix: rmcp's allowed hosts now include every configured host: VISUALCI_MCP_URL, VISUALCI_API_URL, VISUALCI_APP_URL and VISUALCI_SITE_URL, plus the existing localhost, app address and VISUALCI_MCP_HOSTS extras. route_by_host still decides which host serves /mcp. Once this is live, the VISUALCI_MCP_HOSTS override can go.

Test: app/tests/mcp_hosts.rs is a file of its own, because the MCP service is built once per process. With all four host URLs set:

  • POST /mcp with Host: mcp.visualci.test and a personal token gets 200 initialize with serverInfo;
  • an unknown host is still refused.

Without the fix, the test fails with production's error ("Forbidden: Host header is not allowed"). The old tests never set the host URLs, which is how this was missed.

Checks: on agents-build-1, cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and the full cargo test --locked pass. One run hit the flaky invite_member golden that #112 fixes.


Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…e every configured host

Production MCP answered 403 "Host header is not allowed": rmcp's DNS-rebinding guard was given localhost and APP_URL, never the MCP host. tests/mcp_hosts.rs posts initialize with Host: mcp.visualci.test.

This branch has not been deployed

No deployments
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.

1 participant