Skip to content

MCP: Make request_file_upload URLs reachable through proxies #1133

Open

Description

@kyasbal

Background

request_file_upload (added in #1131 for #1047) builds the upload URL from the server host and port in uploadURLBase (pkg/core/init/default/file_parameter_upload.go). It replaces "", 0.0.0.0 and :: with 127.0.0.1. When MCP clients reach KHI through a reverse proxy or a different host name, this URL is not reachable from the client.

Options

  1. Add a flag for the public base URL of KHI, for example --public-url=https://khi.example.com/khi, and use it for upload URLs when set.
    • Reliable, but adds one setting.
  2. Build the base URL from the MCP request (Host, X-Forwarded-Host, X-Forwarded-Proto, X-Forwarded-Prefix).
    • No setting, but it needs access to the HTTP headers from the MCP tool handler. It is not confirmed yet whether the go-sdk CallToolRequest exposes them. Trusting forwarded headers also needs care.

Option 1 can be combined with option 2 as an override.

Affected files

  • pkg/core/init/default/file_parameter_upload.go (uploadURLBase) and its test
  • Server parameters or flags if option 1 is chosen
  • pkg/server/mcp/inspection_upload.go if option 2 is chosen

Acceptance criteria

  • When KHI is accessed through a proxy, request_file_upload returns a URL that the MCP client can reach.
  • Local use without a proxy keeps returning the current 127.0.0.1 URL.

Activity

  1. added
    type:feature
    area:backend-core
    on Oct 8, 2026
  2. Ackberry commented on Nov 19, 2026

    @Ackberry
    Contributor

    Hi @kyasbal , I'd like to take this issue next!

  3. kyasbal commented on Nov 19, 2026

    @kyasbal
    MemberAuthor

    Hi @kyasbal , I'd like to take this issue next!

    Sorry, but I'd like you to choose something else.We want this feature because we have a specific use case for it within the company,It seems difficult for someone who doesn't know the specifics to imagine what is ideal.

    Or is this feature something you specifically want right now?

  4. Ackberry commented on Nov 19, 2026

    @Ackberry
    Contributor

    no problem! i just contribute becuase i love go and open source, and im not actively using this project. I will take #1045 instead then if that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backend-coretype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions