Refactoring Our MCP Gateway: From Intercepting Server to Composable Infrastructure

December 15, 2025 by Donnie Adams


The Original Design: An Intercepting MCP Server

  • Authenticate and authorize the user
  • For non-remote servers: ensure the target MCP server was deployed (via Kubernetes or Docker)
  • Construct a client for the “real” MCP server
  • Invoke any configured webhook filters (on both request and response)
  • Record audit logs using request/response metadata
  • Forward the MCP request to the server

When the Gateway Became the Bottleneck

The Core Shift: Obot as a Reverse-Proxy Passthrough

  • Obot should not be an MCP server
  • Obot should not intercept or reinterpret MCP requests
  • Obot should ensure servers exist, then get out of the way

The Shim Container and Nanobot

  • Authenticating requests
  • Performing authorization checks
  • Calling webhook filters
  • Recording audit logs
  • Handling token exchange for OAuth-backed servers

Webhooks as MCP Servers

OAuth and Token Exchange

  • Standards compliance
    Token exchange is a well-defined OAuth extension. Using it builds trust and familiarity, especially for MCP authors already operating in OAuth ecosystems.
  • Flexibility
    Token exchange isn’t limited to OAuth access tokens. It gives us a standardized way to provide other credentials to MCP servers when needed without changing the gateway.

Deployment Details and Non-Breaking Migration

  • In Kubernetes, all containers (MCP server, shim, converter servers) run in a single pod and communicate over localhost.
  • In Docker-based setups, containers communicate via host.docker.internal or a local IP.

A Simpler Gateway, A Stronger Foundation

  • Easier to extend
  • More standards-aligned
  • More secure by default
  • Simpler at its core

Related Articles