MCP Gateway

The corporate MCP gateway on ToolHive: one authenticated, policy-governed entrance where AI clients reach internal tool servers, with corporate sign-in through OAuth 2.1, per-user authorization and per-endpoint tool filtering on every tool call, and audited invocations. The defects it surfaced were fixed upstream in the open, and that work led to my joining the ToolHive maintainers.

Details & related links

Overview

MCP Gateway is the corporate entrance to internal Model Context Protocol servers at Spotware. AI clients — ChatGPT-style connectors, IDE agent clients, coding agents — reach internal tools through one authenticated, policy-governed address rather than a scatter of per-server proxies. Every tool call that arrives through it is authorized before it executes and leaves an audit trail, and where the backend acts on the caller's behalf it executes as the named user with that user's own permissions. Connecting another system means adding one more connector behind the same address: no new sign-in for anyone, and no client setup.

It is built on ToolHive, Stacklok's open-source platform for running and managing MCP servers, deployed as Kubernetes operator resources under GitOps. Building on it also made the gateway a public project: the defects real clients surfaced went upstream, where the maintainers fixed several of my reports themselves and reviewed and merged my fixes, and in October 2026 they invited me to join them.

The Problem

The Model Context Protocol made it easy to put a tool server in front of an AI client. It did not make it safe. The first generation of internal MCP deployments ran behind per-server reverse proxies with a shared secret each: no per-user identity, no per-tool authorization, no audit trail — an AI client that could reach a server could do everything that server could do, as nobody in particular. That is an acceptable posture for a demo and an unacceptable one for tools that read and write real business systems.

The Solution

  • One entrance, two authentication boundaries. Client-to-gateway: OAuth 2.1 with PKCE through an embedded authorization server that federates the corporate identity providers — several different IdP types, each endpoint minting its own JWT with a deliberately minimal claim set. Gateway-to-backend: handled per endpoint, from network isolation with no forwarded credential to per-user credential forwarding where the backend needs to act as the caller.
  • Two governance layers before every tool call. Authorization is expressed in Amazon Cedar policies and evaluated per individual tool invocation — deny by default, forbid overrides permit — so "who may call which tool" is a reviewed, versioned artifact rather than tribal knowledge. On top of the policy, each endpoint carries its own tool filter, so a tool an endpoint does not expose never reaches a client at all.
  • Audited invocations, bound to the caller. Every call through the gateway is logged as the person who made it, and where the backend acts on the caller's behalf it executes with that caller's own upstream permissions — the difference between an AI integration you can adopt and one you must forbid.
  • GitOps delivery, reproducible credentials. The whole gateway is declarative Kubernetes custom resources: changes go through review and CI, manifests are diffed before apply, and every credential is reproducible from configuration rather than existing only in a live cluster. Authorization-server state survives pod restarts through a dedicated persistence layer, verified by killing pods and checking that sessions live.
  • From proof-of-concept gates to standing operations. Before rollout, five pass/fail gates were run and recorded: the OAuth handshake, authorization enforcement, in-cluster backend reachability, upstream isolation, and full per-user authorization end to end through a real AI client. Infrastructure earned its way into production; it did not drift there. Production keeps the same discipline: every workload behind the gateway runs inside a network-policy baseline and under alert rules for memory pressure, restarts, and failed jobs, and the known failure modes, such as an identity provider refusing a sign-in or a token refresh, each have a written runbook.

What Runs Behind It

The gateway fronts the internal MCP estate as it grows. The AIR API retrieval backbone reaches AI clients through it, together with a separately deployed edition of the same retrieval for an allowlisted set of outside accounts. The YouTrack MCP Server serves through it, and so does the PeopleForce MCP Server, with the broad tier live today and the sensitive tier staged to follow, because its data demands two different sensitivity postures. The Telegram MCP Server connects each employee's own Telegram account behind the same sign-in.

Beside the servers built in-house, the gateway fronts the vendors' own and open-source MCP servers for the platforms the company already runs: source control, the analytics database, the productivity suite, and the infrastructure's metrics and log stores. The Claude Code Gateway publishes its operational interface through it as well. One governed entrance, many tools: the point of a gateway is that the next MCP server inherits the security model instead of re-inventing it.

Working on ToolHive Upstream

Connecting real AI clients to ToolHive turned up defects, and they went upstream rather than into local patches: issues with a full reproduction and, wherever I could pin it, the responsible source line, then pull requests of my own once the maintainers invited contributions. The maintainers fixed several of those reports themselves and reviewed and merged my pull requests: the first one merged is credited in the v0.46.0 release notes as my first contribution to the project, and more followed across later releases, including a fix in the project's shared core library. I also reviewed a maintainer's fix against the failure I had reported before it merged, and the same work produced backport requests for the official MCP Python SDK.

In October 2026 the ToolHive maintainers invited me to join them (PR #6808), so the platform under the gateway is now one I help maintain as well as run; the role has its own page. The whole trail is public and stays current on its own: my issues and my pull requests in the project.

My Role

I designed and built the gateway from nothing: the endpoint topology, the identity federation, the Cedar policy model, the GitOps pipeline, and the persistence design, then debugged it live against real clients until every gate passed. Since then I have run it as the governance layer of a growing internal MCP estate, where every new server arrives behind the same sign-in, policy, tool filter, and audit trail. The upstream work is part of the same discipline — when the platform under you has a defect, the fix belongs upstream, where every other user of that platform benefits from it, with the evidence attached. For the broader role context, see AI Product Manager at Spotware.