Skip to main content
The ngrok MCP server includes read-only tools for the AI Gateway. Your AI agent can use them to compare models, break down what your inference cost, and debug a failed request without leaving your editor. These tools only read data. They can’t change your AI Gateway configuration, access keys, or settings.

Before you start

1

Connect the ngrok MCP server

Add https://mcp.ngrok.com/mcp to your AI agent and sign in. See the quickstart for your client. If you connect with a personal access token, give it the scopes for the tools you want to use.
2

Send requests through the AI Gateway

The usage tools answer from your gateway traffic, so send some requests first. See the AI Gateway quickstart.
3

Turn on request capture

To read request details and captured bodies, turn on request capture in Settings > Data Retention in app.ngrok.ai. Capture applies only to requests made after you turn it on. Model and usage tools work without it.
To confirm the tools are available, ask your AI agent “Which AI Gateway tools do you have?” It lists the aigw_ tools in the table below.

What you can ask

Your AI agent picks the tools, so the exact steps can differ.
The AI agent calls aigw_list_models to find models that accept images, then aigw_get_model for the one you pick. You get each provider that offers the model, with its token prices, limits, and performance metrics.
The AI agent calls aigw_usage_overview grouped by provider. You get daily cost in USD, request counts, errors, and error rates for each provider. Ask for a breakdown by access key to see which app or teammate spent the most.
The AI agent calls aigw_list_usage and filters for failures. You get each request’s ID, outcome, status code, tokens, and cost, newest first.
The AI agent calls aigw_get_request for the model, status, attempt count, and access key, then aigw_get_request_attempts for each attempt. You get each attempt’s provider, model, outcome, retry action, timing, tokens, and cost, and an explanation of why the gateway moved on to the next attempt. See Why a request failed over for how the gateway decides.
The AI agent calls aigw_get_capture one page at a time until it has read the whole body. This works only for requests made while request capture was on.

Tools and scopes

When you sign in with OAuth, the AI agent can use every tool your role allows. When you connect with a personal access token, each tool needs the scopes listed here.

Limits

  • Capture required for request details: aigw_get_request, aigw_get_request_attempts, and aigw_get_capture need request capture to be on when the request was made.
  • Retention: captured headers and bodies are kept for 30 days, and request metadata for 90 days. See Observability limits.
  • Redaction: credential headers, such as Authorization and x-api-key, are redacted in captures. Prompts and completions are stored as sent, so anyone who can read captures can read them.