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.
- Agents and appsMCP clients, services, other agents and LLM traffic.
- Any AI gatewayOptional. Agents can also connect directly.
- Context GatewayValidates the token, filters by access, ranks, applies guardrails and audits.
- Your knowledgeFolders, GitHub, Confluence, JSON APIs and pushed documents.
Key features
Isolation before ranking
Access is enforced inside every store query, so hidden documents never shape results or scores.
Delegation as intersection
An agent acting for a user sees only what both the agent and the user may read.
Hybrid retrieval
Keyword and vector search with small int8 models, reranking, freshness and a knowledge graph.
Guardrails
Secrets and PII redaction, prompt-injection flags, chains per space and a bundled OPA policy.
Memory, versions and audit
Memory per agent and user, rollback to an earlier space version, and an audit record for reads.
Pluggable by configuration
Choose stores, connectors, parsers, models and policies in cx.yaml, or bring your own classes.
Every way in
The same operations and the same access checks behind each binding.
MCP
Tools, document resources and a cited-answer prompt over Streamable HTTP.
REST
A versioned API with an OpenAPI 3.1 description and RFC 9457 errors.
A2A
An agent card and JSON-RPC message/send for agents that delegate questions.
AI gateways
Context injection and a chat-completions passthrough for LLM routes.
Ways to start
Run these from a checkout of the repository.
From source
Needs Python 3.11 or newer.
From source guidepython3 -m venv .venv.venv/bin/pip install -e ".[onnx,documents,tiktoken]".venv/bin/cx serveDocker Compose
The gateway with Valkey, OPA, OpenTelemetry and Jaeger.
Docker Compose guidedocker compose -f deploy/compose.yaml up --buildKubernetes
A Kustomize spec in the cx-system namespace.
Kubernetes guidedocker build -t cx:local .# load or push the image, then:kubectl apply -k deploy/k8s