Tunneling with ngrok
Some MCP integrations cannot use localhost. ChatGPT Developer Mode runs in the browser and requires a remote HTTPS URL. OpenClaw and Claude Cowork may need to reach PiecesOS from another machine. ngrok creates a public HTTPS URL that forwards traffic to your local PiecesOS instance. The tunnel is active only while ngrok is running, and ngrok handles TLS certificates automatically.
Prerequisites
<pos-download-guide />
Installing ngrok
```bash
brew install ngrok
```
```bash
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \
| sudo tee /etc/apt/sources.list.d/ngrok.list \
&& sudo apt update \
&& sudo apt install ngrok
```
Verify the installation:
ngrok help
Setting Up the Tunnel
```bash
ngrok config add-authtoken YOUR_AUTH_TOKEN
```
Replace `YOUR_AUTH_TOKEN` with the token from your [ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken).
```bash
ngrok http 39300
```
Replace `39300` with your actual port if different. ngrok will display a forwarding URL like `https://abc123.ngrok-free.app`. Copy the **HTTPS** URL.
MCP Endpoint URLs
Append the correct path to your ngrok URL:
| Endpoint | Path | Use for |
|---|---|---|
| Streamable HTTP | /model_context_protocol/2025-03-26/mcp |
ChatGPT, Claude Cowork Connectors UI |
| SSE | /model_context_protocol/2024-11-05/sse |
MCP Bridge, OpenClaw remote |
Example: if ngrok shows https://abc123.ngrok-free.app, use https://abc123.ngrok-free.app/model_context_protocol/2025-03-26/mcp for ChatGPT or https://abc123.ngrok-free.app/model_context_protocol/2024-11-05/sse for MCP Bridge.
Configuring Your MCP Client
ChatGPT Developer Mode
- Open chatgpt.com → Settings → Connectors.
- Click
Createand add a new connector. - Set MCP Server URL to:
https://YOUR_NGROK_URL.ngrok-free.app/model_context_protocol/2025-03-26/mcp - Save. The tunnel must be running whenever you use ChatGPT with Pieces.
See ChatGPT Developer Mode integration for full setup.
Claude Cowork (Connectors UI)
- Open Claude Desktop → Settings → Connectors.
- Click
Add custom connector. - Enter:
https://YOUR_NGROK_URL.ngrok-free.app/model_context_protocol/2025-03-26/mcp - Save and restart Claude Desktop.
See Claude Cowork integration for full setup.
OpenClaw (Remote)
Install mcp-remote globally (npm install -g mcp-remote@0.1.38), then edit ~/.openclaw/workspace/config/mcporter.json:
{
"mcpServers": {
"pieces": {
"command": "mcp-remote",
"args": [
"https://YOUR_NGROK_URL.ngrok-free.app/model_context_protocol/2024-11-05/sse"
]
}
}
}
See OpenClaw integration for full setup.
Tips & Troubleshooting
The tunnel is active only while ngrok http 39300 is running. Start ngrok when you need remote access, or keep it running in a dedicated terminal for regular use.
Troubleshooting
Tunnel not connecting — Ensure PiecesOS is running and listening on the port. Test locally:
curl http://localhost:39300/.well-known/versionWrong port — Use the port from the PiecesOS Quick Menu or Settings → Model Context Protocol (MCP). It may not be 39300.
URL not accessible — Verify ngrok is running and the HTTPS URL loads in a browser. Free plans may show an ngrok interstitial page on first visit; that's normal.
Subdirectory paths — Use the exact paths:
/model_context_protocol/2025-03-26/mcpor/model_context_protocol/2024-11-05/sse. Paths like/functions/v1/mcpdo not work.Connection refused — Restart PiecesOS and ngrok. Ensure no firewall is blocking the port.
Security
ngrok exposes PiecesOS to the internet—use it only when required. Keep your ngrok auth token private. For private network access, consider Tailscale or a VPN instead of a public tunnel.
Next Steps
Configure your MCP client with the ngrok URL: ChatGPT Developer Mode, Claude Cowork, OpenClaw, or MCP Bridge.