Insights

Putting MCP Behind the API Gateway You Already Run

A

Admin

Content Team

December 2, 2026•
5 min read
Tagged envelopes passing through a gateway arch to a row of identical servers, above them panels showing a permission barrier, a duplicate stamp, and a sealed token with a clock

A business team has built an AI assistant that can look up a customer or raise a support ticket. It worked in the demo. Now they want it live, and the request lands with whoever runs the company's API gateway: put it behind the same logins, rate limits and logs as every other API.

If that is you, this is a short guide to doing it with MCP, the open protocol that assistants such as Claude use to call tools. Until July that was awkward. Since the 2026-07-28 revision of the spec, most of it works like any other API. Three checks still have to be built into the MCP server itself, and they are easy to miss because nothing breaks when you leave them out.

The July update removed sessions

Before the update, an MCP server kept a session for each connected client. Every request from that client had to reach the same server, or a shared store holding the session, which meant "sticky" routing that most gateways do not use for ordinary APIs.

Now each request is a self-contained POST that carries its own protocol version and client details, so any server can answer it. A plain load balancer or a serverless platform works, as it does for your other APIs.

The gateway can also see which tool is being called without reading the request body. Every request carries an Mcp-Method header, and tool calls add an Mcp-Name header with the tool's name. The spec added them so that "load balancers, gateways, observability tooling" can act on a request directly. In practice, you can rate-limit or block a tool that creates invoices while leaving a customer lookup open.

Kong's AI Gateway, for example, can restrict which spec revisions it accepts, and applies its per-tool rules only after its key-auth or openid-connect plugin has identified the caller. Whatever gateway you use, identify the caller first and apply per-tool rules after.

Check permissions inside the server

The first check is who may use which tool. A header is a copy of what is in the request body, and a client can get it wrong or fake it. The spec says the body wins, so a server must reject any request whose headers disagree with its body. Use the headers at the gateway for routing and logging, and decide inside the server whether this caller may use this tool. Christian Posta described the risk in Nordic APIs: "The mistake is extrapolating from routing to policy and trust."

Stop duplicate actions after a dropout

The second check is for tools that change something. Under the old protocol, a client whose connection dropped halfway through a call could resume where it left off. Now it sends the whole request again. If the first attempt had already reached the invoicing system, the customer gets two invoices.

Nothing errors when that happens, and tests still pass, which is why WorkOS calls this a silent regression. The spec does not protect you here. Give every tool that changes something an idempotency key, a unique ID for each action that lets the server recognise a repeat and skip it.

Sign every handle the server issues

The third check covers state. Without sessions, a server that needs to remember something between calls gives the client a handle, and the client sends it back with the next call. On the way, the handle passes through the client and often through the AI model's context, where it can be changed. Equixly's security analysis says to treat anything returned this way as input from an attacker. Sign each handle, tie it to the caller who received it, and give it an expiry, as you would a session token issued to a browser.

Old clients will stay until 2027

On the server side, the SDKs for TypeScript, Python, Go and C# support the revision, and Microsoft's C# SDK accepts old and new clients on the same server.

AI clients are moving more slowly. In Apify's write-up of its own migration, its stateless path went live on 30 July, and three weeks later about one in eight of its daily clients were using it. Apify also had to retire a tool that worked by changing session state. Anthropic said on release day that support is being rolled out across Claude products, without dates for each product.

The spec cannot drop the old features before 28 July 2027. Until then, run the old and new versions side by side, as Cloudflare recommends, and let old sessions drain. Before you migrate a server, look for tools like Apify's that depend on session state, because those need redesigning rather than updating.

Adopt it for new MCP servers

For new MCP servers, we would adopt the stateless design and run each one as an ordinary authenticated HTTP service. Logins go through the gateway or identity system you already run, and the three checks above live inside the server. Try per-tool gateway rules on one or two tools before applying them widely. Keep the old version running until your own logs show the old clients have gone, or until your main AI clients and your gateway vendor confirm support for the new one.

Working with Mandrill Tech

Most of this work is integration. An MCP server sits between an AI assistant, your login system, a gateway and the business systems its tools change. That is the kind of work Mandrill Tech's System Integration team does, connecting existing systems through APIs and middleware without moving the controls you already trust. If you are planning to let AI assistants use your internal tools, talk to us at mandrill.com.my about where the login and duplicate checks should sit.

Tags:MCPModel Context ProtocolAPI GatewayPlatform EngineeringAI IntegrationAPI SecurityIdempotency

Table of Contents

Related Articles

A fully charged battery on a row of office chairs beside a usage gauge with an adjustable limit marker, its line branching into four coloured cost-centre trays
Insights

Planning Your Budget for Hybrid AI Billing

5 min read
Documents flowing through a secured processing unit, configuration controls and a human reviewer into a single retained record
Insights

Malaysia's Proposed AI Governance Bill: Preparing the Systems Your Company Runs

5 min read
Enterprise AI ROI in 2026: Why Efficiency Gains Aren't Becoming Revenue Growth
Insights

Enterprise AI ROI in 2026: Why Efficiency Gains Aren't Becoming Revenue Growth

6 min read
Mandrill Tech Logo

Empowering business growth through innovative technology and data-driven solutions. We help companies transform and scale in the digital age.

Solutions

Data Solution

AI/ML Solution

Services

Quick Links

© 2026 Mandrill Tech Sdn. Bhd. (201501005176 | 1130506-W). All rights reserved.