Skip to main content
Glama
AI Orchestration MCP Server

AI Orchestration MCP Server

by adakrupp

AI Orchestration MCP Server

Production-grade Model Context Protocol (MCP) server for orchestrating multiple AI providers. Intelligently delegate tasks to local models (Ollama, llama.cpp) or cloud providers (OpenAI, Anthropic, Gemini) to optimize cost and performance.

License: MIT TypeScript Node.js Docker Docker Hub Docker Image Size Docker Pulls

✨ Features

  • πŸ” Secure by Design: No shell injection vulnerabilities - uses HTTP APIs and official SDKs

  • πŸ”Œ 5 AI Providers: Ollama, Gemini, OpenAI, Anthropic, llama.cpp

  • βš™οΈ Flexible Configuration: File-based config with environment variable support

  • πŸ“Š Comprehensive Logging: Structured logging with sensitive data redaction

  • πŸ“ Request History: Track all requests and responses in JSONL format

  • 🐳 Docker Ready: One-command deployment with docker-compose

  • πŸ”„ Plugin Architecture: Easily add new providers

  • πŸ›‘οΈ Input Validation: Comprehensive sanitization and validation

  • πŸ“¦ TypeScript: Full type safety with strict mode

Related MCP server: MCP Gateway

πŸš€ Quick Start

Option 1: Docker Hub (Easiest)

# Pull the image
docker pull adakrupp/ai-orchestration-mcp:latest

# Download docker-compose.yml
curl -O https://raw.githubusercontent.com/adakrupp/ai-orchestration-mcp/main/docker-compose.yml

# Start services
docker compose up -d

# View logs
docker compose logs -f ai-orchestration-mcp

That's it! The server is now running with Ollama and ready to use with Claude Code.

Option 2: Build from Source

# Clone repository
git clone https://github.com/adakrupp/ai-orchestration-mcp.git
cd ai-orchestration-mcp

# One-command setup
./docker-setup.sh

# View logs
docker compose logs -f ai-orchestration-mcp

πŸ‘‰ See DOCKER.md for complete Docker documentation.

Option 3: Local Installation

# Clone and install
git clone https://github.com/adakrupp/ai-orchestration-mcp.git
cd ai-orchestration-mcp
npm install

# Build
npm run build

# Configure
cp config/ai-orchestration.example.json config/ai-orchestration.json
# Edit config/ai-orchestration.json with your settings

# Test
npm test

πŸ“– Table of Contents

πŸ“¦ Installation

Prerequisites

Installation Methods

docker pull adakrupp/ai-orchestration-mcp:latest

See DOCKER.md for complete Docker deployment guide.

Docker Build from Source

See DOCKER.md for building from source.

NPM Installation

# Install dependencies
npm install

# Install optional peer dependencies (as needed)
npm install openai @anthropic-ai/sdk

# Build TypeScript
npm run build

βš™οΈ Configuration

Configuration File

Create config/ai-orchestration.json:

{
  "version": "1.0",
  "server": {
    "name": "ai-orchestration-mcp",
    "version": "2.0.0",
    "logLevel": "info",
    "historyEnabled": true
  },
  "providers": {
    "ollama": {
      "enabled": true,
      "baseUrl": "http://localhost:11434",
      "models": {
        "coder": "qwen2.5-coder:7b",
        "general": "qwen2.5:7b"
      }
    },
    "openai": {
      "enabled": true,
      "apiKey": "${OPENAI_API_KEY}",
      "defaultModel": "gpt-4o-mini"
    }
  },
  "security": {
    "maxPromptLength": 100000,
    "maxResponseLength": 500000
  }
}

Environment Variables

Create .env file:

OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...

Configuration Discovery

The server searches for configuration in this order:

  1. --config CLI argument

  2. AI_ORCHESTRATION_CONFIG environment variable

  3. ./config/ai-orchestration.json (project directory)

  4. ~/.config/ai-orchestration/config.json (user config)

  5. Built-in defaults

🎯 Usage with Claude Code

Method 1: Docker

Update your .mcp.json:

{
  "mcpServers": {
    "ai-orchestration": {
      "command": "docker",
      "args": ["exec", "-i", "ai-orchestration-mcp", "node", "dist/index.js"]
    }
  }
}

Method 2: Local

{
  "mcpServers": {
    "ai-orchestration": {
      "command": "node",
      "args": ["/absolute/path/to/ai-orchestration-mcp/dist/index.js"]
    }
  }
}

Available Tools

Once configured, Claude Code will have access to these tools:

For each enabled provider:

  • use_<provider>: Send a query to the provider

    use_ollama model="qwen2.5:7b" prompt="Explain async/await in JavaScript"
  • list_<provider>_models: List available models

    list_ollama_models

Example Usage

User: "Use Ollama to explain what a Docker container is"

Claude: I'll use the local Ollama model for this task.
[Calls use_ollama with qwen2.5:7b]

User: "Now use OpenAI to write production-grade documentation for it"

Claude: I'll use OpenAI for the comprehensive documentation.
[Calls use_openai with gpt-4o-mini]

πŸ€– Providers

Ollama (Local Models)

Best for: Simple tasks, code analysis, quick questions

  • βœ… Free (runs locally)

  • βœ… Privacy (data stays local)

  • βœ… Fast (low latency)

  • ❌ Requires local resources

  • ❌ Limited compared to cloud models

Setup:

# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh

# Pull models
ollama pull qwen2.5:7b
ollama pull qwen2.5-coder:7b

OpenAI

Best for: Complex reasoning, production code, detailed analysis

  • βœ… Powerful models (GPT-4, GPT-4o)

  • βœ… Good for coding tasks

  • βœ… Function calling support

  • ❌ Costs per token

  • ❌ Data sent to OpenAI

Setup:

npm install openai

# Add to .env
OPENAI_API_KEY=sk-...

Anthropic (Claude)

Best for: Long context tasks, analysis, complex reasoning

  • βœ… Large context windows (200k tokens)

  • βœ… Strong reasoning capabilities

  • βœ… Good safety guardrails

  • ❌ Costs per token

  • ❌ Data sent to Anthropic

Setup:

npm install @anthropic-ai/sdk

# Add to .env
ANTHROPIC_API_KEY=sk-ant-...

Gemini

Best for: Multimodal tasks, web research, creative writing

  • βœ… Multimodal (text + images)

  • βœ… Free tier available

  • βœ… Fast responses

  • ❌ Less suitable for code

  • ❌ Data sent to Google

Setup:

# Install Gemini CLI
# See: https://github.com/google/gemini-cli

# Add to .env
GEMINI_API_KEY=...

llama.cpp (Local HTTP Server)

Best for: Custom local models, complete privacy

  • βœ… Run any GGUF model

  • βœ… Complete privacy

  • βœ… Customizable

  • ❌ Manual setup required

  • ❌ Resource intensive

Setup:

# Run llama.cpp server
./server -m model.gguf --port 8080

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Claude Code (Client)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ MCP Protocol
               β”‚ (stdio)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   AI Orchestration MCP Server       β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Provider Registry         β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚Ollamaβ”‚ β”‚ OpenAI β”‚ β”‚Anthropic β”‚  β”‚
β”‚  β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚         β”‚           β”‚
      β–Ό         β–Ό           β–Ό
   HTTP API  REST API   REST API

Key Components

  • Server: MCP protocol handler, routes requests to providers

  • Provider Registry: Manages all AI providers

  • Providers: Individual integrations (Ollama, OpenAI, etc.)

  • Config Loader: Loads and validates configuration

  • Logger: Structured logging with sensitive data redaction

  • History Tracker: Records all requests/responses

Security Features

  • βœ… No Shell Injection: Uses HTTP APIs and spawn() without shell

  • βœ… Input Validation: Comprehensive sanitization of all inputs

  • βœ… API Key Redaction: Never logs sensitive credentials

  • βœ… Type Safety: Full TypeScript with strict mode

  • βœ… Rate Limiting: Optional rate limiting per provider

  • βœ… Max Length Limits: Prevents oversized inputs/outputs

πŸ› οΈ Development

Setup Development Environment

# Install dependencies
npm install

# Run in dev mode (with auto-reload)
npm run dev

# Type check
npm run type-check

# Lint
npm run lint

# Format code
npm run format

Testing

# Run all tests
npm test

# Unit tests only
npm run test:unit

# Integration tests
npm run test:int

# Coverage report
npm run test:coverage

Adding a New Provider

  1. Create provider directory:

    src/providers/myprovider/
    β”œβ”€β”€ index.ts      # Provider implementation
    └── client.ts     # API client
  2. Implement BaseProvider:

    export class MyProvider extends BaseProvider {
      readonly name = 'myprovider';
      readonly capabilities = { /* ... */ };
    
      async listModels(): Promise<string[]> { /* ... */ }
      async execute(request: ProviderRequest): Promise<ProviderResponse> { /* ... */ }
      async validateConfig(): Promise<boolean> { /* ... */ }
    }
  3. Register in src/index.ts:

    if (config.providers.myprovider?.enabled) {
      const provider = new MyProvider(config.providers.myprovider);
      registry.register(provider);
    }
  4. Add configuration types in src/types/config.ts

  5. Add tests in tests/unit/providers/myprovider.test.ts

πŸ”’ Security

Reporting Vulnerabilities

Please report security vulnerabilities via GitHub Security Advisories or by opening a private issue.

Security Best Practices

  1. API Keys: Store in environment variables, never commit

  2. Configuration: Use .gitignore to exclude config files

  3. Updates: Keep dependencies up to date (npm audit)

  4. Logs: Review logs for sensitive data exposure

  5. Rate Limiting: Enable for production deployments

Security Audit

# Check for vulnerabilities
npm audit

# Fix vulnerabilities
npm audit fix

🀝 Contributing

Contributions are welcome!

Contribution Guide

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Make your changes

  4. Add tests

  5. Run tests and linting (npm test && npm run lint)

  6. Commit your changes (git commit -m 'Add amazing feature')

  7. Push to the branch (git push origin feature/amazing-feature)

  8. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“š Documentation

πŸ’¬ Support


Made with ❀️ for the AI community

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A unified local API gateway providing caching, rate limiting, and full Model Context Protocol compatibility for AI agent integration. It enables users to aggregate multiple API endpoints into a single gateway with built-in observability and customizable eviction strategies.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A production-ready unified entry point for AI agents that implements the Model Context Protocol (MCP). It provides a secure gateway with rate limiting, authentication, and observability for managing and proxying requests to multiple downstream APIs.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A production-ready Model Context Protocol server built with Python and FastMCP, featuring modular architecture, centralized tool registration, Docker support, and a suite of utility tools for AI applications.
      3
      -