/ngrok:expose-localhostfrom ngrok
Exposes a local service to the public internet using ngrok. Handles HTTP services and raw TCP (SSH, RDP, databases) with optional OAuth or WAF via Traffic Policy.
Ships in ngrok. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Expose a local service to the public internet using ngrok. Optionally add OAuth, OWASP protection, or rate limiting via Traffic Policy.
ngrok command available)ngrok config add-authtoken <TOKEN>)Silently verify ngrok is ready:
ngrok config check
If auth token missing, tell user to run: ngrok config add-authtoken <TOKEN> (get token at https://dashboard.ngrok.com/get-started/your-authtoken)
Then ask all questions upfront before doing anything:
Before I expose your service, I need a few details:
1. **Port**: I see your app runs on port 3000. Is that correct?
2. **Domain**: Use your dev domain, or do you have a custom domain?
3. **Access control**: Open access, or require login (Google/GitHub/etc.)?
4. **Save config?**: One-time setup, or save for reuse?
Do NOT mention cloud endpoints, reserved domains, or internal endpoints — those are advanced concepts the user shouldn't need to think about.
Detecting the port: Check package.json scripts for --port, .env for PORT=, docker-compose.yml for port mappings.
Is it even HTTP? If the user says SSH, RDP, a database, or names a port like 22, 3389, 5432, or 3306, this is a raw TCP service — skip to Non-HTTP Services (TCP). The domain and access-control questions above do not apply there.
Domains: Most ngrok accounts have a free static dev domain (e.g., something.ngrok-free.dev). Running ngrok http PORT uses it automatically. Users can also provide a custom domain configured in the ngrok dashboard. Some accounts (especially new ones) may not have a dev domain yet — if ngrok fails with ERR_NGROK_15013, tell the user: "You don't have a dev domain yet. Claim your free one at https://dashboard.ngrok.com/domains — then we can try again."
If user requests OAuth, also ask: "Should only specific people be able to access it? I can restrict by email address or email domain."
After gathering answers, confirm and get a Y/n before proceeding.
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok http {PORT} &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1
With a specific domain, add --url https://{DOMAIN}.
Create the traffic policy file first, then start ngrok with it.
OAuth-only (default when user requests auth):
on_http_request:
- actions:
- type: oauth
config:
provider: google
Replace google with the chosen provider (google, github, microsoft, gitlab, linkedin, twitch).
If the user requests OAuth, default to OAuth-only. Do NOT add OWASP or rate limiting unless explicitly asked — OAuth already blocks unauthenticated access.
OAuth with email restriction — use a separate rule with a CEL expression to deny non-matching emails. Do NOT add an allow field to the OAuth action.
Single email:
on_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "actions.ngrok.oauth.identity.email != '[email protected]'"
actions:
- type: deny
config:
status_code: 403
Email domain:
on_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "!actions.ngrok.oauth.identity.email.endsWith('@your-company.com')"
actions:
- type: deny
config:
status_code: 403
Multiple emails — name the identity explicitly on the left of in:
- expressions:
- "!(actions.ngrok.oauth.identity.email in ['[email protected]', '[email protected]'])"
actions:
- type: deny
config:
status_code: 403
Shared secret (when the person won't log in with an IdP — an external client, a reviewer without a company account):
on_http_request:
- actions:
- type: basic-auth
config:
credentials:
- "reviewer:{PASSWORD}"
Hand them the URL and the password over a channel you already trust. If they have a
stable IP, restrict-ips is an alternative with nothing to share.
Open-access hardening (no auth, but wants protection):
on_http_request:
- actions:
- type: rate-limit
config:
name: default-rate-limit
algorithm: sliding_window
capacity: 200
rate: "60s"
bucket_key:
- conn.client_ip
- type: owasp-crs-request
config:
on_error: halt
on_http_response:
- actions:
- type: owasp-crs-response
config:
on_error: halt
After writing the policy file, start ngrok:
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok http {PORT} --traffic-policy-file .ngrok/traffic-policy.yml &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1
Add --url https://{DOMAIN} if using a specific domain.
Sharing a dev server? Vite, Next, and webpack reject requests whose Host header
isn't localhost, and their hot-reload websockets need the ngrok domain allowed. Set
this up before handing over the URL — see references/TROUBLESHOOTING.md.
If a traffic policy action fails due to plan limitations:
Save these files to the project:
.ngrok/traffic-policy.yml — the policy (if security was configured).ngrok/expose.sh:#!/bin/bash
set -e
echo "Your service will be at: https://{DOMAIN}"
ngrok http {PORT} --url https://{DOMAIN} --traffic-policy-file .ngrok/traffic-policy.yml
Omit --traffic-policy-file if no policy. Omit --url if no specific domain.
Optionally add to package.json:
{ "scripts": { "tunnel": "bash .ngrok/expose.sh" } }
pkill ngrok
For SSH, RDP, or a database, use ngrok tcp instead of ngrok http.
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok tcp {PORT} &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1
ngrok returns an address like tcp://1.tcp.ngrok.io:12345. The host and port are
used separately by the client:
# local sshd on port 22, reached through the address above
ssh -p 12345 {USER}@1.tcp.ngrok.io
Common ports: SSH 22, RDP 3389, PostgreSQL 5432, MySQL 3306.
The address changes on every restart. For one that persists, reserve it first. ngrok assigns the hostname and port — unlike domains, you cannot choose them:
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok api reserved-addrs create --description "SSH for {NAME}" --region us
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok tcp {PORT} --url tcp://{ADDR}
Reserved TCP addresses need a paid plan and keep billing until deleted.
Access control is different here. OAuth and OWASP are HTTP-only and will not
work. TCP policies run in the on_tcp_connect phase, where restrict-ips is the
usual control:
on_tcp_connect:
- actions:
- type: restrict-ips
config:
enforce: true
allow:
- 203.0.113.0/24
Attach it the same way: NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok tcp {PORT} --traffic-policy-file .ngrok/traffic-policy.yml
Only use if the user explicitly needs a URL that persists after the agent stops (e.g., webhooks, long-lived integrations).
Requires the ngrok MCP server or an API key. If the user manages ngrok as code, add the endpoint there instead. If not, and the MCP server is connected, use it and do not ask for an API key: gw_reserve_domain and gw_create_cloud_endpoint replace steps 1 and 2, and delete_resource replaces step 4. Otherwise the user sets an API key with ngrok config add-api-key <KEY> (from https://dashboard.ngrok.com/api-keys). See ngrok-surfaces for the order to pick in.
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok api reserved-domains create --domain "{DOMAIN}"forward-internal as the last action:NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok api endpoints create --url "https://{DOMAIN}" --bindings public --traffic-policy "$(cat .ngrok/traffic-policy.yml)"
The traffic policy must end with:
- type: forward-internal
config:
url: https://{NAME}.internal
NGROK_CLIENT_SOURCE=skills/expose-localhost ngrok http {PORT} --url https://{NAME}.internalNGROK_CLIENT_SOURCE=skills/expose-localhost ngrok api endpoints delete {ENDPOINT_ID}Prefix each ngrok command you run with NGROK_CLIENT_SOURCE=skills/expose-localhost, as the examples do. Leave it out of files you write for the user. See "Attribution" in ngrok-surfaces.
This skill covers giving a service a public URL. Neighbouring jobs have their own skills — hand off rather than reimplementing them here:
secure-endpoint. (Sharing a preview with one named person is handled here, in
Step 2.)receive-webhooks verifies provider signatures
at the edge and can keep the receiver off the public internet.run-mcp-gateway handles per-provider credentials.provision-sandbox-access.ERR_NGROK_*, a 400 through the URL but not on
localhost) — troubleshoot-ngrok.ngrok-setup.For the underlying model — endpoint types, HTTP vs TCP, and the full Traffic Policy
action set — see ngrok-engine. For applying config on a surface other than the
CLI (SDKs, REST API, Terraform, Kubernetes), see ngrok-surfaces.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ngrok/skills --plugin ngrok9 skills in this plugin
/ngrok-engineReference for ngrok's traffic model - what an endpoint is and what happens to traffic at the edge. Covers endpoint types (agent, cloud, internal), bindings and protocols (HTTP, TLS, TCP), and Traffic Policy - the YAML rule language of phases, CEL expressions, and actions, with a generated catalog of all 26 actions. Other ngrok skills point here to decide what to build, then to ngrok-surfaces to apply it. Not a standalone task - load when another skill references it./ngrok-setupGet authenticated and ready to use ngrok on whatever surface the task needs - agent CLI, an SDK, or infrastructure-as-code. Detects what is already installed, walks the one-time authtoken step, and routes to the right surface. Use before other ngrok tasks, or whenever an ngrok command fails with an authentication or configuration error. Use when the user says "set up ngrok", "install ngrok", "add my authtoken", "ngrok isn't authenticated", "getting an auth error from ngrok", or "connect the ngrok MCP server"./ngrok-surfacesHow to apply an ngrok endpoint and Traffic Policy on whichever surface the user is actually working in - the agent CLI and ngrok.yml, the ngrok SDKs (Go, JavaScript, Python, Rust), the REST API at api.ngrok.com, the Terraform provider, and the Kubernetes Operator. Routes from signals in the user's project to the right surface, then to that surface's reference file. Other ngrok skills point here once they know what to build. Not a standalone task - load when another skill references it./provision-sandbox-accessGive every sandbox, container, device, or tenant its own isolated ngrok endpoint, provisioned programmatically at runtime from a controlplane. Covers the per-workload resource set - service user, reserved address or domain, ACL-scoped authtoken, cloud endpoint forwarding to a private internal endpoint - plus the agent config that runs inside the workload, and teardown. Use when the user is building a platform that spins up isolated environments./receive-webhooksReceive and verify inbound webhooks from providers like Stripe, GitHub, Twilio, Slack, or Shopify and deliver them to a local or private service without exposing that service to the public internet. Verify signatures at the edge with no app code; route third-party callbacks to a service behind a firewall, including regulated (HIPAA/PCI) environments or a centralized webhook gateway shared across teams. Use when the user needs to receive, test, or debug webhooks locally, wants signature verification without writing it, or must route callbacks to a private service./run-mcp-gatewayExpose an in-development MCP (Model Context Protocol) server for remote testing against AI model providers like Claude and OpenAI, with per-provider authentication and traffic inspection. Puts a cloud endpoint in front of your local MCP server, authenticates each provider with its own bearer token via Vaults, and forwards to your server kept off the public internet. Use when the user is building or testing an MCP server and needs a remote AI client to reach it. Use when the user says "test my MCP server", "expose my MCP server to Claude", "connect my MCP server to OpenAI", or "front door for my MCP server". Not for connecting ngrok's own MCP server - use ngrok-setup.Other plugins' skills for the same job