Skip to main content

Remote sign-in through your own tunnel

Experimental, personal edition only (Spec 145). Off by default; nothing changes until you switch it on.

Remote sign-in lets a web AI client — ChatGPT custom connectors, claude.ai custom connectors — use MCPProxy through a tunnel you run, for example Cloudflare Tunnel (cloudflared). The client signs in with OAuth in the browser, you approve each sign-in on the MCPProxy computer by typing a short code, and the client then sees the tools of one profile you opened for remote use. Nothing else of MCPProxy — Web UI, REST API, /mcp, events — is reachable through the tunnel.

It builds on browser login for MCP clients, which must be on.

Security model​

MCPProxy decides for every request whether it is local or remote, once, before any other handler runs. A request is remote when any of these hold (TCP, Unix socket and named pipe alike):

  • its Host (or absolute-form target, or HTTP/2 :authority) is not exactly localhost, a 127.x.x.x address or [::1], with an optional port — or those forms disagree;
  • its target is unusual (CONNECT, absolute-form, OPTIONS *);
  • the TCP peer is not a loopback address;
  • it carries any forwarding or tunnel header (Forwarded, Via, X-Forwarded-*, X-Real-IP, CF-*, True-Client-IP, CDN-Loop and similar), or the configured client_ip_header.

No header ever makes a request local. A remote request is answered only on:

PathPurpose
GET /.well-known/oauth-authorization-serverauthorization server metadata
GET /.well-known/oauth-protected-resource/mcp/oauth/<client-id>protected resource metadata
POST /oauth/registerclient registration (return address must be on the allow-list)
GET /oauth/authorize, GET /oauth/waitsign-in start and the waiting page with the code
POST /oauth/tokencode exchange and refresh
/mcp/oauth/<client-id> (GET, POST, DELETE)the client's MCP address, remote token required

Everything else answers 404 to a remote request, whatever require_mcp_auth says and whatever key is sent. Issuer and resource come from public_origin in the configuration, never from request headers.

What a remote login gets:

  • Its own tokens (mcp_rac_ code, mcp_rat_ access, mcp_rrt_ refresh). A remote token is refused on every local address; a local token or the API key is refused remotely.
  • One profile, the one its client is bound to, which must have Allow remote connection through the tunnel (allow_remote) on. Checked on every request; switching it off stops the client at once.
  • A small tool surface: retrieve_tools, describe_tool, call_tool_read|write|destructive, read_cache, the read-only skills tools (when enable_skills is on) and the profile's direct tools (in the routing modes that list them). Never upstream_servers, quarantine_security, code_execution or profile tools.
  • A short list of MCP methods: initialize, ping, tools/list, tools/call, the initialized, cancelled and progress notifications, and server/discover. The remote address speaks the same protocol versions as the local ones (up to 2025-11-25), so a 2026-07-28 client such as ChatGPT gets "method not found" for its server/discover probe and falls back to initialize. Any other request (prompts, resources, logging, completion, tasks, subscriptions) is answered "method not found" without reaching MCPProxy's MCP server; a notification, batch or malformed message outside the list gets 403.
  • Bounded connections: per login at most 16 requests in progress (64 across all logins), 16 open listening streams (GET, 64 in all), 32 sessions, and 600 MCP requests a minute with bursts of 150. ChatGPT opens a new session for every tool call (about 6 requests) and runs up to 10 calls at once; these numbers carry that with room for its retries. A login's new stream ends its own oldest one instead of being refused (an ended stream that has not closed yet still counts; a login has at most 32 streams open or closing). Past the request, stream or rate limits the answer is 429 with Retry-After and a JSON-RPC error; past the session limit the oldest session ends.
  • Never administrator rights. Approval happens only on a local surface, by code.

The threat to keep in mind: if your tunnel removed every header and rewrote Host to localhost, its traffic would look local. Cloudflare Tunnel cannot do that (Cloudflare adds CF-Ray, which cannot be removed), but run the setup check anyway, and turn on require_mcp_auth so plain /mcp would still need a key.

Configuration​

{
"listen": "127.0.0.1:8080",
"require_mcp_auth": true,
"mcp_oauth_enabled": true,
"remote_oauth": {
"enabled": true,
"public_origin": "https://mcp.example.com",
"client_ip_header": "CF-Connecting-IP"
}
}
  • public_origin — the public HTTPS address of the tunnel; no path. Every remote login is bound to it: changing it while MCPProxy runs revokes every remote login for good, and a login issued for another origin is never accepted.
  • client_ip_header — optional; the header that carries the visitor address, used for per-address limits and display only. Its presence also marks a request remote, and every name it ever held keeps doing so until mcpproxy oauth remote reset.
  • redirect_uris — optional; replaces the default allow-list of client return addresses (https://chatgpt.com/connector_platform_oauth_redirect, https://claude.ai/api/mcp/auth_callback). Matching is exact.

Environment overrides for one process: MCPPROXY_REMOTE_OAUTH_ENABLED, MCPPROXY_REMOTE_OAUTH_PUBLIC_ORIGIN.

Keep listen on loopback. With a LAN address, trusted_hosts or trusted_proxies set, LAN users and local reverse proxies become remote and lose the Web UI and REST API while remote mode is on; mcpproxy doctor warns about it.

Open a profile and add a client​

Every profile starts with remote connections off. Open one, preferably read-only:

  • Web UI: Profiles → edit → Allow remote connection through the tunnel.
  • macOS tray: the same switch in the profile editor.
  • CLI: mcpproxy profile update chatgpt-ro --allow-remote on

Then add a remote client bound to it:

  • Web UI: Clients → Remote → Add remote client.
  • CLI: mcpproxy oauth remote clients add chatgpt --profile chatgpt-ro --name ChatGPT

The client's connector URL is <public_origin>/mcp/oauth/<client-id>, for example https://mcp.example.com/mcp/oauth/chatgpt.

A desktop app (Codex, Claude Code, Cursor) returns from the browser to a loopback address on its own computer. Add it with --native (Web UI: Desktop app), for example mcpproxy oauth remote clients add codex --profile chatgpt-ro --name Codex --native. Cursor also registers an https address that must be added to redirect_uris. See Desktop clients (Codex) for the setup and the trade-off.

Connect through your own Cloudflare tunnel​

  1. In Cloudflare, create a tunnel and a public hostname, for example mcp.example.com.

  2. Point the tunnel at the normal MCPProxy listener over HTTP. config.yml for cloudflared:

    tunnel: <tunnel-id>
    credentials-file: /etc/cloudflared/credentials.json
    ingress:
    - hostname: mcp.example.com
    service: http://localhost:8080
    - service: http_status:404
    • Use an http:// service. Never a tcp:// service: it carries raw bytes with no tunnel headers.
    • Leave originRequest.httpHostHeader unset. Do not add transform rules that remove CF-* or X-Forwarded-* headers: they are what marks the traffic remote (Cloudflare always adds CF-Ray, so the traffic is remote either way, but do not rely on less).
    • No header needs to be added. CF-Connecting-IP is passed by Cloudflare and used only if you set client_ip_header.
  3. First set remote_oauth as above and restart MCPProxy (or let the config watcher reload it), and confirm mcpproxy doctor shows Remote mode: on. Until remote mode is on — or was used and not reset — MCPProxy does not classify requests, so a running tunnel would reach the Web UI and health routes like a local client.

  4. Then run cloudflared tunnel run <tunnel-name> on the MCPProxy computer (or as a sidecar, below).

  5. Run the setup check before adding the connector anywhere.

Kubernetes with a cloudflared sidecar​

Remote sign-in is personal-edition only, and the published container image is the server edition, so build a small image from the Linux release archive (mcpproxy binary) and run it next to cloudflared in one pod. Both containers share the pod's loopback interface.

apiVersion: apps/v1
kind: Deployment
metadata:
name: mcpproxy
spec:
replicas: 1
selector:
matchLabels: { app: mcpproxy }
template:
metadata:
labels: { app: mcpproxy }
spec:
containers:
- name: mcpproxy
image: registry.example.com/mcpproxy-personal:latest # your image with the personal binary
# Config and data (logins, the remote-mode marker) both on the volume, so a
# replaced pod keeps refusing tunnel traffic. The config sets listen 127.0.0.1:8080
# and remote_oauth.enabled true before the pod is first started.
args: ["serve", "--config", "/data/mcp_config.json", "--data-dir", "/data"]
env:
- { name: HEADLESS, value: "true" }
volumeMounts:
- { name: data, mountPath: /data }
# The listener is on loopback, so tcpSocket and httpGet probes (which
# connect to the pod IP) cannot reach it. Probe from inside the container.
livenessProbe:
exec:
command: ["sh", "-c", "wget -qO- http://127.0.0.1:8080/healthz >/dev/null"]
periodSeconds: 30
readinessProbe:
exec:
command: ["sh", "-c", "wget -qO- http://127.0.0.1:8080/readyz >/dev/null"]
periodSeconds: 10
- name: cloudflared
image: cloudflare/cloudflared:latest
args: ["tunnel", "--no-autoupdate", "--config", "/etc/cloudflared/config.yml", "run"]
volumeMounts:
- { name: cloudflared, mountPath: /etc/cloudflared, readOnly: true }
volumes:
- name: data
persistentVolumeClaim: { claimName: mcpproxy-data }
- name: cloudflared
secret: { secretName: cloudflared-tunnel } # config.yml + credentials.json

Administer it from inside the pod or over a port-forward — both are local requests:

# -c/-d point the CLI at the core's config and data directory (its socket lives there)
kubectl exec deploy/mcpproxy -c mcpproxy -- mcpproxy -c /data/mcp_config.json -d /data oauth requests list
kubectl exec deploy/mcpproxy -c mcpproxy -- mcpproxy -c /data/mcp_config.json -d /data oauth requests approve --code K7QM-2XFD
kubectl port-forward deploy/mcpproxy 8080:8080 # then open http://localhost:8080/ui/?apikey=<api_key from the config>

Do not create a Kubernetes Service or Ingress for port 8080: the tunnel is the only way in.

Setup check​

Run this every time you set up or change the tunnel, from a machine outside it:

curl -s -o /dev/null -w '%{http_code}\n' https://mcp.example.com/api/v1/status # must print 404
curl -s -o /dev/null -w '%{http_code}\n' https://mcp.example.com/mcp # must print 404
curl -s https://mcp.example.com/.well-known/oauth-authorization-server | grep -o '"issuer":"[^"]*"' # must print your public_origin

The third command must print "issuer":"https://mcp.example.com". If it prints nothing, remote mode is not on (mcpproxy doctor says so), MCPProxy refused the request (see its log), or the request did not reach MCPProxy (check the tunnel's hostname). Do not add the connector until it prints the issuer. Any answer other than 404 on the first two means the tunnel's traffic is classified local. Stop the tunnel and fix it (check the service is http://localhost:8080, no httpHostHeader, no header-removing rules) before going further.

mcpproxy doctor shows a Remote Sign-in section with the requests classified remote in the last 24 hours. If it warns that remote mode has been on for an hour with no remote request at all, the tunnel may be making its traffic look local: run the setup check.

Add the connector​

ChatGPT (custom MCP connectors depend on the plan — at the time of writing Business, Enterprise and Edu; web only):

  1. Follow OpenAI's current help page for adding a custom MCP connector (the menus and whether developer mode is needed change over time).
  2. Create a connector with the URL https://mcp.example.com/mcp/oauth/chatgpt and OAuth authentication.
  3. ChatGPT opens a sign-in window on your public origin, which shows Waiting for approval and a code such as K7QM-2XFD.

claude.ai: add a custom connector with the URL https://mcp.example.com/mcp/oauth/claude (a client added as claude). The same waiting page opens.

Approve the sign-in​

The code is shown only in the browser that started the sign-in — never by the Web UI, CLI or REST — so typing it proves you approve the request you are looking at.

  • Web UI (on the MCPProxy computer or through a port-forward): Clients → Remote, find the pending sign-in, type the code, Approve. Or Deny.

  • CLI:

    mcpproxy oauth requests list
    mcpproxy oauth requests approve --code K7QM-2XFD
    mcpproxy oauth requests deny <request-id>
  • macOS tray: a notification "Remote sign-in request for ChatGPT — code shown in the requesting browser". Open the Web UI to type the code.

Five different wrong codes within ten minutes cancel every pending remote request (the same wrong code typed again is counted once). A request expires after ten minutes; at most five are pending (two per client). A login expires 90 days after its first token exchange, whatever the refreshes.

Revoke, switch off, reset​

mcpproxy oauth remote clients list
mcpproxy oauth remote clients revoke chatgpt # every login of the client ends, client stays
mcpproxy oauth remote clients remove chatgpt # logins end, client removed
mcpproxy profile update chatgpt-ro --allow-remote off # client stops at once, tokens kept

The Web UI Clients → Remote list has the same actions (Revoke, and Forget = remove) and shows why a client is blocked (profile not open for remote, remote mode off, …).

Switching off: set remote_oauth.enabled to false. Pending requests and codes are cancelled. Once remote mode has been used, MCPProxy keeps refusing tunnel traffic (404 on every path) even while it is off, so a tunnel left running reaches nothing. mcpproxy doctor says so. To go back to the never-used behaviour — removing every remote client, registration and login — run, with remote mode off:

mcpproxy oauth remote reset

Audit and activity​

Remote calls appear in the activity log with origin: remote and the caller remote:<client-id>. Audit lines caused by a remote token use caller kind oauth with the login's grant_id (see audit log).