Enables access to OpenAI's models including GPT-4 and GPT-3.5-turbo through the OpenAI API, supporting both creative tasks and fast responses for simple queries.
MCP AI Gateway
A unified MCP (Model Context Protocol) server that enables AI assistants to intelligently select and switch between different AI models within the same conversation to complete tasks.
🎯 Core Concept
Intelligent Model Selection
The core value of MCP AI Gateway lies in enabling AI assistants to automatically choose the most suitable model based on task requirements:
- Code Tasks: Let AI choose Claude Opus 4 for advanced code analysis
- Quick Q&A: Let AI choose GPT-4o for fast, reliable responses
- Creative Writing: Let AI choose GPT-5 or Gemini 2.5 Pro for superior creativity
- Multimodal Processing: Let AI choose vision-capable models like GPT-4o
Workflow Example
Within a single conversation, AI might:
- Use Claude Opus 4 to analyze complex code logic
- Use GPT-5 to generate creative solutions
- Use Gemini 2.5 Pro for quick verification
All achieved through a unified MCP tool, no manual switching required!
🚀 Quick Start
1. Installation and Configuration
No installation needed, use directly with npx:
2. Claude Desktop Configuration
Add to your Claude Desktop MCP configuration:
3. Start Using Immediately
After configuration, restart Claude Desktop and you can interact with AI like this:
"Please use the most suitable model to analyze this code, then use another model to generate test cases"
AI will automatically select appropriate models for different subtasks!
📖 Detailed Configuration Guide
Environment Variables
Variable | Required | Description | Example |
---|---|---|---|
API_FORMAT | ✅ | API format | openai or anthropic |
API_KEY | ✅ | API key | sk-... |
API_ENDPOINT | ⚪ | Custom endpoint | https://api.openai.com/v1 |
DEFAULT_MODEL | ⚪ | Default model | gpt-4o |
DESCRIPTION | ⚪ | Custom model description | See examples below |
REQUEST_TIMEOUT | ⚪ | HTTP request timeout in seconds | 60 (default) |
API Format Support
OpenAI Format
Supports OpenAI, Azure OpenAI, and various OpenAI API-compatible services:
Anthropic Format
Direct support for Anthropic Claude models:
OpenRouter Format
Access 400+ AI models through OpenRouter's unified API:
Custom Description Examples
Through the DESCRIPTION
environment variable, you can provide detailed model selection guidance for AI:
🛠️ Advanced Configuration
Enterprise Proxy Support
Default Parameter Settings
Multi-Provider Configuration Example
You can configure multiple MCP AI Gateway instances to connect to different providers:
🔧 Technical Features
- 🔌 Plug & Play: Use directly via npx, no installation required
- 🌐 Multi-API Support: OpenAI, Anthropic, OpenRouter (400+ models), custom endpoints
- 🏗️ Extensible Architecture: Easy to add new API format support
- 🛡️ Enterprise Ready: Proxy support, error handling, secure authentication
- ⚡ High Performance: Direct HTTP calls, no additional overhead
- 📝 Fully Typed: Written in TypeScript, type-safe
- 💰 Cost Optimization: OpenRouter integration with automatic fallbacks
🎯 Use Cases
1. Development Workflow
- Use Claude Opus 4 for code review and optimization suggestions
- Use GPT-5 for technical documentation generation
- Use fast models for syntax checking
2. Content Creation
- Use creative models for draft generation
- Use analytical models for content optimization
- Use fast models for proofreading
3. Research & Analysis
- Use reasoning models for complex data analysis
- Use specialized models for report generation
- Use fast models for summary generation
4. Third-Party Model Access in AI Clients
Access premium models through official AI clients:
- Claude Desktop with OpenAI Models: Use your OpenAI API key to access GPT-5, GPT-4o in Claude Desktop interface
- OpenRouter Integration: Access 400+ models through one API with automatic fallbacks and cost optimization
- Third-Party API Integration: Connect expensive or specialized models (like Claude Opus 4) through custom endpoints
- Cost Optimization: Use cheaper third-party API providers while maintaining the familiar Claude Desktop/Gemini CLI experience
- Model Comparison: Test different providers' implementations of the same model within one interface
- Enterprise Solutions: Access internal or fine-tuned models through your organization's API gateway
Example Configuration for accessing OpenAI models in Claude Desktop:
Example Configuration for OpenRouter access in Claude Desktop:
📚 API Reference
chat_completion Tool Parameters
Parameter | Type | Description |
---|---|---|
model | string | Specify the model to use |
messages | array | Array of conversation message objects |
temperature | number | Control randomness (0-2) |
max_tokens | number | Maximum output length |
stream | boolean | Whether to stream output |
top_p | number | Nucleus sampling parameter |
frequency_penalty | number | Frequency penalty |
presence_penalty | number | Presence penalty |
stop | string/array | Stop sequences |
response_format | object | NEW: Format of the response (OpenAI only) |
Response Format Support
The response_format
parameter enables structured outputs from OpenAI-compatible models:
Note: This parameter is only supported for OpenAI-format APIs and will be ignored for Anthropic-format requests.
📚 Documentation
Comprehensive guides and tutorials for getting the most out of MCP AI Gateway:
Getting Started
- How to Access OpenRouter's Free Gemini Models in Claude Desktop - Save up to 80% on AI costs while enjoying Claude Desktop's interface
- How to Use ChatGPT Models in Gemini CLI - Access OpenAI's latest models directly within your Gemini CLI workflow
Advanced Workflows
- How to Create Multi-Model Workflows in Claude Desktop - Master intelligent model orchestration for complex projects
- How to Reduce AI Costs by 80% with Smart Model Routing - Transform your AI spending through intelligent cost optimization
Use Cases & Examples
- Client integration tutorials
- Enterprise deployment guides
- Cost optimization strategies
- Workflow automation patterns
More tutorials and guides coming soon! Check back regularly or suggest topics you'd like to see covered.
📖 Documentation & Guides
Comprehensive how-to guides for getting the most out of MCP AI Gateway:
Integration Guides
- How to Access OpenRouter's Free Gemini Models in Claude Desktop - Save up to 80% on AI costs while using Claude Desktop's interface
- How to Use ChatGPT Models in Gemini CLI - Break free from Google's model limitations and access OpenAI's latest models in Gemini CLI
Advanced Workflows
- How to Create Multi-Model Workflows in Claude Desktop Using Sub-Agent Descriptions - Master intelligent model orchestration for complex projects
Coming Soon
- How to Build AI-Powered Code Review Pipelines
- How to Set Up Cost-Effective Multi-Team AI Access
- How to Create Custom Model Selection Strategies
- Enterprise Deployment and Security Best Practices
🤝 Contributing
Issues and Pull Requests are welcome!
- GitHub: kinhunt/mcp-ai-gateway
- NPM: mcp-ai-gateway
📄 License
MIT License - See LICENSE file for details
Make AI assistants smarter at choosing models and boost your productivity! 🚀
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI assistants to intelligently select and switch between different AI models (OpenAI, Anthropic, etc.) within the same conversation based on task requirements. Provides a unified interface for accessing multiple AI providers through a single MCP tool.
Related MCP Servers
- -securityFlicense-qualityFacilitates interaction and context sharing between AI models using the standardized Model Context Protocol (MCP) with features like interoperability, scalability, security, and flexibility across diverse AI systems.Last updated -1Python
- -securityAlicense-qualityEnables AI assistants to interact with and manage Google Cloud Platform resources including Compute Engine, Cloud Run, Storage, BigQuery, and other GCP services through a standardized MCP interface.Last updated -3PythonMIT License
- AsecurityAlicenseAqualityAn MCP server that enables AI applications to access 20+ model providers (including OpenAI, Anthropic, Google) through a unified interface for text and image generation.Last updated -212PythonMIT License
- -securityFlicense-qualityA service that converts OpenAPI specifications into MCP tools, enabling AI assistants to interact with your API endpoints through natural language.Last updated -Python