Gateway
A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
What is Gateway?
Gateway is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to blazing fast ai gateway with integrated guardrails. route to 1,600+ llms, 50+ ai guardrails with 1 fast & friendly api.
A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A blazing fast AI Gateway with integrated guardrails. Route
Use Cases
Maintainer
Works with
Installation
NPM
npx -y gatewayManual Installation
npx -y gatewayConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Gateway
Portkey AI Gateway is a blazing-fast, open-source AI router that provides a single unified API to route requests to 1,600+ LLMs across 50+ providers, with built-in guardrails, fallbacks, load balancing, semantic caching, and detailed observability. Its MCP integration centralizes authentication, access control, and logging for all MCP servers your team uses, making it a control plane for AI agent infrastructure. Teams that operate multiple LLM-powered services and need reliability, cost control, and compliance in one place will benefit most from deploying the Gateway.
Prerequisites
- Node.js 18+ and npx, OR Docker for containerized deployment
- API keys for the LLM providers you want to route to (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY)
- An MCP-compatible client such as Claude Desktop, Cursor, or VS Code
- Portkey account (optional, for cloud-hosted gateway and virtual key management)
Start the Gateway locally with npx
Run the Gateway on your local machine. It starts an API server on port 8787 and a management console at the /public path.
npx @portkey-ai/gatewayVerify the Gateway is running
Confirm the API server is live by sending a test request. The Gateway is accessible at http://localhost:8787/v1.
curl http://localhost:8787/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'x-portkey-provider: openai' \
-H 'Authorization: Bearer your_openai_key' \
-d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'Configure routing and guardrails
Open the Gateway console at http://localhost:8787/public to set up routing configs, enable fallbacks, add guardrails, and create virtual keys that mask your real provider API keys.
Add the Gateway as an MCP server in your client configuration
Configure your MCP client to route all LLM and MCP server traffic through the Portkey Gateway. This centralizes auth, logging, and access control.
{
"mcpServers": {
"gateway": {
"command": "npx",
"args": ["-y", "@portkey-ai/gateway"],
"env": {
"PORTKEY_API_KEY": "your_portkey_api_key",
"OPENAI_API_KEY": "your_openai_key",
"ANTHROPIC_API_KEY": "your_anthropic_key"
}
}
}
}Set up fallback and retry policies
In the Gateway console or via config, define a routing strategy that automatically falls back to a secondary provider if the primary fails, and retries with exponential backoff on transient errors.
Monitor usage and costs
Use the Gateway dashboard to inspect request logs, latency metrics, token usage, and per-provider cost breakdown. This helps identify expensive models and opportunities for caching.
Gateway Examples
Client configuration
Claude Desktop configuration for routing AI requests through the Portkey AI Gateway.
{
"mcpServers": {
"gateway": {
"command": "npx",
"args": ["-y", "@portkey-ai/gateway"],
"env": {
"PORTKEY_API_KEY": "your_portkey_api_key",
"OPENAI_API_KEY": "your_openai_key",
"ANTHROPIC_API_KEY": "your_anthropic_key"
}
}
}
}Prompts to try
Example prompts that leverage the Portkey Gateway's routing and observability capabilities.
- "Route this request to GPT-4o with a fallback to Claude Sonnet if it fails"
- "Show me the token usage and cost breakdown for the last 100 requests through the Gateway"
- "Enable the PII guardrail on all outbound requests to prevent sensitive data leakage"
- "List all virtual keys configured in the Gateway and their associated providers"
- "What was the average latency for requests to Anthropic vs OpenAI this week?"Troubleshooting Gateway
Gateway returns 'Provider not supported' for a model request
Verify you have set the correct x-portkey-provider header (or PORTKEY_PROVIDER env var) matching the provider name in Portkey's documentation. Also confirm the corresponding API key environment variable is set.
Port 8787 is already in use when starting the Gateway
Set the PORT environment variable to an alternate port before starting: `PORT=9000 npx @portkey-ai/gateway`. Update your MCP client configuration and any direct API calls to use the new port.
Guardrails block legitimate requests unexpectedly
Review the active guardrail rules in the Gateway console at http://localhost:8787/public. Adjust the guardrail thresholds or add exceptions for known-good patterns. Enable debug logging with LOG_LEVEL=debug to see exactly which rule triggered the block.
Frequently Asked Questions about Gateway
What is Gateway?
Gateway is a Model Context Protocol (MCP) server that blazing fast ai gateway with integrated guardrails. route to 1,600+ llms, 50+ ai guardrails with 1 fast & friendly api. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Gateway?
Install via npm with the command: npx -y gateway. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Gateway?
Gateway works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Gateway free to use?
Yes, Gateway is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Gateway Alternatives — Similar Cloud Services Servers
Looking for alternatives to Gateway? Here are other popular cloud services servers you can use with Claude, Cursor, and VS Code.
Open WebUI
★ 138.2kUser-friendly AI Interface (Supports Ollama, OpenAI API, ...)
Anything LLM
★ 60.4kThe all-in-one AI productivity accelerator. On device and privacy first with no annoying setup or configuration.
LocalAI
★ 46.4kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
Nacos
★ 33.0kan easy-to-use dynamic service discovery, configuration and service management platform for building AI cloud native applications.
Xiaozhi ESP32
★ 26.7k本项目为xiaozhi-esp32提供后端服务,帮助您快速搭建ESP32设备控制服务器。Backend service for xiaozhi-esp32, helps you quickly build an ESP32 device control server.
Nginx UI
★ 11.2kYet another WebUI for Nginx
Browse More Cloud Services MCP Servers
Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Gateway in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Gateway?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.