Skip to main content
Glama

MCP-AI-Gateway

Python FastAPI Docker MCP CI

Unified local MCP AI Gateway that routes across Groq, OpenRouter, Mistral, and local Ollama providers, with OpenAI-compatible APIs, MCP tools, fallback/racing router, monitoring, and web dashboard.

Web UI

๐Ÿš€ Features

  • Async Python gateway with provider abstraction layer

  • Built-in providers:

    • Groq (openai/gpt-oss-120b default, plus moonshotai/kimi-k2-instruct-0905)

    • OpenRouter (openai/gpt-4o-mini default)

    • Mistral (codestral-latest default, plus devstral-medium-latest)

    • Ollama

  • Intelligent router:

    • priority routing

    • fallback routing

    • parallel racing mode

    • rate-limit aware provider scoring

  • MCP server capabilities:

    • tool registration/discovery

    • prompt template discovery/rendering

    • schema validation

    • SSE and HTTP transport

  • OpenAI-compatible API:

    • POST /v1/chat/completions

    • POST /v1/completions

    • GET /v1/models

  • Web UI (React + Vite + Tailwind):

    • Dashboard

    • Providers

    • Models

    • Chat

    • Logs

    • Stats

    • Runtime gateway API key generation

  • Observability:

    • Prometheus metrics (/metrics)

    • structured logs

    • SQLite request statistics

  • Extensible plugin system for additional providers

  • CLI: mcp-ai start|stop|status|providers|models

  • Docker + docker-compose support

  • GitHub Actions CI for backend lint/tests and frontend build

Related MCP server: Multi-LLM Gateway MCP

๐Ÿ—‚๏ธ Repository Structure

mcp-ai-gateway/
  api/
  providers/
  router/
  mcp_server/
  plugins/
  database/
  web_ui/
  config/
  cli/
  tests/
  Dockerfile
  docker-compose.yml
  README.md

โšก Quick Start (Local)

1) ๐Ÿ“ฆ Prerequisites

  • Python 3.11+

  • Node.js 20+

  • Optional: local Ollama daemon at http://localhost:11434

2) ๐Ÿ Install backend

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .[dev]

3) ๐Ÿ” Configure environment

cp .env.example .env
# edit .env values

4) โš™๏ธ Edit config

config/config.yaml controls providers, routing, security, and default models.

5) โ–ถ๏ธ Start backend

uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload

6) ๐Ÿ–ฅ๏ธ Start web UI

cd web_ui
npm install
VITE_API_BASE=http://localhost:8000 VITE_API_KEY=change-me npm run dev

Open http://localhost:3000

๐Ÿณ Docker Deployment

docker compose up --build

Services:

๐Ÿงฉ API Overview

OpenAI-Compatible ๐Ÿค

  • POST /v1/chat/completions

  • POST /v1/completions

  • GET /v1/models

Use header X-API-Key: <key> (or Authorization: Bearer <key>).

MCP Endpoints ๐Ÿ”Œ

  • JSON-RPC MCP transport: POST /mcp

  • SSE streaming output: POST /mcp/stream

Supported MCP methods:

  • initialize

  • notifications/initialized

  • ping

  • tools/list

  • tools/call

  • prompts/list

  • prompts/get

Dashboard APIs ๐Ÿ“Š

  • GET /api/dashboard

  • GET /api/providers

  • POST /api/providers/{name}/toggle

  • POST /api/providers/{name}/priority

  • POST /api/providers/{name}/config

  • GET /api/models

  • GET /api/settings

  • POST /api/settings/default-model

  • POST /api/settings/api-key/generate

  • GET /api/logs

  • GET /api/stats

Monitoring ๐Ÿ“ˆ

  • GET /health

  • GET /metrics

๐Ÿ› ๏ธ CLI

mcp-ai start
mcp-ai status
mcp-ai providers
mcp-ai models
mcp-ai stop

๐Ÿงญ Warp MCP Integration

Add this to Warp MCP config:

{
  "mcpServers": {
    "mcp-ai-gateway": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "Authorization": "Bearer REPLACE_WITH_MCP_GATEWAY_API_KEY"
      }
    }
  }
}

๐Ÿงฑ Configuration Example

providers:
  groq:
    enabled: true
    api_key: ${GROQ_API_KEY}
    priority: 1
    default_model: openai/gpt-oss-120b
  mistral:
    enabled: false
    api_key: ${MISTRAL_API_KEY}
    priority: 12
    default_model: codestral-latest
  openrouter:
    enabled: true
    priority: 2
    default_model: openai/gpt-4o-mini
  ollama:
    enabled: true
    priority: 3
routing:
  fallback_enabled: true
  racing_mode: false

๐Ÿงช Plugin Providers

New providers can be added under plugins/ by implementing ProviderPlugin and enabling provider config in config/config.yaml.

Included plugin examples:

  • openai_provider.py

  • together_provider.py

  • openrouter_provider.py

โœ… Testing

pytest

CI runs on pushes and pull requests to main via .github/workflows/ci.yml:

  • Backend job: ruff check . and pytest -q

  • Frontend job: npm install and npm run build in web_ui/

๐Ÿ”„ Release Workflow

  • Open PR from dev/* branch to main

  • Ensure CI is green

  • Merge using GitHub CLI or GitHub UI

๐Ÿ“š Developer Guide

Detailed guide: docs/developer-guide.md

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    C
    quality
    D
    maintenance
    A powerful gateway for the Model Context Protocol (MCP) that unifies AI toolchains by federating multiple MCP servers, wrapping REST APIs as MCP tools, and supporting multiple transport methods with an admin dashboard.
    1
  • A
    license
    -
    quality
    C
    maintenance
    An MCP server that functions as an intelligent gateway for multiple LLM backends including OpenAI, Claude, and Ollama. It supports automatic provider fallback, streaming responses via Server-Sent Events, and real-time monitoring for robust AI integration.
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    MCPGate aggregates multiple MCP servers into a single unified endpoint, enabling centralized tool management with granular filtering, automatic namespacing, and observability. Features a real-time web dashboard and optional PostgreSQL-backed audit trails for monitoring and controlling AI tool access across local and remote deployments.
    10
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors โ€” no code.

  • Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.

  • AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YoushaaMurhij/MCP-AI-Gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server