IBM/mcp-context-forge

An AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/gRPC APIs, exposing a unified endpoint with centralized discovery, guardrails and management. Optimizes Agent & Tool calling, and supports plugins.

ContextForge – A unified gateway for AI tools, agents and APIs

What it is – ContextForge is an open‑source registry and proxy that lets you expose any Model Context Protocol (MCP) server, A2A (agent‑to‑agent) service, or ordinary REST/gRPC API through a single, centrally‑governed endpoint. It acts as a gateway that translates, discovers, and monitors those back‑ends, making them look like native MCP tools for your LLM‑driven applications.

Why it matters – Modern LLM apps often need to call many external services (search, databases, custom tools, other agents). Keeping each integration separate quickly becomes a maintenance nightmare: you have to handle auth, rate‑limits, retries, observability, and versioning for every service. ContextForge solves this by:

  • Federating heterogeneous back‑ends (MCP, REST, gRPC) into one consistent API surface.
  • Providing central governance (auth, rate‑limiting, OAuth, JWT, secret management).
  • Offering built‑in observability via OpenTelemetry (traces to Jaeger, Zipkin, Phoenix, etc.).
  • Allowing plug‑in extensions (40+ plugins) for extra transports or custom logic.
  • Supplying an admin UI for runtime configuration, health checks, and log browsing.

Key components

Component Role
Tools Gateway Translates MCP, REST, and gRPC services into MCP‑compatible tools; supports TOON compression and automatic JSON‑Schema extraction.
Agent Gateway Routes OpenAI‑compatible, Anthropic, or custom agents via the A2A protocol; handles token‑level routing and versioning.
API Gateway Adds rate‑limiting, retries, and reverse‑proxy capabilities for generic REST services.
Plugin System 40+ ready‑made adapters for extra transports (WebSocket, SSE, stdio, etc.) and integrations.
Observability Layer OpenTelemetry instrumentation; export to Phoenix, Jaeger, Zipkin, Tempo, DataDog, New Relic, etc.; LLM‑specific metrics (token usage, cost).
Admin UI HTMX/Alpine‑based dashboard for managing servers, tools, prompts, and resources; supports air‑gapped deployments.

How you run it

  • PyPIpip install mcp-contextforge-gateway and start with the mcpgateway CLI.
  • Docker / Docker‑Compose – Pull the pre‑built image ghcr.io/ibm/mcp-context-forge and spin up the full stack (gateway + PostgreSQL + Redis + optional Nginx) with a single docker compose up -d.
  • Kubernetes (Helm) – Deploy the provided Helm chart for multi‑cluster, HA setups; includes auto‑scaling, Prometheus metrics, and secret injection.
  • Dev container – VS Code dev‑container support for rapid local development.

Typical workflow

  1. Generate secrets (python -m mcpgateway.scripts.init_secrets).
  2. Start the gateway (CLI, Docker, or Helm).
  3. Register back‑ends via the Admin UI or REST calls – e.g., point a legacy REST service at http://localhost:4444/gateways.
  4. Create virtual servers that bundle a set of tools/prompts/resources.
  5. Consume the unified MCP endpoint from any LLM client (OpenAI‑compatible, Anthropic, or custom) – the client sees a single /mcp URL regardless of the underlying implementation.

Who should use it

  • Teams building agentic AI applications that need to call many heterogeneous services.
  • Enterprises that want central policy enforcement (auth, rate limits, audit) for all AI‑related APIs.
  • Developers looking for observability of tool usage across distributed LLM workloads.
  • Anyone needing a plug‑in‑friendly gateway that can evolve as new transport protocols appear.

Maturity & Community

  • Actively maintained by IBM with CI pipelines (tests, linting, dependency review).
  • Over 7 000 automated tests and a full CI/CD workflow.
  • Distributed as a PyPI package and a Docker image; supports Python 3.11+.
  • Documentation site (ibm.github.io/mcp-context-forge) includes quick‑start guides, API reference, and a roadmap.
  • Open to contributions – see the CONTRIBUTING.md for issue filing and PR guidelines.

TL;DR – ContextForge is a production‑grade, extensible gateway that turns any AI tool, agent, or service (MCP, REST, gRPC) into a single, observable, and centrally governed endpoint, ready to be consumed by LLM‑driven applications.

Related

  • Project
  • Project
  • Project
  • Project
  • Project