Skip to main content

Using ngrok With Claude AI's MCP

Claude.ai supports Custom MCP (Messages Control Protocol) Integrations — allowing it to interact with your own tools and APIs via structured function calls.

That means you can bring any custom MCP server into Claude.ai or Claude Desktop — as long as it's reachable via a public endpoint.

Some of the smartest folks on the internet are already using ngrok to do this in seconds.

Set up your local server with ngrok for MCP

Follow these steps to quickly test your local MCP server with Claude's MCP integrations:

1. Install ngrok

Download and install the ngrok CLI.

For macOS:

Loading…

2. Connect ngrok to your account

Sign up for an account at ngrok.com and run:

Loading…

3. Start your local MCP server

Make sure your MCP server is running on a specific port:

Loading…
note

See the Claude MCP documentation for more information on how to set up your local server.

4. Expose your server with ngrok

Start a tunnel to your app's port:

Loading…

Copy the HTTPS forwarding URL (e.g., https://abc123.ngrok.io) which we will use in the next step.

Get a static URL

Want a URL that doesn't change every time you restart the agent? Claim a free static ngrok URL.

Once you have claimed your free static domain, add the --url https://<your_static_domain_here> flag when running the agent.

5. Register your ngrok URL

Custom integrations using Remote MCP are now available on Claude.ai and the Claude Desktop app for users on Claude Max, Team, and Enterprise plans. This feature is currently in beta.

  1. Go to Settings → Profile
  2. Scroll to the Integrations section
  3. Click Add more
  4. Paste the MCP server URL from your earlier step
  5. Click Add to finish setting up the integration

6. Test your integration

Send a message that requires MCP usage through Claude, you should now see requests live through ngrok to your locally running MCP server.

You'll see requests hitting your local server via ngrok.

Restrict access to only Claude

Let's limit access to your MCP server only to Claude by only allowing the Anthropic IPs.

1. Create a Traffic Policy

Locally, save this file as policy.yml:

Loading…

2. Restart the agent

Then, restart your ngrok agent, but this time use:

Loading…

Done!

Your MCP server is now locked down to only accept requests from Anthropic's IP range.

While this significantly reduces risk, remember: anyone with the URL can still add it to their account, so be mindful of where and how you share it.