An MCP gateway is a single control point that sits between AI agents and MCP servers and handles routing, credentials, policy and logging for all of them. The agent gets one endpoint to talk to instead of a separate URL, key and error format for every backend it might reach.

Your own setup probably looks like the second half of that sentence. A web search tool went into Claude Code in an afternoon, a database query tool the following week, then a lead-data API for the sales team. Each one added a key to a config file, a block of settings, and a new way for a run to fail without warning. Now a colleague wants the same three tools in Cursor and a nightly CLI job needs them too, so you have three copies of everything and no single place to see what ran.

The question what is an MCP gateway gets answered badly in a lot of places, usually with a box diagram and no request path. What follows is the patient version: where the gateway sits in the protocol, how a call moves through it, how it charges and records what happened, and the honest limits of putting one component in charge.

Table of Contents

What an MCP Gateway Does in Plain Terms

Say an agent running in a desktop AI app has one job to finish: find recent funding news on five companies, check whether each is already in your CRM, and pull a verified contact at each one. That is three systems behind one task, each with its own URL, key and response shape.

A gateway works like a hotel concierge. You state what you need once at the front desk, and the concierge knows which department handles laundry, which handles the restaurant booking, and who signs off on the bill at the end. The agent gets one desk to walk up to instead of a floor plan to memorize.

Here is that idea as a picture, with the agent at the top and every backend behind one hub.

A diagram explaining how an MCP Gateway acts as a central hub for AI agents accessing multiple services.

Concretely, a gateway presents one managed connection to the agent while brokering access to many MCP servers, APIs, databases or enterprise systems behind it. Anthropic introduced the Model Context Protocol as an open standard for connecting AI applications with external data and tools, and the MCP architecture specification sets out the roles a gateway slots into.

The three roles you need to know

  • Host: the AI application itself, such as a desktop agent, which runs the model and manages permissions, consent and session lifecycle.
  • Clients: the connectors living inside that host, which format requests and keep the connection to a server.
  • Servers: the processes that expose data or capabilities for one system.

A gateway sits between those roles by playing two of them at once. To the host it looks like a server, one endpoint offering one set of tools. To each server behind it, it looks like a client, one more connector issuing properly formatted requests. That double identity is what lets it intercept every call in both directions.

What a server actually exposes

Servers publish three kinds of primitive. Tools are executable functions, such as an API call or a database query. Resources supply contextual data the application reads. Prompts are reusable interaction templates. The specification also splits control three ways: tools are model-controlled, resources are application-controlled, and prompts are user-controlled. That split matters later, because a gateway governs tools, resources and prompts on different terms rather than treating them as one generic API surface.

A gateway does not replace any of those servers. It sits in front of them, and it earns its place once more than one server, or more than one team, is involved. The price of that single desk is trust concentrated in a single component: every credential, policy decision and log line passes through it, and it only governs the traffic it can see.

MCP Gateway, MCP Server and Direct API Compared

Four terms get used as if they were interchangeable, and they aren't. Follow one request from the model down to the code that runs the query, and each layer's job becomes obvious.

Layer What it handles Who controls it Example
MCP host Runs the model and asks for tools End user or app team A desktop AI app or chat agent
MCP client Connector inside the host, one per server Host application Connector entry in the agent's settings
MCP server Exposes tools, resources and prompts for one system Server owner A database query tool
MCP gateway One endpoint that routes to many servers and applies policy Platform or ops team One URL fronting several servers with shared logging
Direct API call Custom code and a separate key per vendor Developer A separate SDK and key for each data provider

Read those rows top to bottom and you've traced a single call: the model asks, the host decides, a client formats the request, the gateway steers it, a server executes it.

The scale at the top of that table is why the bottom row hurts. A 2025 measurement study of the MCP ecosystem on arXiv collected 8,401 distinct MCP ecosystem entries, made up of 8,060 MCP servers and 341 clients. No agent connects directly to all of it. It connects to whichever small slice someone has wired up for it, and the wiring is the work.

If the server row is still the fuzzy one, MCP servers explained for non-developers covers what a server exposes and how it gets installed before you put anything in front of it.

Practical rule: one server owned by one team rarely justifies a gateway. Two or more servers, a second team, or a shared credential set do.

The trade is not free. A gateway adds a hop, so it adds latency and one more component on your dashboard at 3 a.m. Teams usually outgrow direct calls in a recognizable order: the same key pasted into three repos, log lines that look different for every provider, and an agent that breaks the morning a vendor renames an endpoint.

Connectors and Credential Models That Gateways Use

Once your MCP servers live anywhere other than localhost, the gateway stops being a router and becomes an authentication boundary. One authenticated front door, many credentialed backends.

A diagram illustrating an MCP Gateway acting as a secure intermediary between an AI application and various tool servers.

The transport you'll meet for remote deployments is Streamable HTTP, which posts over HTTP with optional Server-Sent Events for streaming. The MCP architecture documentation names the authentication methods in play, including bearer tokens, API keys and custom headers, with OAuth recommended for obtaining tokens. In the authorization model, the MCP server is an OAuth 2.1 resource server and the client acts on behalf of a resource owner, with Protected Resource Metadata published over HTTPS.

That translates into four checks a gateway should make before it dispatches anything:

  • Audience and scope: confirm the token was minted for this server, not a sibling service.
  • Argument hygiene: stop credentials leaking into downstream tool arguments where a model can echo them.
  • Binding: tie each authorization decision to the selected server and the specific operation.
  • Tenancy: issue separate credentials or delegated tokens per customer wherever the provider allows it.

Two credential models and what each does to your bill

With managed credentials, the gateway operator holds the provider keys and bills you per call, which shortens setup to a top-up. With bring your own key, the customer's own provider key is used and the provider bills the customer directly. Our catalog supports the second model: you attach your own provider credentials through the Bring your own key option, and those calls run at the provider's own cost with no markup from us.

The confused deputy problem

A user-triggered tool that executes with a shared service account, with no explicit authorization check for that particular user, turns the gateway into an escalation path. The risk isn't theoretical. In a security analysis of the MCP server ecosystem, a scan of more than 500 MCP servers found that 38% lacked authentication on critical endpoints and 43% were vulnerable to command execution. Gateways are being deployed against that baseline, not a clean one.

Here's a short walkthrough of the request path and the auth hop for anyone who prefers video to prose.

The design stance that follows from all this is to fail closed. If the audience, the scope or the Protected Resource Metadata can't be validated, refuse the call rather than forward it hopefully. Centralizing auth buys you consistent revocation, rate limits and consent enforcement across many tools, and it also creates a high-value chokepoint, so keep retained secrets to a minimum, encrypt logs and prefer short-lived tokens.

How One Agent Request Moves Through a Gateway

One request, followed end to end, teaches more than any architecture slide. Take a single call: find recent funding news for a company name the user just typed.

A four-step diagram illustrating how an agent request securely moves through an MCP gateway system architecture.

  1. The model picks a tool. It emits a call with arguments, based on the tool description it was given.
  2. The host sends one request. Not to a provider, but to the gateway's single endpoint.
  3. The gateway checks identity. Who is calling, whether this tool is permitted for them, whether the budget allows it.
  4. It routes and normalizes. It chooses the backend server, maps the schema onto that backend, and forwards the call.
  5. The server runs the function. It returns a result or a JSON-RPC error, in the protocol's own error semantics.
  6. The gateway translates and records. It maps any error into something the model can act on, logs the backend and outcome, and returns the result.

A gateway can aggregate tool catalogs, normalize schemas, enforce allowlists and apply tenant or budget policy, all without the model-facing application implementing every integration itself, as the MCP architecture reference describes.

Correctness now matters more than ever. A stale tool description or a mistranslated error can send the model to the wrong backend with total confidence.

That's why production gateways version tool schemas, preserve JSON-RPC error semantics and isolate servers along least-privilege lines. Our own routing makes the distinction concrete: the agent tries the cheapest provider first and moves to the next on a provider error or timeout, but a bad input is never retried somewhere else, because a malformed request will fail identically everywhere and just burn budget.

What a healthy trace looks like

Open the logs for that funding call and you should see one request ID, the backend chosen, the latency, and the outcome. If the same request ID appears twice with different backends, something retried that shouldn't have. If a call has no backend recorded, the gateway made a decision it didn't write down, and you'll be guessing next time it fails.

Quotes, Charges and Audit Trails Explained

A single agent task is rarely one call. Enriching a contact list can fire dozens, and each one may hit a provider with its own price. Billing on a gateway follows four stages, and the useful question at every one is who is holding the money.

Stage What happens Who carries the cost
Quote Price is shown before the run starts Nobody yet
Hold Funds for the quoted amount are reserved Customer balance, held
Settle Final charge equals the quote if the provider responds Customer
Release or refund Held funds return when a call fails Nobody

Auditability is the second half of that. A run record should hold the input, the price, the provider and the outcome, and each record should link to the one before it, forming an append-linked sequence you can verify and replay when a customer disputes a line item.

Take a lead-enrichment run that quotes a price per record. It holds the total, settles only for the records that returned data, and releases the rest. Nothing is charged for the empty results, and the ledger shows which provider produced each row.

A quote you can't check against a settled charge is a marketing number, not a price.

Run three checks on any gateway's billing before you trust it with a production job. Does the quote equal the settled charge when the provider responds? Do failed calls cost nothing? Does the ledger name the provider used for each call, so you can tell a cheap route from an expensive one? Ours answers these on paper: the guarantees page explains how holds, charges and refunds work, and the security page explains how provider keys are stored.

A Worked Example of Lead Research Through a Gateway

A sales team wants 200 target companies, one verified work email per contact, and a short summary of each company. Without a gateway, the agent carries a separate key and call pattern for a company database, an email finder, a verification service and a web-search API, and someone has to keep all four working.

With a gateway, the desktop agent and a CLI connector share one MCP endpoint and ask for a job, "find work emails," rather than for a specific vendor. The gateway draws only on providers already enabled for that tenant, so a new analyst can't accidentally route spend to a backend nobody approved.

The job then runs in four movements:

  1. Build the list. Search companies by industry and headcount, keep 200 names, drop the duplicates.
  2. Find a contact. Ask for a work email per company, and accept that some will come back empty.
  3. Verify before use. Check each address and discard hard failures, since a bounced sequence costs more than a missing lead.
  4. Summarize. Pull a short company description from the returned context so the rep has something to say on the call.

Billing follows the sequence from the quote stage onward: a per-record price, a hold for the total, settlement only on records that returned data, and a release for the empties.

What the team keeps at the end is the useful artifact. For every one of those leads there's a request ID, the provider that answered, the quoted price and the settled charge. When the sales director asks why last month cost what it did, nobody has to reconstruct it from four vendor dashboards.

Decide Whether a Gateway Fits and Where It Stops

A gateway can standardize the tool calls it handles, but it cannot secure every action an agent takes. Each call may arrive without the user identity, session history, agent goal, or prior actions needed to distinguish an approved workflow from a prompt-injection-driven detour or data exfiltration. As Palo Alto Networks explains in its analysis of MCP enterprise adoption, call-level visibility does not provide the full context needed for agent-level security.

Where a gateway stops: it governs the calls it can see. Visibility into MCP traffic is not the same as control over what an agent does.

Centralizing credentials, policies, routes, logs, and administrative rights also concentrates risk. If the gateway sits inline, an outage or an overly restrictive rate limit can interrupt every agent that depends on it. Treat it as governance infrastructure with a defined blast radius, not just a convenience.

Five questions before you add one

  • More than one server or team? Shared routing and logging can help coordinate them. A single server may not justify another layer.
  • Shared credentials to manage? A gateway can provide one place to rotate, revoke, and scope credentials.
  • One audit trail needed? Centralized records make it easier to review calls in one place.
  • Billing transparency? If you cannot see what a run cost by provider, a gateway with per-call records may help close that gap.
  • Room for one more component? Plan for an extra network hop, a health check, and an on-call owner before deployment.

Map the paths that bypass it, too. Shell commands, native SDK calls, and direct database connections remain outside the gateway unless you deliberately route them through it. An organization can have clear records of MCP traffic while consequential agent actions happen through other channels.

Adoption is still developing, so a small, limited deployment can be a sensible starting point. A gateway is more likely to fit when several teams or servers need shared controls, or when maintaining separate provider credentials and records has become difficult. To see looot's model in practice, connect its MCP server to an MCP-compatible agent, start with a small top-up, and compare a run's quote with its ledger entry.

looot provides access to 3,000+ operations from providers such as Hunter, Exa, Diffbot, Bright Data, and People Data Labs through one MCP endpoint. Operations are quoted before they run, and the ledger records charges for auditing or replay. Start a workspace, add a small top-up, and connect looot to the agent you already use.