MCP AI Gateway

A unified MCP server for multiple AI API providers (OpenAI, Anthropic, etc.) with customizable endpoints and model configurations
  • javascript

0

GitHub Stars

javascript

Language

7 months ago

First Indexed

3 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kinhunt-mcp-ai-gateway": {
      "command": "npx",
      "args": [
        "mcp-ai-gateway"
      ],
      "env": {
        "API_KEY": "sk-your-key",
        "API_FORMAT": "openai",
        "DESCRIPTION": "Describe available models and strengths",
        "API_ENDPOINT": "https://api.openai.com/v1",
        "DEFAULT_MODEL": "gpt-4o",
        "REQUEST_TIMEOUT": "60"
      }
    }
  }
}

You can use the MCP AI Gateway to orchestrate multiple AI models within a single conversation. It automatically selects the most suitable model for each subtask, helping you optimize performance, cost, and capability without manual switching.

How to use

Set up an MCP client to connect to the MCP AI Gateway, then start sending multi-step tasks. The gateway analyzes each subtask and routes it to the best available model, for example using a coding model for code analysis, a high-creativity model for drafting, and a fast model for quick checks. You will interact with the unified interface, while ask-for and receive results from different models seamlessly.

How to install

Prerequisites: you need Node.js and npm installed on your system.

# Install and run the MCP gateway directly
npx mcp-ai-gateway

Additional details

Configure your MCP client to point to the gateway and set environment variables that control API access and models. The configuration supports multiple providers and automatic fallbacks, so you can access OpenAI, Anthropic, OpenRouter, and custom endpoints through a single gateway.

Below are example configurations you can adapt for your client setup. Each example runs the gateway via a local runtime and passes provider-specific options through environment variables.

Configuration examples

json
{
  "mcpServers": {
    "ai_gateway": {
      "command": "npx",
      "args": ["mcp-ai-gateway"],
      "env": {
        "API_FORMAT": "openai",
        "API_KEY": "your-api-key-here",
        "API_ENDPOINT": "https://api.openai.com/v1",
        "DEFAULT_MODEL": "gpt-4o",
        "DESCRIPTION": "Available models: gpt-5, gpt-4o, claude-opus-4..."
      }
    }
  }
}

Environment variables and usage notes

Key environment variables control how the gateway connects to models and what defaults it uses. Examples include API_FORMAT, API_KEY, API_ENDPOINT, DEFAULT_MODEL, and DESCRIPTION. You can also set a default timeout and proxy settings if your environment requires them.

Troubleshooting

If you encounter issues starting the gateway, ensure Node is installed and that your environment variables are correctly set. If the gateway cannot fetch dependencies in some environments, clear the local cache for npm/npx and retry.

Notes

The gateway supports multiple MCP configurations and can connect to different providers from the same client, enabling cost optimization and easy model comparison within a single workflow.

Available tools

Intelligent Model Routing

Automatically route subtasks to the most suitable AI model based on task requirements, such as code analysis, quick Q&A, or multimodal processing.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational