Back to guides

MCP Server Integration

Use LLM Gateway's built-in MCP server to give Claude Code, Codex, Cursor, or any MCP client access to 200+ models — chat, image generation, and model discovery as tools.

LLM Gateway ships a hosted Model Context Protocol (MCP) server at https://api.llmgateway.io/mcp. Connect it to Claude Code, Codex, Cursor, or any MCP-compatible client and your AI assistant gets tools to call any model in our catalog — ask GPT-5 for a second opinion from inside Claude Code, generate images mid-session, or look up model pricing without leaving your editor.

Using DevPass? This integration also works with a DevPass plan key. Use root model IDs without a provider prefix (claude-sonnet-4-5, not anthropic/claude-sonnet-4-5) — provider-pinned routing is not available on coding plans; the gateway picks the provider for you.

What you get

The MCP server exposes four tools:

  • chat — send messages to any supported LLM (model, messages, optional temperature / max_tokens)
  • generate-image — text-to-image with models like Qwen Image (prompt, optional model, size, n)
  • generate-nano-banana — image generation with Gemini 3 Pro Image Preview, with optional save-to-disk
  • list-models / list-image-models — browse available models with capabilities and pricing

Setup

You'll need an API key from the LLM Gateway dashboard (API Keys section).

Claude Code

1claude mcp add --transport http --scope user llmgateway https://api.llmgateway.io/mcp \2  --header "Authorization: Bearer your-api-key-here"

Or add it manually to ~/.claude.json (user scope) or .mcp.json in your project root:

1{2  "mcpServers": {3    "llmgateway": {4      "url": "https://api.llmgateway.io/mcp",5      "headers": {6        "Authorization": "Bearer your-api-key-here"7      }8    }9  }10}

Codex CLI

1export LLM_GATEWAY_API_KEY="your-api-key-here"2codex mcp add llmgateway --url https://api.llmgateway.io/mcp \3  --bearer-token-env-var LLM_GATEWAY_API_KEY

Or in ~/.codex/config.toml:

1[mcp_servers.llmgateway]2url = "https://api.llmgateway.io/mcp"3bearer_token_env_var = "LLM_GATEWAY_API_KEY"

Cursor

Add to ~/.cursor/mcp.json:

1{2  "mcpServers": {3    "llmgateway": {4      "url": "https://api.llmgateway.io/mcp",5      "headers": {6        "Authorization": "Bearer your-api-key-here"7      }8    }9  }10}

Any other MCP client works the same way: streamable HTTP transport, https://api.llmgateway.io/mcp, bearer auth.

Try it

Once connected, ask your assistant things like:

  • "Use the chat tool to ask GPT-5 about TypeScript best practices"
  • "Generate an image of a futuristic city with the generate-image tool"
  • "List all available Anthropic models with pricing"

Every tool call is a normal LLM Gateway request — it shows up in your dashboard with cost and token counts, hits the cache when repeated, and uses the same credits as your API traffic.

Why use it

  • Cross-model workflows — your coding agent can consult a different model without you switching tools
  • Image generation anywhere — any MCP client becomes an image studio
  • One key, one bill — MCP traffic and API traffic share credits, caching, and analytics

For the full tool parameter reference, see the MCP docs.

Get started for free — no credit card required.