MCP Integration
Integrate ModelPilot directly into your AI coding assistant with the Model Context Protocol (MCP).
The ModelPilot MCP Server enables AI coding assistants to integrate ModelPilot directly into your development workflow. Your AI assistant can create routers, test requests, check costs, and optimize your AI infrastructure—all without leaving your IDE.
Configuration
Configure the MCP server in your AI assistant's settings:
{
"mcpServers": {
"modelpilot": {
"command": "npm",
"args": ["-y", "@modelpilot/mcp-server"],
"env": {
"MODELPILOT_API_KEY": "mp-your-api-key-here"
}
}
}
}{
"mcpServers": {
"modelpilot": {
"command": "npx",
"args": ["-y", "@modelpilot/mcp-server"],
"env": {
"MODELPILOT_API_KEY": "mp-your-api-key-here"
}
}
}
}Available Tools
The MCP server provides these tools to your AI assistant:
Shows converted code and estimated cost savings.
Your assistant will guide you through selecting models and optimization preferences.
Returns response, cost breakdown, latency, and which model was used.
Track spending for the last 24h, 7d, or 30d with detailed breakdowns.
Receive actionable tips to reduce costs while maintaining quality.
See detailed comparisons on cost, quality, and speed metrics.
View your balance, subscription tier, and monthly spending.
Get complete code in Python, JavaScript, or TypeScript with error handling and retries.
Built-in Documentation
The MCP server includes comprehensive documentation resources accessible through your AI assistant:
- Quickstart Guide
- OpenAI Migration Guide
- Anthropic Migration Guide
- Router Configuration Best Practices
- Python SDK Reference
- JavaScript SDK Reference
- Routing Strategies Guide
- Cost Optimization Strategies
- Production Chatbot Example
- Pricing Guide
Example Workflow
# Your existing OpenAI code
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)