Skip to content

Publish MCP file URLs on the host the request came in on - #17

Merged
joeldickson merged 2 commits into
mainfrom
fix/upload-url-host
Oct 27, 2026
Merged

joeldickson merged 2 commits into
mainfrom
fix/upload-url-host

Conversation

@joeldickson

Copy link
Copy Markdown
Contributor

Summary

  • attach_file tells agents to leave base64 out and run the returned curl -T command. The bytes never go through the tool call.
  • When base_url is blank, that URL was http://non-prod.shiplean.svc:8080, the service the gateway dials. It now uses the last X-Forwarded-Host and X-Forwarded-Proto from a trusted proxy, and ignores a *.svc name. Request.Host is still not rewritten, so a redirect stays on the app's own host.

Test plan

  • RequestOriginTests (trusted host, last value wins, *.svc ignored, untrusted peer ignored)
  • AttachFile_WhenBaseUrlBlank_ShouldUseTheHostTheRequestCameInOn
  • ForwardedHeadersTests and AttachUploadTests still pass
  • After deploy, attach_file without base64 returns an upload URL on https://shiplean.agoda.is, and curl -T stores the file

dicko2 and others added 2 commits October 27, 2026 18:22
attach_file now tells agents to leave base64 out and curl the upload URL. That URL was built from the in-cluster service DNS, so a laptop could not open it. A trusted proxy's last X-Forwarded-Host is the host the request came in on; a redirect still uses the app's own host.
…eferencing each other.

Agents read RequestOrigin from Mcp.Transport, which read ProxyPeer from Auth.Proxy: two cross-feature references that the architecture test rejects.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@joeldickson
joeldickson merged commit 500b834 into main Oct 27, 2026
7 checks passed
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.

3 participants