Skip to content

Allow configuring the advertised MCP Apps sandbox URL #1862

Description

@eitansuez

Allow configuring the advertised MCP Apps sandbox URL (e.g. MCP_SANDBOX_FULL_ADDRESS)

Summary

Please add a way to override the public MCP Apps sandbox URL returned by GET /api/config as sandboxUrl, independent of the process bind address.

Today the sandbox listen URL is built in clients/web/server/sandbox-controller.ts roughly as:

sandboxUrl = `http://${urlHost}:${actualPort}/sandbox`;

When the server binds 0.0.0.0, urlHost is forced to localhost. There is MCP_SANDBOX_PORT for the port, but no env/config for scheme + hostname (unlike v1’s MCP_PROXY_FULL_ADDRESS for the proxy).

Why this matters

In remote / container / lab setups the browser does not share the Inspector process’s localhost:

  • UI is reached at a public hostname, e.g. https://inspector.example.com/
  • Sandbox is (or can be) routed separately, e.g. https://inspector-sandbox.example.com/sandbox
  • /api/config still advertises http://localhost:6275/sandbox
  • “Open App” points the iframe at the browser’s localhost → connection refused / mixed content on HTTPS

Routing port 6275 and setting ALLOWED_ORIGINS is not enough; the advertised sandboxUrl must be a URL the browser can actually open.

This also affects Docker, k8s ingress, and any reverse-proxy hostname split between UI and sandbox.

Proposed solution

Something parallel to v1 MCP_PROXY_FULL_ADDRESS, for example:

MCP_SANDBOX_FULL_ADDRESS=https://inspector-sandbox.example.com/sandbox

Behavior:

  1. If set, use it as sandboxUrl in GET /api/config (and banner).
  2. If unset, keep current bind-derived http://<host>:<port>/sandbox behavior.
  3. Document that the process must still listen on MCP_SANDBOX_PORT (or equivalent) and that the public URL must be routed to that listener.
  4. ALLOWED_ORIGINS remains responsible for UI origin / frame-ancestors (orthogonal).

Alternatives considered

  • SSH/port-forward both 6274 and 6275 so the browser uses localhost (works for dev; not for public Instruqt/k8s hostnames).
  • Rewrite /api/config at the gateway (works as a lab hack; shouldn’t be required).
  • Patch sandbox-controller.ts locally.

Related

  • Docs already note forwarding both UI and sandbox ports for remote App review.
  • #1276 is related remote/embed friction (referrer allowlist), but not the advertised URL override.
  • v1 precedent: MCP_PROXY_FULL_ADDRESS.

Environment

  • @modelcontextprotocol/inspector v2.0.0
  • Instruqt / k3d: UI on public HTTPS hostname; sandbox needs a second public hostname → pod :6275

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature requestv2Issues and PRs for v2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions