Your coding agent can write code all day and still know nothing about your actual ngrok account. It cannot see which endpoints are live, which domain is reserved, or why traffic to a route started failing. The ngrok MCP server closes that gap. Once connected, the agent can inspect endpoints, agents, and Traffic Inspector traffic, search the current ngrok docs, and, with your approval, change account resources.
That last part deserves respect. ngrok is blunt in its own docs: access is not read only. The agent acts as you, with the permissions of your role, and changes to live configuration apply right away. So this tutorial connects the server, proves it works with a question that changes nothing, and only then talks about the prompts that change things.
This guide follows the official ngrok MCP server documentation and the setup page at ngrok.com/mcp, checked on November 24, 2026. It claims no test run of its own.
What You Will Build or Learn
You will connect one coding agent to the ngrok MCP server and confirm the connection with a safe first question. The steps cover Claude Code in full, then the exact commands or config for Codex, Cursor, and VS Code. Other clients that support remote HTTP servers and OAuth client ID metadata documents, such as Zed, Goose, and OpenCode, connect with the same server URL.
You will also learn what the agent can see and what it can change, and how to keep it read only if that is all you want. For background on agent tooling in this family, see our tutorial on batch tool calls with Claude Code Mode.
The approval prompt is part of the setup, not an annoyance to switch off. Illustration: Dirty Static
Before You Begin
Know which ngrok account you are about to hand to an agent. If you work in more than one account, sign in to the right one in your browser first. The consent screen is where you approve what the agent can do, so read it instead of clicking through it.
One distinction matters before you start. This server manages your ngrok account. It does not replace the ngrok CLI, which still creates the tunnels that put your services online. ngrok makes that point in its launch post, and it shapes what to expect below.
Step 1: Connect Claude Code
Action: add the server at user scope, then sign in. Do not pass a client ID or a callback port. Claude Code finds its client through server discovery.
claude mcp add --transport http --scope user ngrok https://mcp.ngrok.com/mcp
claude mcp login ngrok
Expected result: the second command opens your browser. Sign in to ngrok and approve the consent screen. You never paste a token into Claude Code.
Step 2: Or Connect Codex, Cursor, or VS Code
Action: use the route for your client instead. Pick one. You do not need all of them.
For Codex, which needs version 0.157.0 or later, run:
codex mcp add ngrok --url https://mcp.ngrok.com/mcp
codex mcp login ngrok
Expected result: the login command opens your browser for the same consent flow. The ngrok setup page notes that if the add command starts a login on its own, you can cancel it and run the login command instead.
For Cursor, create or edit ~/.cursor/mcp.json with this config, then connect the server in Cursor MCP settings and sign in:
{
"mcpServers": {
"ngrok": {
"url": "https://mcp.ngrok.com/mcp",
"auth": {
"CLIENT_ID": "iamcli_3KeK8d8sO4d9RArARx7RFzcTVtO"
}
}
}
}
The full official Cursor config also lists the scopes the client requests. Copy that block from the ngrok setup page rather than trimming scopes by guesswork, since a missing scope can make a tool call fail later.
For VS Code, create .vscode/mcp.json in your workspace:
{
"servers": {
"ngrok": {
"type": "http",
"url": "https://mcp.ngrok.com/mcp"
}
}
}
Expected result: VS Code offers to start the server from that file, and starting it opens the sign in flow.
For Gemini CLI, the official setup page places a similar block in ~/.gemini/settings.json, using the httpUrl field and an oauth block with its own client ID, after which you run /mcp auth ngrok inside Gemini CLI. Use the exact block from the setup page for that client.
Step 3: Handle a Client Without OAuth
Action: if your client cannot sign in with OAuth, use an access token instead, following the access token page linked from the docs. Store it the way you store other secrets, such as in an environment variable.
Expected result: the client connects without the browser flow. Two limits from the docs are worth knowing. API keys and authtokens do not work with the MCP server, so do not waste an afternoon trying them. And a token with only read scopes is also the clean way to keep an agent read only on purpose.
Step 4: Verify the Connection
Action: confirm that your client sees the ngrok tools. In Claude Code, run /mcp and select ngrok. In Codex, run:
codex mcp list
In Pi, run pi mcp list. In any client, you can also ask the agent what ngrok tools it has.
Expected result: the client lists the ngrok server as connected. If it does not, work through the Troubleshooting table before you change anything else.
Step 5: Ask a First Question That Changes Nothing
Action: ask the agent which ngrok account you are signed in to.
Which ngrok account am I signed in to?
Expected result: the agent replies with your user, your account, your role, and your plan. That answer proves the sign in, the scopes, and the tool connection in one move, and it changes nothing in the account.
From there, the read only questions are the useful daily ones. The agent can look up endpoints, ngrok agents, and Traffic Inspector traffic. It can report usage and limits, list team members and credentials without showing secret values, and search the ngrok documentation. ngrok suggests prompts such as asking for 500 errors by hour over the last day, or asking whether you are close to a request limit this month.
Step 6: Make a First Change With the Validator in the Loop
Action: when you are ready for a change, start with Traffic Policy, because the server can validate a policy before applying it. Ask for a small, plain change and read the tool call before you approve it. The example prompt on the ngrok setup page asks the agent to rate limit one route and confirm nothing broke.
Rate limit /api to 100 requests a minute, and make sure I didn't break anything.
Expected result: the agent writes the policy, checks it with the Traffic Policy validator, and asks for your approval before it applies anything. Changes apply to live traffic right away, so the approval step is the whole safety story. If the request looks wider than what you asked for, refuse it and narrow the prompt.
One connection, two directions: the agent can inspect the account and, with approval, change it. Illustration: Dirty Static
Verification
Check three things. Your client lists the ngrok server as connected, through /mcp, codex mcp list, or the client equivalent. The account question returns the user, account, role, and plan you expected, which confirms you signed in to the right account. And your approval prompts still appear for tools that change the account, which the docs say most clients show because the server marks change and delete tools as such.
If any one of those three fails, the connection is not done, whatever the setup command printed.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| Server is not found or sign in fails | The URL is missing its path | Use the exact URL https://mcp.ngrok.com/mcp. The bare origin does not work |
| The agent got new credentials but ngrok rejected them | Your account does not have access to the MCP server | Contact ngrok support, per the docs |
| Claude Code uses an old callback port | A stale server entry from an earlier setup | Run claude mcp remove ngrok --scope user, then add the server again |
| Pi reports that the authorization server does not support dynamic client registration | Pi needs the client registration mode set for this server | Set oauth.clientRegistration to cimd for the server in ~/.pi/agent/mcp.json, then run pi mcp login ngrok again |
| An access token is rejected | The token is invalid, expired, or revoked | Create a new token and update the Authorization header |
| A tool call is refused | The call did not declare the scopes it needs, or your role does not allow it | Check the tools and scopes page for that tool, and check what your role allows |
Next Steps
Add ngrok agent skills once the connection works. The setup page offers npx skills add ngrok/skills, which gives the agent instructions for sharing local apps, adding authentication, verifying webhooks, and troubleshooting ngrok errors. Those skills teach the agent your common jobs. The MCP server gives it the account access to do them.
Then keep the habit from Step 5. Ask read only questions freely. Read every change out loud before you approve it. An agent that can revoke credentials and rewrite live traffic rules is a genuinely useful coworker, right up until the moment you stop reading its tool calls.
Sources
- ngrok, MCP Server documentation, ngrok.com/docs/mcp-server, updated November 23, 2026, checked November 24, 2026. The source for the server URL, the OAuth flow, what the agent can look up and change, the safety guidance, and the troubleshooting entries.
- ngrok, Connect your coding agent, ngrok.com/mcp, checked November 24, 2026. The source for the exact Claude Code, Codex, Cursor, Gemini CLI, and VS Code commands and config blocks, the Codex version requirement, the agent skills command, and the example prompts.
- ngrok, Coding agent, meet ngrok: the ngrok MCP server is live, ngrok.com/blog/mcp, checked November 24, 2026. The source for the November 16, 2026 launch date, availability on every plan including free, and the note that the MCP server does not replace the ngrok CLI.
- ngrok, MCP Server Tools and Scopes, ngrok.com/docs/mcp-server/tools, checked November 24, 2026. The source for tool types and the scope each tool needs.
- Image credit: all images in this article are Dirty Static illustrations.
END OF TRANSMISSION
Stay curious. Question everything.

