Gateways, Upstreams, tool exposure modes, caching, and compression
Redis Context Gateway
Connect agents to MCP servers and tools over Redis data through one endpoint.
What is Context Gateway?
Redis Context Gateway is a Model Context Protocol (MCP) gateway for AI agents that:
- Connects MCP servers: Register third-party and in-house MCP servers that support Streamable HTTP as Upstreams.
- Provides one endpoint per Gateway: Connect your agent to a Gateway to access tools from multiple sources.
- Manages Upstream credentials: Configure credentials on the Gateway so your agent does not need credentials for each connected MCP server.
- Makes Redis data available as tools: A Context Surface generates tools from a data model describing records in Redis.
- Scales to large tool sets: In search mode, the agent searches for tools instead of loading every definition.
- Handles large and repeated results: An optional cache serves repeated calls, and compression keeps large results out of the agent's context.
List, search, and call your first tools through a Gateway
Connect a Gateway to OpenAI Agents SDK or LangGraph
Register MCP servers and Context Surfaces and set tool policies
Why use Context Gateway?
For AI applications
- Access tools from multiple sources through one MCP connection
- Tool definitions that fit the context window, through search mode
- Large results read in pages instead of filling the context
- Sign-in with your identity provider for MCP clients that support it
For platform teams
- Upstream credentials stored once, in Vault, AWS Secrets Manager, or encrypted Redis
- Per-Gateway access through Identity Service agent keys
- Python package,
iriscommand-line interface (CLI), and REST API for administration - Managed deployment on Redis Cloud or self-managed deployment on Kubernetes
Concepts
A Gateway is one MCP endpoint for an agent. Each Upstream behind it is an MCP server or a Context Surface, which generates tools from a data model of records in Redis. In full mode the agent lists every tool; in search mode it searches for the tools it needs. See Context Gateway concepts for tool policies, caching, and compression.
Quick example
-
Set up a Gateway:
- Redis Cloud: Create a Context Gateway.
- Self-managed: Follow the deployment guide, then create a Gateway and an agent key. A license key is required for self-managed deployment. Contact Redis to request access.
-
Install the Redis Iris Python package, which includes the
irisCLI:pip install 'redis-iris>=1.0.0' -
With
IRIS_CONTEXT_GATEWAY_URLandIRIS_CONTEXT_GATEWAY_API_KEYin your environment, find a tool and call it:from redis_iris import ContextGateway gateway = ContextGateway.from_env() for tool in gateway.search("filter providers by specialty"): print(tool.name, tool.description) result = gateway.call("<tool-name>", {"<argument>": "<value>"})From the CLI,
iris --json context-gateway tools listlists the same tools.
Use the tool names and input schemas returned by discovery. The redis-iris package covers MCP calls and Gateway administration in Python and the CLI. For JavaScript and TypeScript, install the @redis-iris/context-gateway SDK; see the client guide to choose a client. The quickstart shows calls in full and search mode.
Manage Gateways and Upstreams
- Manage Gateways and Upstreams: create Gateways, register MCP servers, store their credentials, and set tool policies.
- Manage Context Surfaces: generate tools for querying records in Redis.
Serve tools at runtime
- Connect with MCP from any Streamable HTTP client.
- Integrate with an agent using OpenAI Agents SDK or LangGraph.
Use the MCP API Reference for MCP tools and metadata, and limits and errors for constraints and recovery guidance.