Skip to main content

MCP server for DynaRoute - intelligent chat completions with automatic model routing and cost optimization

Project description

DynaRoute MCP Server

A Model Context Protocol (MCP) server that provides intelligent chat completions with automatic model routing and cost optimization through DynaRoute.

Features

  • 🧠 Intelligent Model Routing: Automatically routes queries to the most cost-effective model while maintaining quality
  • 💰 Cost Optimization: Save up to 70% compared to premium models like GPT-4o
  • 📊 Detailed Analytics: Get comprehensive metrics including token usage, costs, and performance data
  • 🔍 Routing Intelligence: See exactly which model was selected and why
  • Easy Integration: Works seamlessly with Claude Desktop, Cursor, and other MCP-compatible clients

Installation

Install via pip:

pip install dynaroute-mcp-server

Quick Start

  1. Get your DynaRoute API key from DynaRoute

  2. Set your API key:

    export DYNAROUTE_API_KEY=your_api_key_here
    
  3. Configure Claude Desktop by adding this to your claude_desktop_config.json:

    {
      "mcpServers": {
        "dynaroute": {
          "command": "dynaroute-mcp-server",
          "env": {
            "DYNAROUTE_API_KEY": "your_api_key_here"
          }
        }
      }
    }
    
  4. Restart Claude Desktop and start using DynaRoute!

Usage

Once configured, you can use DynaRoute in Claude Desktop by:

  • Asking for AI responses: "Use DynaRoute to explain quantum computing"
  • Requesting cost analysis: "Get a cost-optimized response about machine learning"
  • Explicit tool usage: "Use the DynaRoute tool to answer this question"

Example Output

When you use the DynaRoute tool, you'll get:

🤖 DynaRoute Response:
[Your AI response content here]

📊 PERFORMANCE METRICS:
• Model Used: gcp-gemini-2.0-flash-thinking
• Response Time: 2.5 seconds
• Request ID: chatcmpl-xyz123

🔢 TOKEN USAGE:
• Input Tokens: 25
• Output Tokens: 150
• Total Tokens: 175

💰 COST BREAKDOWN:
• Input Cost: $0.000012
• Output Cost: $0.000045
• Total Cost: $0.000057

📈 COST SAVINGS vs GPT-4o:
• GPT-4o Equivalent Cost: $0.000175
• Your Actual Cost: $0.000057
• Money Saved: $0.000118
• Savings Percentage: 67.4%

✅ EFFICIENCY SUMMARY: DynaRoute saved you 67.4% compared to GPT-4o while maintaining quality!

Configuration

Environment Variables

  • DYNAROUTE_API_KEY: Your DynaRoute API key (required)

Tool Parameters

The dynaroute_chat tool accepts:

  • messages: Array of conversation messages (required)
  • level_override: Override complexity level 1-5 (optional)

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "dynaroute": {
      "command": "dynaroute-mcp-server",
      "env": {
        "DYNAROUTE_API_KEY": "your_api_key_here"
      }
    }
  }
}

Other MCP Clients

Cursor IDE

Add to your Cursor settings:

{
  "mcp": {
    "servers": {
      "dynaroute": {
        "command": "dynaroute-mcp-server",
        "env": {
          "DYNAROUTE_API_KEY": "your_api_key_here"
        }
      }
    }
  }
}

Custom Usage

You can also import and use the server programmatically:

import asyncio
from dynaroute_mcp import DynaRouteMCPServer

async def main():
    server = DynaRouteMCPServer(api_key="your_api_key")
    await server.run()

asyncio.run(main())

Requirements

  • Python 3.8+
  • DynaRoute API key
  • MCP-compatible client (Claude Desktop, Cursor, etc.)

Dependencies

  • mcp: Model Context Protocol implementation
  • dynaroute: Official DynaRoute Python client

License

MIT License

Support

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

1.0.0

  • Initial release
  • DynaRoute integration with MCP
  • Cost optimization and analytics
  • Claude Desktop support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynaroute_mcp_server-1.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynaroute_mcp_server-1.0.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file dynaroute_mcp_server-1.0.1.tar.gz.

File metadata

  • Download URL: dynaroute_mcp_server-1.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for dynaroute_mcp_server-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3d44d54f0faba7ecd7b035f26750b8396ad7da0da5b4015171f4ca4b5c3b4594
MD5 f84f20a7db0aa7a9413880a229d1de2a
BLAKE2b-256 21fb5982a7b0aa21cdc6f0d27915788a360cc50f8eef729e89dcb5e25f511d72

See more details on using hashes here.

File details

Details for the file dynaroute_mcp_server-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dynaroute_mcp_server-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23867c4b1ed767cabd3402b84e5228fc47240dbe99d39e1dba5e9a5e529084a1
MD5 28861f741cac685576106960345f3ebd
BLAKE2b-256 1ce253d682ae555f7a3642f239ce2cafd35517b53cdc3a9843beb1abe866ca2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page