OpenAI Compatible Gateway
FreeNot checkedRoutes MCP tool calls to any OpenAI-compatible chat or completions API backend.
About
Routes MCP tool calls to any OpenAI-compatible chat or completions API backend.
README
Local Python MCP server that exposes fixed MCP tools for gpt, claude, and gemini, while still calling any OpenAI-style chat/completions backend underneath.
That means each target can be configured independently:
- its own API base URL
- its own API key or API key env var
- its own default model
- its own headers, query params, and endpoint paths
So if you want:
gpt-> OpenAI directlyclaude-> OpenRoutergemini-> Electron Hub
you can do that cleanly with one section per target.
Tools
The server exposes:
provider_statuslist_gpt_modelslist_claude_modelslist_gemini_modelschat_gptchat_claudechat_geminisimple_gpt_chatsimple_claude_chatsimple_gemini_chat
Configuration
By default the server reads config/providers.toml.
The repository only includes a safe example file at config/providers.example.toml.
Create your local config/providers.toml from that example and keep your real keys there.
Override the config path with:
$env:OPENAI_COMPAT_MCP_CONFIG="C:\path\to\providers.toml"
The file is intentionally fixed-shape. No arbitrary provider registry.
[server]
name = "OpenAI-Compatible MCP Gateway"
timeout_seconds = 60
[gpt]
base_url = "https://api.openai.com/v1"
api_key_env = "OPENAI_API_KEY"
model = "gpt-4.1-mini"
[claude]
base_url = "https://api.anthropic.com/v1/openai"
api_key_env = "ANTHROPIC_API_KEY"
model = "claude-sonnet-4-5"
[gemini]
base_url = "https://generativelanguage.googleapis.com/v1beta/openai"
api_key_env = "GEMINI_API_KEY"
model = "gemini-2.5-flash"
Bootstrap your local config with:
Copy-Item config\\providers.example.toml config\\providers.toml
Each of gpt, claude, and gemini supports:
base_urlmodelapi_key_envapi_keychat_completions_pathmodels_pathapi_key_headerapi_key_prefixapi_key_query_nameheadersquerydefault_bodytimeout_secondsenabled
Example alternate routing
If you want all three targets to go through OpenRouter or another OpenAI-compatible hub, keep the sections separate and just point them to different models:
[gpt]
base_url = "https://openrouter.ai/api/v1"
api_key_env = "OPENROUTER_API_KEY"
model = "openai/gpt-4.1-mini"
headers = { "HTTP-Referer" = "https://example.com", "X-Title" = "Local MCP Gateway" }
[claude]
base_url = "https://openrouter.ai/api/v1"
api_key_env = "OPENROUTER_API_KEY"
model = "anthropic/claude-sonnet-4"
headers = { "HTTP-Referer" = "https://example.com", "X-Title" = "Local MCP Gateway" }
[gemini]
base_url = "https://openrouter.ai/api/v1"
api_key_env = "OPENROUTER_API_KEY"
model = "google/gemini-2.5-flash"
headers = { "HTTP-Referer" = "https://example.com", "X-Title" = "Local MCP Gateway" }
Install
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e .[dev]
Run
For stdio MCP:
openai-compat-mcp
For streamable HTTP:
$env:OPENAI_COMPAT_MCP_TRANSPORT="streamable-http"
openai-compat-mcp
Optional Remote Bearer Auth
If you expose the server over HTTP, you can require an app-level bearer token.
Set:
$env:OPENAI_COMPAT_MCP_BEARER_TOKEN="replace-this-with-a-long-random-token"
Optional but recommended for remote/public-facing setups:
$env:OPENAI_COMPAT_MCP_PUBLIC_BASE_URL="https://your-domain.example.com"
Behavior:
stdiomode is unaffected- HTTP MCP requests must send
Authorization: Bearer <your-token> provider_statusreports whether remote bearer auth is enabled
Example MCP client config
{
"mcpServers": {
"openai-compat-gateway": {
"command": "C:\\Users\\anuji\\Documents\\codex\\.venv\\Scripts\\openai-compat-mcp.exe",
"env": {
"OPENAI_COMPAT_MCP_CONFIG": "C:\\Users\\anuji\\Documents\\codex\\config\\providers.toml",
"OPENAI_API_KEY": "sk-...",
"ANTHROPIC_API_KEY": "sk-ant-...",
"GEMINI_API_KEY": "..."
}
}
}
}
Notes
- The gateway uses direct HTTP requests, not vendor SDKs.
- Requests are non-streaming
chat/completions. list_*_modelsdepends on the configured backend exposingGET /models.
Install OpenAI Compatible Gateway in Claude Desktop, Claude Code & Cursor
unyly install openai-compatible-gatewayInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add openai-compatible-gateway -- uvx --from git+https://github.com/deathwalker-47/openai-compat-mcp openai-compat-mcpStep-by-step: how to install OpenAI Compatible Gateway
FAQ
Is OpenAI Compatible Gateway MCP free?
Yes, OpenAI Compatible Gateway MCP is free — one-click install via Unyly at no cost.
Does OpenAI Compatible Gateway need an API key?
No, OpenAI Compatible Gateway runs without API keys or environment variables.
Is OpenAI Compatible Gateway hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install OpenAI Compatible Gateway in Claude Desktop, Claude Code or Cursor?
Open OpenAI Compatible Gateway on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Gmail
Read, send and search emails from Claude
by GoogleSlack
Send, search and summarize Slack messages
by SlackRunbear
No-code MCP client for team chat platforms, such as Slack, Microsoft Teams, and Discord.
Discord Server
A community discord server dedicated to MCP by [Frank Fiegel](https://github.com/punkpeye)
Klavis AI
Open Source MCP Infra. Hosted MCP servers and MCP clients on Slack and Discord.
Work90210/APIFold
Turn any REST API into a hosted MCP server. 18 free public servers (GitHub, Stripe, Slack, OpenAI, Notion, and more) — no setup required, bring your own API key
by Work90210arikusi/deepseek-mcp-server
MCP server for DeepSeek AI with chat, reasoning, multi-turn sessions, function calling, thinking mode, and cost tracking.
by arikusihashgraph-online/hashnet-mcp-js
MCP server for the Registry Broker. Discover, register, and chat with AI agents on the Hashgraph network.
by hashgraph-onlineprofullstack/mcp-server
A comprehensive MCP server aggregating 20+ tools including SEO optimization, document conversion, domain lookup, email validation, QR generation, weather data,
by profullstackWayStation-ai/mcp
Seamlessly and securely connect Claude Desktop and other MCP hosts to your favorite apps (Notion, Slack, Monday, Airtable, etc.). Takes less than 90 secs.
by waystation-aiCompare OpenAI Compatible Gateway with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All communication MCPs
