Skip to main content

Context Gateway

Permission-aware context for AI agents. Every result is cited, filtered to what the caller may read, guardrailed and sized to a token budget.

Open source under Apache-2.0

What is Context Gateway?

Context Gateway (cx) answers agents' knowledge requests over MCP, REST and A2A, behind any AI gateway or none. It implements the Context Interface Specification (CXI), a vendor-neutral contract for serving context.

  1. Agents and appsMCP clients, services, other agents and LLM traffic.
  2. Any AI gatewayOptional. Agents can also connect directly.
  3. Context GatewayValidates the token, filters by access, ranks, applies guardrails and audits.
  4. Your knowledgeFolders, GitHub, Confluence, JSON APIs and pushed documents.

See the architectureRead the CXI specification

Ways to start

Run these from a checkout of the repository.

  • From source

    Needs Python 3.11 or newer.

    python3 -m venv .venv
    .venv/bin/pip install -e ".[onnx,documents,tiktoken]"
    .venv/bin/cx serve
    From source guide
  • Docker Compose

    The gateway with Valkey, OPA, OpenTelemetry and Jaeger.

    docker compose -f deploy/compose.yaml up --build
    Docker Compose guide
  • Kubernetes

    A Kustomize spec in the cx-system namespace.

    docker build -t cx:local .
    # load or push the image, then:
    kubectl apply -k deploy/k8s
    Kubernetes guide