Architecture

MCP Gateway consists of two main components: the Operator and the Gateway.

Overview

flowchart LR
    Client([Client])

    subgraph Kubernetes Cluster
        Ingress[Ingress]
        Gateway[MCP Gateway]

        subgraph Backends
            Remote[External MCP Server]
            Container[Container Server<br/>HTTP/STDIO]
        end
    end

    Client --> Ingress
    Ingress --> Gateway
    Gateway --> Remote
    Gateway --> Container

Operator

The operator watches for Custom Resources and manages:

  • MCPGateway: Creates gateway Deployments, Services, and Ingress resources
  • MCPRemoteServer: Configures routing to external MCP servers
  • MCPContainerServer: Creates and manages containerized MCP server pods

The operator runs as a single deployment and reconciles resources continuously.

Gateway

The gateway is an HTTP/SSE proxy that:

  • Routes incoming requests to the appropriate backend
  • Handles SSE (Server-Sent Events) connections for real-time communication
  • Supports STDIO transport by attaching to container pods
  • Watches ConfigMaps for dynamic configuration updates

Request Flow

  1. Client connects to the gateway via Ingress
  2. Gateway reads the path to determine the target server
  3. For remote servers: proxies the request to the external URL
  4. For container servers:
    • HTTP transport: proxies to the container’s HTTP endpoint
    • STDIO transport: attaches to the pod and forwards via stdin/stdout

Custom Resources

ResourcePurpose
MCPGatewayDefines the gateway deployment and ingress configuration
MCPRemoteServerConfigures routing to external HTTP/SSE MCP servers
MCPContainerServerDefines containerized MCP servers running in the cluster