Skip to content

fix: STDIO and SSE transports need MCP_FULL_PROXY_ADDRESS #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

richardkmichael
Copy link
Collaborator

@richardkmichael richardkmichael commented Aug 12, 2025

Motivation and Context

#630

The MCP client needs to know the full path to the proxy server when opening the SSE transport for STDIO and SSE endpoints.

The client knows where it expects to see the server, so pass this to the server, to use when building the endpoint.

How Has This Been Tested?

Start nginx as proxy for the backed. Using an nginx proxy: nginx -c inspector.conf (below).

Open the Inspector, set the Inspector Proxy Address to a URL through nginx: http://localhost:9000/mcp/inspector/backend.

# inspector.conf

daemon off;
error_log /dev/stdout info;
events {
}

http {
    upstream inspector-backend {
        server [::1]:6277;
        server 127.0.0.1:6277;
    }

    # Inspector backend only
    server {
        listen 9000;
        listen [::]:9000;

        server_name localhost;

        location /mcp/inspector/backend/ {
            proxy_pass http://inspector-backend/;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_buffering off;
            proxy_cache off;
            proxy_read_timeout 24h;
            proxy_set_header X-Accel-Buffering no;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
}

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

There are other ways to fix this, but my hunch is treating the client as authoritative will be most flexible different deployment scenarios, and also prevent a server-side / client-side configuration mismatch.

Also, I'd add a server test for this, but there are no server tests at the moment. Are server tests desired?

Issue #437 is related, for which there is a fix in a fork, not yet submitted as a PR. It looks like the right approach, appending to the query params from the env. This would close out the current proxy-related issues.

richardkmichael and others added 4 commits August 12, 2025 11:10
The STDIO and SSE transports use SSE between the client and the proxy
server.  SSE requires the client to initiate the MCP conversation
(event-stream) at the endpoint provided by the server.  The endpoint
provided by the server must obey where the client sees the server,
rather than being assumed to be server-root `/message`.

The Streamable HTTP endpoint does not need the full proxy address
because the response is an event-stream directly, and does not use SSE.
Tests verify that proxyFullAddress query parameter is sent for both
STDIO and SSE transports, but not Streamable HTTP, when
MCP_PROXY_FULL_ADDRESS is configured.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@richardkmichael richardkmichael changed the title fix: STDIO and SSE transports need MCP_FULL_PROXY_PATH fix: STDIO and SSE transports need MCP_FULL_PROXY_ADDRESS Aug 12, 2025
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