# Test a ChatGPT app or MCP server on localhost

> ChatGPT and Claude connect to MCP servers from their own infrastructure, so they can't reach `http://localhost:8000/mcp` on your laptop. Give the server a public HTTPS URL with `ssh -t -R 80:localhost:8000 stable@proxy.tunnl.gg host=localhost:8000` and add `https://<your-url>/mcp` as a custom MCP server in ChatGPT or a custom connector in Claude. With `stable@`, the URL stays the same each time you reconnect, so you register it once.

## 1. Run an MCP server locally

Any server that speaks the Streamable HTTP transport works. To follow along, here is the server from the [official Python SDK](https://github.com/modelcontextprotocol/python-sdk) README (version 2, Python 3.11 or later):

```python
# server.py
from mcp.server import MCPServer

mcp = MCPServer("Demo")


@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b
```

Serve it over HTTP with [uv](https://docs.astral.sh/uv/):

```bash
uv run --with "mcp[cli]" mcp run server.py --transport streamable-http
```

It listens on `http://127.0.0.1:8000` and answers MCP requests at `/mcp`. OpenAI's [Apps SDK quickstart](https://developers.openai.com/apps-sdk/quickstart) uses a TypeScript server on port 8787 instead; change the port in the commands below to match yours.

## 2. Open a tunnel

In a second terminal:

```bash
ssh -t -R 80:localhost:8000 stable@proxy.tunnl.gg host=localhost:8000
```

tunnl.gg prints a URL such as `https://brave-fox-7c41e09b.tunnl.gg`. Your MCP endpoint is that URL plus the path:

```text
https://brave-fox-7c41e09b.tunnl.gg/mcp
```

`stable@` ties the URL to your SSH key, [registered to a free account](/stable-urls#register-your-key). Drop it and you get a new random URL on every connection, which means adding the server to ChatGPT or Claude again each time. [How stable URLs work](/stable-urls).

### What `host=localhost:8000` does

The official SDKs protect local servers against DNS rebinding by checking the `Host` header. Without the option, the Python server above rejects tunneled requests with `421 Misdirected Request` and the body `Invalid Host header`. Anthropic's docs note the same for the TypeScript SDK's `createMcpExpressApp()`, which answers `403` with `Invalid Host: <hostname>`. `host=localhost:8000` makes tunnl.gg send your server the `Host` header it expects. The other way is to add your tunnel hostname to the server's allowed hosts, as [Anthropic's testing guide](https://claude.com/docs/connectors/building/testing.md#test-a-local-server) shows for TypeScript.

## 3. Check it with MCP Inspector

Before you involve ChatGPT or Claude, call the public URL from your terminal with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) command-line mode:

```bash
npx @modelcontextprotocol/inspector --cli https://brave-fox-7c41e09b.tunnl.gg/mcp --transport http --method tools/list
```

```bash
npx @modelcontextprotocol/inspector --cli https://brave-fox-7c41e09b.tunnl.gg/mcp --transport http --method tools/call --tool-name add --tool-arg a=1 --tool-arg b=2
```

The first lists the `add` tool and the second returns `3`. If these work, the tunnel and the server are fine, and any remaining problem is in the client's settings.

## 4. Add the URL to ChatGPT

OpenAI's [connect guide](https://developers.openai.com/apps-sdk/deploy/connect-chatgpt) describes the current steps:

1. Go to [ChatGPT Plugins](https://chatgpt.com/plugins).
2. Select the plus button, then **Add custom MCP server**.
3. Enter a name and description, and under **Connection** enter the URL including `/mcp`.
4. Configure authentication, review the risk warning, select **I understand and want to continue**, then **Create as a plugin**.

Account and workspace policies decide whether you can add custom MCP servers. After you change your tools, restart the server, open the connection in ChatGPT Plugins and select **Refresh**, then start a new conversation. A tunnel is for development: OpenAI requires a public HTTPS endpoint for plugin submission.

## 5. Add the URL to Claude

Following Anthropic's [guide to custom connectors](https://claude.com/docs/connectors/custom/add-unlisted.md):

1. Go to **Customize > Connectors**.
2. Select **Add**, then **Add custom connector**.
3. Enter a name and the URL including `/mcp`, then **Continue** and **Add**.

On the Free plan you can add one custom connector; on Team and Enterprise an Owner adds it for the organization. Claude reaches the server from Anthropic's infrastructure over IPv4, and drops the `Authorization` header if your URL redirects to a different host, so register the exact `/mcp` URL. Claude Code, by contrast, connects from your own machine and can use `http://localhost:8000/mcp` directly.

## Does the warning page get in the way?

Only for clients that identify as browsers. On free tunnels, tunnl.gg shows its phishing warning only to requests whose `User-Agent` looks like a browser: one containing Mozilla, Chrome, Safari, Firefox, Edge or Opera. Those are redirected to the warning page until the visitor clicks **Continue to site**, which sets a cookie for a day, or a week on a stable URL. Every other client reaches your server directly; we checked that with the MCP Inspector and `curl`.

ChatGPT and Claude call your server from their own backends, and neither documents the `User-Agent` it sends, so check rather than assume. Start the tunnel with `output=json` and watch the request lines:

```bash
ssh -T -R 80:localhost:8000 stable@proxy.tunnl.gg host=localhost:8000 output=json
```

A request to `/mcp` with the note `browser sent to the warning page` means that client looks like a browser to tunnl.gg. Clients you control can send the `tunnl-skip-browser-warning` header with any value; tunnels on [Pro](/pricing) don't show the page at all.

## Official tunnels from OpenAI and Anthropic

OpenAI offers [Secure MCP Tunnel](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels): you run the open-source [`tunnel-client`](https://github.com/openai/tunnel-client) next to your server, it opens an outbound connection to OpenAI, and ChatGPT, Codex and the Responses API reach your server without a public URL. It needs a Platform organization with tunnel permissions and a tunnel associated with your ChatGPT workspace, and it isn't for public plugin submission. It suits private company servers well.

Anthropic's [MCP tunnels](https://claude.com/docs/connectors/mcp-tunnels/overview) are a research preview for Claude Enterprise organizations, by request.

For a quick loop on your own laptop, a public HTTPS URL works with ChatGPT, Claude and the Inspector at once, with nothing to install.

## Things to know

- **The URL is public while the tunnel is open.** Anyone who finds it can call your tools. Keep test tools harmless, add OAuth before you expose anything real, and close the tunnel when you're done.
- **Free tunnels close after 2 hours idle or 24 hours in all.** Run the same `stable@` command to come back on the same URL; [keep a tunnel running](/guides/keep-a-tunnel-running) shows how to reconnect automatically.
- **Slow tools.** tunnl.gg ends a proxied request after 2 minutes without data. claude.ai allows up to 240 seconds per tool call, so stream progress or keep long tool calls under two minutes while testing.

## Common questions

### Do I need ngrok to test a ChatGPT app?

No. OpenAI's quickstart uses ngrok as its example, but its docs say any development tunnel or HTTPS forwarding service can provide the endpoint. tunnl.gg needs only the SSH client you already have, and `stable@` keeps the URL the same. See [tunnl.gg as an ngrok alternative](/ngrok-alternative).

### Why does Claude say it couldn't reach the MCP server?

Check the URL from outside with the Inspector command above first. If that fails with 421 or 403, your server is rejecting the tunnel hostname, so add `host=localhost:8000` to the tunnel command. If the Inspector works, check that the registered URL ends in `/mcp` and doesn't redirect, and look at Anthropic's [troubleshooting page](https://claude.com/docs/connectors/building/troubleshooting.md).

### Do I have to update the connector every time I restart?

Not with a stable URL. Connecting as `stable@proxy.tunnl.gg` gives the same hostname for the same SSH key, so the URL you registered in ChatGPT or Claude keeps working after you reconnect. Random URLs change on every connection.

### Can I test without a public URL at all?

Claude Code and the MCP Inspector run on your machine and can connect to `localhost` directly. ChatGPT and Claude on the web need a URL they can reach from the internet, or one of the official tunnels described above.

## Related

- [Use tunnl.gg from AI coding agents](/guides/ai-coding-agents)
- [Request inspector and replay](/request-inspector): see each MCP request and response
- [Stable URLs](/stable-urls)
- [tunnl.gg documentation](/docs)
