Skip to main content

MCP Integration

Integrate ModelPilot directly into your AI coding assistant with the Model Context Protocol (MCP).

Cascade / WindsurfClineAny MCP-Compatible Assistant
What is the ModelPilot MCP Server?

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.

Code Migration
Convert OpenAI/Anthropic code to ModelPilot
Router Management
Create and configure AI model routers
Live Testing
Test routers with real requests
Usage Analytics
Track spending and get optimization tips

Configuration

Configure the MCP server in your AI assistant's settings:

Cascade / Windsurf
Add to your MCP settings file
json
{
  "mcpServers": {
    "modelpilot": {
      "command": "npm",
      "args": ["-y", "@modelpilot/mcp-server"],
      "env": {
        "MODELPILOT_API_KEY": "mp-your-api-key-here"
      }
    }
  }
}
Cline
Add to ~/.cline/mcp.json
json
{
  "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:

migrate_code
Convert OpenAI or Anthropic SDK code to ModelPilot

Shows converted code and estimated cost savings.

Example:
"Migrate this OpenAI code to ModelPilot"
create_router
Create a new AI model router with guided configuration

Your assistant will guide you through selecting models and optimization preferences.

Example:
"Create a cost-optimized router for my chatbot"
test_request
Test a router with a real request

Returns response, cost breakdown, latency, and which model was used.

Example:
"Test my router 'chatbot-123' with: Hello, how are you?"
get_usage_summary
View usage statistics and costs

Track spending for the last 24h, 7d, or 30d with detailed breakdowns.

Example:
"Show my usage for the last 7 days"
optimize_router
Get cost-saving recommendations

Receive actionable tips to reduce costs while maintaining quality.

Example:
"How can I optimize my chatbot router?"
compare_models
Compare models side-by-side

See detailed comparisons on cost, quality, and speed metrics.

Example:
"Compare GPT-4o vs Claude 3.5 Sonnet vs Gemini Pro"
get_balance
Check current credit balance and subscription status

View your balance, subscription tier, and monthly spending.

Example:
"What's my balance?"
generate_integration_code
Generate production-ready integration code

Get complete code in Python, JavaScript, or TypeScript with error handling and retries.

Example:
"Generate Python code for my router with error handling"

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

1
Migrate existing code
"Migrate this OpenAI code to ModelPilot and show me the cost savings"
python
# Your existing OpenAI code
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
  model="gpt-4",
  messages=[{"role": "user", "content": "Hello!"}]
)
2
Create optimized router
"Create a cost-optimized router with GPT-4o-mini and Claude 3.5 Sonnet"
3
Test the router
"Test my new router with this prompt and show me the cost breakdown"
4
Monitor and optimize
"Show my usage for the last 7 days and suggest optimizations"