Skip to content

aigateway-sh/mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcp-server

Reference Model Context Protocol server for AIgateway — one MCP endpoint that gives agents access to every AI modality we route (chat, embeddings, images, video, audio, voice, music, 3D, OCR, translation, classification, moderation, rerank, async jobs).

  • Hosted: https://api.aigateway.sh/mcp (Streamable HTTP, MCP 2025-03-26)
  • Legacy SSE: https://api.aigateway.sh/mcp/sse (MCP 2024-11-05)
  • Tool schemas: tools.ts in this repo
  • Inspector: api.aigateway.sh/mcp/inspect

Install as a Claude Code plugin (one step)

This repo is also a Claude Code plugin marketplace. Installing the plugin wires up the MCP server and installs a skill that teaches the agent to discover models before calling them:

/plugin marketplace add aigateway-sh/mcp-server
/plugin install aigateway

You'll be prompted for your AIgateway key (sk-aig-...) on first enable. Prefer to wire it by hand? Use the per-client snippets below.

Why

MCP is the emerging standard for giving agents typed tools. AIgateway's MCP server exposes 19 high-level primitives — discovery (list_models, search_models, get_model) plus invocation (chat, embed, generate_image, transcribe, speak, translate, generate_video, generate_music, generate_3d, ocr, classify, moderate, rerank, detect_objects, and job control) — so agents don't need per-provider adapters.

Drop your AIgateway API key into any MCP-aware client and your agent suddenly has access to 1000+ models across every modality.

Connect from common MCP clients

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "aigateway": {
      "type": "http",
      "url": "https://api.aigateway.sh/mcp",
      "headers": {
        "Authorization": "Bearer sk-aig-YOUR_KEY"
      }
    }
  }
}

Restart Claude Desktop. The tools show up under the hammer icon.

Claude Code

claude mcp add --transport http aigateway https://api.aigateway.sh/mcp \
  --header "Authorization: Bearer sk-aig-YOUR_KEY"

Cursor

Cursor Settings → MCP → Add Server:

{
  "aigateway": {
    "url": "https://api.aigateway.sh/mcp",
    "headers": { "Authorization": "Bearer sk-aig-YOUR_KEY" }
  }
}

Cline, Continue.dev, Zed, any other MCP client

Same pattern — point at https://api.aigateway.sh/mcp with Authorization: Bearer sk-aig-.... The server speaks both Streamable HTTP (preferred) and SSE (legacy).

MCP Inspector

npx @modelcontextprotocol/inspector \
  --transport streamable-http \
  --server-url https://api.aigateway.sh/mcp \
  --header "Authorization=Bearer sk-aig-YOUR_KEY"

What the tools look like

chat              — route to 100+ text models (OpenAI-compatible)
embed             — embeddings for RAG / semantic search
generate_image    — text-to-image across FLUX, Ideogram, Stable Diffusion, DALL·E
transcribe        — speech-to-text (Whisper, Deepgram, AssemblyAI)
speak             — text-to-speech (ElevenLabs, OpenAI TTS, PlayHT)
translate         — any-to-any language translation
classify          — zero-shot classification
moderate          — safety/moderation scoring
rerank            — Cohere-style rerank for retrieval
ocr               — document/image OCR
detect_objects    — open-vocab object detection
generate_video    — text-to-video (Runway, Luma, Kling)
generate_music    — text-to-music (Suno, Udio, Stability)
generate_3d       — text-to-3D (Meshy, Rodin, Stability)
get_job / cancel_job   — control long-running async generations
list_models / search_models   — discover what's routable right now
get_model         — full invocation contract for a model (endpoint, request/response/streaming schema, quirks, runnable snippets); call before invoking an unfamiliar model

See tools.ts for the exact input/output schemas each tool exposes over MCP.

Calling it from code (without MCP)

If you just want to call the same primitives from your own code without an MCP client, the HTTP API is identical to OpenAI's:

curl https://api.aigateway.sh/v1/chat/completions \
  -H "Authorization: Bearer sk-aig-YOUR_KEY" \
  -d '{
    "model": "anthropic/claude-opus-4.7",
    "messages": [{"role":"user","content":"hi"}]
  }'

SDKs — aigateway-js, aigateway-py, aigateway-cli.

Build your own MCP tools on top of AIgateway

If you want a custom MCP server that wraps a few specific AIgateway calls (e.g. "summarize this document" that internally does ocrchat), build it with the MCP TypeScript SDK or Python SDK and call AIgateway from inside each tool. We plan to publish a small starter template here — follow the repo for updates.

Status & reliability

  • Hosted server runs on the same edge infrastructure as api.aigateway.sh.
  • Live status: status.aigateway.sh.
  • Failures fall back to next-best provider automatically when a lab is down.

Related

License

MIT. Tool schemas are canonical — if you build an alternate server that speaks the same shape, agents can swap between yours and ours transparently.

About

Reference MCP (Model Context Protocol) server implementation for AIgateway.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors