> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server Tunneling

> Expose a local MCP server through a public /mcp URL for testing in ChatGPT, Claude, and other remote MCP clients.

Use a tunnel when ChatGPT, Claude, or another remote MCP client needs to reach a server running on your machine. The tunnel gives you a public HTTPS URL that forwards to your local MCP endpoint.

With `mcp-use`, start the server with `--tunnel`, then copy the printed `Tunnel` URL. The URL you give to clients must include `/mcp`.

```text theme={null}
https://<subdomain>.local.mcp-use.run/mcp
```

Keep the terminal process running while you test. The public URL stops working when the process exits.

## Start a tunnel with mcp-use

Use `mcp-use dev --tunnel` while you are developing:

```bash theme={null}
mcp-use dev --tunnel
```

Use `mcp-use start --tunnel` when you want to test the built server:

```bash theme={null}
mcp-use build
mcp-use start --port 3000 --tunnel
```

Successful output includes a tunnel endpoint:

```text theme={null}
Starting tunnel for port 3000...
✓ Tunnel established: https://happy-blue.local.mcp-use.run/mcp

Local:    http://localhost:3000
MCP:      http://localhost:3000/mcp
Tunnel:   https://happy-blue.local.mcp-use.run/mcp
Inspector: http://localhost:3000/inspector?autoConnect=...
```

Copy the value after `Tunnel:` into your remote MCP client. Do not copy only `https://happy-blue.local.mcp-use.run`; the client URL must end with `/mcp`.

## Tunnel any server on /mcp

Use the standalone tunnel package when your local MCP server is not started by `mcp-use`. The server must already be running locally and serving MCP over HTTP at `/mcp`.

For a server on port `3000`, run:

```bash theme={null}
npx @mcp-use/tunnel 3000
```

Successful output prints a public URL:

```text theme={null}
╭────────────────────────────────────╮
│  Tunnel Created Successfully!      │
╰────────────────────────────────────╯

Public URL:
  https://happy-blue.local.mcp-use.run/mcp

Local Port: 3000
```

Copy the full public URL, including `/mcp`, into ChatGPT, Claude, or your other remote MCP client.

## Verify the tunnel

Verify the public URL with the `mcp-use client` CLI:

```bash theme={null}
npx mcp-use client connect tunnel-test https://happy-blue.local.mcp-use.run/mcp
npx mcp-use client tunnel-test tools list
```

The `connect` command performs the MCP handshake and saves the tunnel under the name `tunnel-test`. The `tools list` command should print the tools exposed by your local server. If the server uses OAuth or bearer authentication, complete the client authentication flow or pass the required auth option before testing tools.

## Stop the tunnel

Press `Ctrl+C` in the terminal running the tunnel.

When you started the tunnel with `mcp-use dev --tunnel` or `mcp-use start --tunnel`, stopping the command stops both the local server process and the tunnel. When you started the tunnel with `npx @mcp-use/tunnel 3000`, stopping that command closes only the tunnel; your local server keeps running until you stop it separately.

## Lifetime and limits

Tunnels are for local testing before deployment:

* The tunnel is active only while the command is running.
* Tunnels expire after 24 hours.
* Inactive tunnels are cleaned up after 1 hour without activity.
* Each IP address can create up to 10 tunnels per hour.
* Each IP address can have up to 5 active tunnels at a time.

For a stable public URL, deploy the server instead of relying on a local tunnel.

## Next steps

* Use the [TypeScript quickstart](/typescript/getting-started/quickstart) to create a local MCP server.
* Use [Build your first MCP App](/typescript/mcp-apps/quickstart) to test widgets in a remote client.
* Use [Deploy to Manufact Cloud](/typescript/server/deployment/mcp-use) when you are ready for a hosted MCP endpoint.
