mcp-optimizer
Offers containerized deployment options for the MCP server with both STDIO and SSE transport methods, facilitating easy installation and deployment
Provides integration with GitHub for version control, release management, and issue tracking through automated workflows
Uses GitHub Actions for CI/CD pipeline, automating testing, security scanning, building Docker images, and publishing to PyPI
Integrates with Grafana for visualization of metrics and monitoring data from the MCP server
Supports deployment to Kubernetes environments for production use, with provided configuration files in the k8s directory
Includes monitoring capabilities through Prometheus integration, allowing performance tracking and metrics collection
Publishes the package to PyPI, enabling installation via pip and integration with various Python environments
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-optimizersolve this linear programming problem: maximize 3x + 4y subject to x + y <= 4, x >= 0, y >= 0"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Optimizer
🚀 Mathematical Optimization MCP Server with PuLP and OR-Tools support
📖 Quick Links: 🚀 Quick Start | 🔧 macOS Troubleshooting | 📊 Examples | 🎯 Features
🚀 Quick Start
Recommended Installation Methods (by Priority)
1. 🐳 Docker (Recommended) - Cross-platform
Most stable method with full functionality
# Run with STDIO transport (for MCP clients)
docker run --rm -i ghcr.io/dmitryanchikov/mcp-optimizer:latest
# Run with SSE transport (for remote clients)
docker run -d -p 8000:8000 -e TRANSPORT_MODE=sse \
ghcr.io/dmitryanchikov/mcp-optimizer:latest
# Check SSE endpoint
curl -i http://localhost:8000/sse2. 📦 pip + venv - Cross-platform
Standard approach
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# or .venv\Scripts\activate # Windows
# Install mcp-optimizer
pip install mcp-optimizer
# For SSE issues, use stable dependency versions:
# pip install "mcp-optimizer[stable]"
# Run (STDIO mode recommended)
mcp-optimizer --transport stdio3. 🚀 uvx - Linux/Windows (full), macOS (partially)
# Linux/Windows - works out of the box
uvx mcp-optimizer
# macOS - requires Python 3.12
uvx --python python3.12 mcp-optimizer
# STDIO mode recommended
uvx mcp-optimizer --transport stdiomacOS users: If you encounter OR-Tools related errors, see 🔧 macOS uvx Troubleshooting section for automated fix scripts.
🍎 macOS Specifics
OR-Tools support:
uvx: PuLP only (limited functionality)
pip: full OR-Tools support
Docker: full OR-Tools support
For full OR-Tools support via pip:
# Install OR-Tools via Homebrew
brew install or-tools
# Then install mcp-optimizer
pip install "mcp-optimizer[stable]"Transport Mode Recommendations
Installation Method | Recommended Transport | Why |
Docker | SSE | Full stability |
pip + venv | STDIO | Avoids dependency issues with newer versions |
uvx | STDIO | Maximum compatibility |
Integration with LLM Clients
Claude Desktop Integration
Option 1: Using Docker (Recommended)
Install Claude Desktop from claude.ai
Pull the Docker image:
docker pull ghcr.io/dmitryanchikov/mcp-optimizer:latestAdd to your
claude_desktop_config.json:
{
"mcpServers": {
"mcp-optimizer": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"ghcr.io/dmitryanchikov/mcp-optimizer:latest",
"python", "main.py"
]
}
}
}Restart Claude Desktop and look for the 🔨 tools icon
Option 2: Using pip + venv
# Create virtual environment and install
python -m venv .venv
source .venv/bin/activate # Linux/macOS
pip install mcp-optimizerThen add to your Claude Desktop config:
{
"mcpServers": {
"mcp-optimizer": {
"command": "mcp-optimizer"
}
}
}Option 3: Using uvx
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-optimizer": {
"command": "uvx",
"args": ["mcp-optimizer"]
}
}
}Note: On macOS, uvx provides limited functionality (PuLP solver only) or see 🔧 macOS uvx Troubleshooting
Advanced Docker Setup (for remote MCP clients)
# Run SSE server on port 8000 (uses environment variable)
docker run -d -p 8000:8000 -e TRANSPORT_MODE=sse \
ghcr.io/dmitryanchikov/mcp-optimizer:latest
# Or with CLI argument and custom port
docker run -d -p 9000:9000 ghcr.io/dmitryanchikov/mcp-optimizer:latest \
python -m mcp_optimizer.main --transport sse --host 0.0.0.0 --port 9000
# Check server status
docker logs <container-name>
# Verify SSE endpoint (should show event stream)
curl -i http://localhost:8000/sseSSE Endpoint: http://localhost:8000/sse (Server-Sent Events for MCP communication)
Cursor Integration
Install the MCP extension in Cursor
Add mcp-optimizer to your workspace settings (Docker recommended):
{
"mcp.servers": {
"mcp-optimizer": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"ghcr.io/dmitryanchikov/mcp-optimizer:latest",
"python", "main.py"
]
}
}
}Alternative configurations:
// Using pip installation
{
"mcp.servers": {
"mcp-optimizer": {
"command": "mcp-optimizer"
}
}
}
// Using uvx (limited functionality on macOS)
{
"mcp.servers": {
"mcp-optimizer": {
"command": "uvx",
"args": ["mcp-optimizer"]
}
}
}Other LLM Clients
For other MCP-compatible clients (Continue, Cody, etc.), use similar configuration patterns. Recommended priority:
Docker (maximum stability across platforms)
pip + venv (standard Python approach)
uvx (quick testing, limited on macOS)
Advanced Installation Options
Local Development
# Clone the repository
git clone https://github.com/dmitryanchikov/mcp-optimizer.git
cd mcp-optimizer
# Install dependencies with uv
uv sync --extra dev
# Run the server
uv run python main.pyLocal Package Build and Run
For testing and development, you can build the package locally and run it with uvx:
# Build the package locally
uv build
# Run with uvx from local wheel file
uvx --from ./dist/mcp_optimizer-0.3.9-py3-none-any.whl mcp-optimizer
# Or run with help to see available options
uvx --from ./dist/mcp_optimizer-0.3.9-py3-none-any.whl mcp-optimizer --help
# Test the local package with a simple MCP message
echo '{"jsonrpc": "2.0", "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}, "id": 1}' | uvx --from ./dist/mcp_optimizer-0.3.9-py3-none-any.whl mcp-optimizerNote: The local build creates both wheel (.whl) and source distribution (.tar.gz) files in the dist/ directory. The wheel file is recommended for uvx installation as it's faster and doesn't require compilation.
Docker with Custom Configuration
# Build locally with optimization
git clone https://github.com/dmitryanchikov/mcp-optimizer.git
cd mcp-optimizer
docker build -t mcp-optimizer:optimized .
docker run -p 8000:8000 mcp-optimizer:optimized
# Check optimized image size (398MB vs 1.03GB original - 61% reduction!)
docker images mcp-optimizer:optimized
# Test the optimized image
./scripts/test_docker_optimization.shStandalone Server Commands
# Run directly with uvx (no installation needed)
uvx mcp-optimizer
# Or run specific commands
uvx mcp-optimizer --help
# With pip installation
mcp-optimizer
# Or run with Python module (use main.py for stdio mode)
python main.pyTransport Modes
MCP Optimizer supports two MCP transport protocols:
STDIO: Standard input/output for direct MCP client integration (Claude Desktop, Cursor, etc.)
SSE: Server-Sent Events over HTTP for web-based MCP clients and remote integrations
STDIO Transport (Default - for MCP clients like Claude Desktop)
# Default STDIO mode for MCP protocol
uvx mcp-optimizer
# or
uvx mcp-optimizer --transport stdio
# or
uv run python -m mcp_optimizer.main --transport stdio
# or
python main.pySSE Transport (for remote MCP clients)
# SSE mode for remote MCP clients (default port 8000)
uvx mcp-optimizer --transport sse
# or
uv run python -m mcp_optimizer.main --transport sse
# Custom host and port
uvx mcp-optimizer --transport sse --host 0.0.0.0 --port 9000
# or
uv run python -m mcp_optimizer.main --transport sse --host 0.0.0.0 --port 9000
# With debug mode
uvx mcp-optimizer --transport sse --debug --log-level DEBUGAvailable CLI Options
# Show all available options
uvx mcp-optimizer --help
# Options:
# --transport {stdio,sse} MCP transport protocol (default: stdio)
# --port PORT Port for SSE transport (default: 8000)
# --host HOST Host for SSE transport (default: 127.0.0.1)
# --debug Enable debug mode
# --reload Enable auto-reload for development
# --log-level {DEBUG,INFO,WARNING,ERROR} Logging level (default: INFO)
#
# Environment Variables:
# TRANSPORT_MODE={stdio,sse} Override transport mode
# SERVER_HOST=0.0.0.0 Override server host
# SERVER_PORT=8000 Override server portRelated MCP server: Google OR-Tools server
🔧 Platform Compatibility & Troubleshooting
macOS Compatibility
✅ Full Functionality:
Homebrew + pip:
brew install or-tools && pip install mcp-optimizerVirtual environments:
python -m venv venv && source venv/bin/activate && pip install ortools mcp-optimizerDocker: Full OR-Tools support in containers
⚠️ Limited Functionality:
uvx (isolated environments): Only PuLP solver available due to OR-Tools native library paths
Fallback behavior: Automatically switches to PuLP when OR-Tools unavailable
Common Issues & Solutions:
OR-Tools "Library not loaded" error:
# Solution: Install via Homebrew brew install or-tools # Then use regular pip/venv instead of uvxuvx shows OR-Tools warnings:
WARNING: OR-Tools not available: No module named 'ortools'This is expected - uvx provides fallback functionality with PuLP solver.
Best practices for macOS:
Use Docker for production deployments
Use Homebrew + pip for development
Use uvx for quick testing (limited functionality)
Linux/Windows Compatibility
✅ Full Functionality:
uvx: Works out of the box with OR-Tools
pip: Standard installation
Docker: Recommended for production
Solver Availability by Platform
Platform | uvx | pip | Docker |
macOS | PuLP only | ✅ Full | ✅ Full |
Linux | ✅ Full | ✅ Full | ✅ Full |
Windows | ✅ Full | ✅ Full | ✅ Full |
Solver Features:
OR-Tools: Advanced algorithms (CP-SAT, routing, scheduling)
PuLP: Basic linear programming, reliable fallback
🔧 macOS uvx Troubleshooting
Problem: OR-Tools Library Issues with uvx
Common Error Messages:
Library not loaded: /Users/corentinl/work/stable/temp_python3.13/lib/libscip.9.2.dylib
ImportError: No module named 'ortools'
WARNING: OR-Tools not availableRoot Cause: OR-Tools binary wheels contain hardcoded library paths that fail in uvx isolated environments. This is a macOS-specific issue due to how uvx isolates dependencies.
📊 Functionality Impact by Installation Method
✅ Available with uvx + fallback (PuLP solver only):
Linear Programming - Basic optimization, simplex method
Financial Optimization - Portfolio optimization, risk management
Production Planning - Resource allocation, inventory management
❌ Lost with uvx (requires OR-Tools):
Assignment Problems - Hungarian algorithm, transportation problems
Integer Programming - Mixed-integer, binary programming (SCIP/CBC)
Knapsack Problems - Discrete optimization, multiple variants
Vehicle Routing - TSP, CVRP, time windows (constraint programming)
Job Scheduling - CP-SAT solver, resource planning
🛠️ Solutions (in order of preference)
1. Automated Fix Script (Recommended)
# Smart adaptive script - no hardcoded versions!
# Automatically detects your system libraries and Python versions
./scripts/fix_macos_uvx.sh
# Then uvx works with full functionality
uvx mcp-optimizer --transport stdio2. Manual Fix
# Install system dependencies
brew install or-tools scip
# Create symlink for hardcoded path
sudo mkdir -p /Users/corentinl/work/stable/temp_python3.13/lib/
sudo ln -sf /opt/homebrew/lib/libscip.9.2.dylib /Users/corentinl/work/stable/temp_python3.13/lib/libscip.9.2.dylib
# Test fix
uvx mcp-optimizer --help3. Use pip (Always Works)
# Install dependencies first
brew install or-tools
# Install package
pip install mcp-optimizer
mcp-optimizer4. Use Docker (Production Ready)
docker run -p 8000:8000 mcp-optimizer🎯 Features
Supported Optimization Problem Types:
Linear Programming - Maximize/minimize linear objective functions
Assignment Problems - Optimal resource allocation using Hungarian algorithm
Transportation Problems - Logistics and supply chain optimization
Knapsack Problems - Optimal item selection (0-1, bounded, unbounded)
Routing Problems - TSP and VRP with time windows
Scheduling Problems - Job and shift scheduling
Integer Programming - Discrete optimization problems
Financial Optimization - Portfolio optimization and risk management
Production Planning - Multi-period production planning
Testing
Automated Test Scripts
Quick Testing:
# Test local package build and functionality
./scripts/test_local_package.sh
# Test Docker container build and functionality
./scripts/test_docker_container.sh
# Run comprehensive test suite (both package and Docker)
./scripts/test_all.sh
# Run only specific tests
./scripts/test_all.sh --skip-docker # Skip Docker tests
./scripts/test_all.sh --skip-package # Skip package testsManual Testing:
# Run simple functionality tests
uv run python tests/test_integration/comprehensive_test.py
# Run comprehensive integration tests
uv run python tests/test_integration/comprehensive_test.py
# Run all unit tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=src/mcp_optimizer --cov-report=htmlTest Scripts Features:
✅ Local Package Testing: Build, STDIO/SSE modes, CLI functionality
✅ Docker Container Testing: Image build, environment variables, health checks
✅ Comprehensive Suite: Parallel execution with detailed reporting
✅ Automatic Cleanup: Processes and containers cleaned up after tests
✅ Cross-Platform: Works on macOS, Linux (requires Docker for container tests)
Requirements:
For local tests:
uv,curl,lsof,gtimeout/timeoutFor Docker tests:
docker+ local requirementsmacOS:
brew install coreutils(for gtimeout)
CI/CD Integration:
# GitHub Actions example
- name: Test Package
run: ./scripts/test_local_package.sh
- name: Test Docker
run: ./scripts/test_docker_container.sh📊 Usage Examples
Linear Programming
from mcp_optimizer.tools.linear_programming import solve_linear_program
# Maximize 3x + 2y subject to:
# x + y <= 4
# 2x + y <= 6
# x, y >= 0
objective = {"sense": "maximize", "coefficients": {"x": 3, "y": 2}}
variables = {
"x": {"type": "continuous", "lower": 0},
"y": {"type": "continuous", "lower": 0}
}
constraints = [
{"expression": {"x": 1, "y": 1}, "operator": "<=", "rhs": 4},
{"expression": {"x": 2, "y": 1}, "operator": "<=", "rhs": 6}
]
result = solve_linear_program(objective, variables, constraints)
# Result: x=2.0, y=2.0, objective=10.0Assignment Problem
from mcp_optimizer.tools.assignment import solve_assignment_problem
workers = ["Alice", "Bob", "Charlie"]
tasks = ["Task1", "Task2", "Task3"]
costs = [
[4, 1, 3], # Alice's costs for each task
[2, 0, 5], # Bob's costs for each task
[3, 2, 2] # Charlie's costs for each task
]
result = solve_assignment_problem(workers, tasks, costs)
# Result: Total cost = 5.0 with optimal assignmentsKnapsack Problem
from mcp_optimizer.tools.knapsack import solve_knapsack_problem
items = [
{"name": "Item1", "weight": 10, "value": 60},
{"name": "Item2", "weight": 20, "value": 100},
{"name": "Item3", "weight": 30, "value": 120}
]
result = solve_knapsack_problem(items, capacity=50)
# Result: Total value = 220.0 with optimal item selectionPortfolio Optimization
from mcp_optimizer.tools.financial import optimize_portfolio
assets = [
{"name": "Stock A", "expected_return": 0.12, "risk": 0.18},
{"name": "Stock B", "expected_return": 0.10, "risk": 0.15},
{"name": "Bond C", "expected_return": 0.06, "risk": 0.08}
]
result = optimize_portfolio(
assets=assets,
objective="minimize_risk",
budget=10000,
risk_tolerance=0.15
)
# Result: Optimal portfolio allocation with minimized risk🏗️ Architecture
mcp-optimizer/
├── LICENSE # MIT License
├── README.md # Project documentation
├── CHANGELOG.md # Release notes
├── CONTRIBUTING.md # Contribution guidelines
├── pyproject.toml # Python project configuration
├── uv.lock # Dependency lock file
├── main.py # Entry point
├── Dockerfile # Main Docker configuration
├── docker-compose.yml # Multi-service setup
├── .dockerignore # Docker ignore rules
├── .gitignore # Git ignore rules
├── .python-version # Python version specification
├── src/mcp_optimizer/ # Main source code
│ ├── __init__.py
│ ├── __main__.py # Module entry point
│ ├── main.py # Application entry point
│ ├── mcp_server.py # MCP server implementation
│ ├── config.py # Configuration management
│ ├── tools/ # 9 categories of optimization tools
│ │ ├── linear_programming.py
│ │ ├── assignment.py
│ │ ├── knapsack.py
│ │ ├── routing.py
│ │ ├── scheduling.py
│ │ ├── financial.py
│ │ └── production.py
│ ├── solvers/ # PuLP and OR-Tools integration
│ │ ├── pulp_solver.py
│ │ └── ortools_solver.py
│ ├── schemas/ # Pydantic validation schemas
│ └── utils/ # Utility functions
├── tests/ # Comprehensive test suite
│ ├── test_tools/ # Tool-specific tests
│ ├── test_solvers/ # Solver tests
│ └── test_integration/ # Integration tests
├── scripts/ # Automation scripts
├── examples/ # Usage examples and prompts
│ ├── en/ # English examples
│ └── ru/ # Russian examples
├── k8s/ # Kubernetes deployment manifests
└── monitoring/ # Grafana/Prometheus setup
└── grafana/
└── datasources/🧪 Test Results
✅ Comprehensive Test Suite
🧪 Starting Comprehensive MCP Optimizer Tests
==================================================
✅ Server Health PASSED
✅ Linear Programming PASSED
✅ Assignment Problems PASSED
✅ Knapsack Problems PASSED
✅ Routing Problems PASSED
✅ Scheduling Problems PASSED
✅ Financial Optimization PASSED
✅ Production Planning PASSED
✅ Performance Test PASSED
📊 Test Results: 9 passed, 0 failed
🎉 All tests passed! MCP Optimizer is ready for production!✅ Unit Tests
66 tests passed, 9 skipped
Execution time: 0.45 seconds
All core components functional
📈 Performance Metrics
Linear Programming: ~0.01s
Assignment Problems: ~0.01s
Knapsack Problems: ~0.01s
Complex test suite: 0.02s for 3 optimization problems
Overall performance: 🚀 Excellent!
🔧 Technical Details
Core Solvers
OR-Tools: For assignment, transportation, knapsack problems
PuLP: For linear/integer programming
FastMCP: For MCP server integration
Supported Solvers
CBC, GLPK, GUROBI, CPLEX (via PuLP)
SCIP, CP-SAT (via OR-Tools)
Key Features
✅ Full MCP protocol integration
✅ Comprehensive input validation
✅ Robust error handling
✅ High-performance optimization
✅ Production-ready architecture
✅ Extensive test coverage
✅ Docker and Kubernetes support
📋 Requirements
Python 3.11+
uv (for dependency management)
OR-Tools (automatically installed)
PuLP (automatically installed)
🚀 Production Deployment
Docker
# Build image
docker build -t mcp-optimizer .
# Run container
docker run -p 8000:8000 mcp-optimizerKubernetes
# Deploy to Kubernetes
kubectl apply -f k8s/Monitoring
# Start monitoring stack
docker-compose up -d🎯 Project Status
✅ PRODUCTION READY 🚀
All core optimization tools implemented and tested
MCP server fully functional
Comprehensive test coverage (66 unit tests + 9 integration tests)
OR-Tools integration confirmed working
Performance optimized (< 30s for complex test suites)
Ready for production deployment
📖 Usage Examples
The examples/ directory contains practical examples and prompts for using MCP Optimizer with Large Language Models (LLMs):
Available Examples
📊 Linear Programming (RU | EN)
Production optimization, diet planning, transportation, blending problems
👥 Assignment Problems (RU | EN)
Employee-project assignment, machine-order allocation, task distribution
💰 Portfolio Optimization (RU | EN)
Investment portfolios, retirement planning, risk management
How to Use Examples
For LLM Integration: Copy the prompt text and provide it to your LLM with MCP Optimizer access
For Direct API Usage: Use the provided API structures directly with MCP Optimizer functions
For Learning: Understand different optimization problem types and formulations
Each example includes:
Problem descriptions and real-world scenarios
Ready-to-use prompts for LLMs
Technical API structures
Common activation phrases
Practical applications
🔄 Recent Updates
Latest Release Features:
Function Exports - Added exportable functions to all tool modules:
solve_linear_program()in linear_programming.pysolve_assignment_problem()in assignment.pysolve_knapsack_problem()in knapsack.pyoptimize_portfolio()in financial.pyoptimize_production()in production.py
Enhanced Testing - Updated comprehensive test suite with correct function signatures
OR-Tools Integration - Confirmed full functionality of all OR-Tools components
🚀 Fully Automated Release Process
New Simplified Git Flow (3 steps!)
The project uses a fully automated release process:
1. Create Release Branch
# For minor release (auto-increment)
uv run python scripts/release.py --type minor
# For specific version
uv run python scripts/release.py 0.2.0
# For hotfix
uv run python scripts/release.py --hotfix --type patch
# Preview changes
uv run python scripts/release.py --type minor --dry-run2. Create PR to main
# Create PR: release/v0.3.0 → main
gh pr create --base main --head release/v0.3.0 --title "Release v0.3.0"3. Merge PR - DONE! 🎉
After PR merge, automatically happens:
✅ Create tag v0.3.0
✅ Publish to PyPI
✅ Publish Docker images
✅ Create GitHub Release
✅ Merge main back to develop
✅ Cleanup release branch
NO NEED to run manual_finalize_release.py manually anymore!
🔒 Secure Detection: Uses hybrid approach combining GitHub branch protection with automated release detection. See Release Process for details.
Automated Release Pipeline
The CI/CD pipeline automatically handles:
✅ Release Candidates: Built from
release/*branches✅ Production Releases: Triggered by version tags on
main✅ PyPI Publishing: Automatic on tag creation
✅ Docker Images: Multi-architecture builds
✅ GitHub Releases: With artifacts and release notes
CI/CD Pipeline
The GitHub Actions workflow automatically:
✅ Runs tests on Python 3.11 and 3.12
✅ Performs security scanning
✅ Builds and pushes Docker images
✅ Publishes to PyPI on tag creation
✅ Creates GitHub releases
Requirements for PyPI Publication
Set
PYPI_API_TOKENsecret in GitHub repositoryEnsure all tests pass
Follow semantic versioning
🛠️ Development Tools
Debug Tools
Use the debug script to inspect MCP server structure:
# Run debug tools to check server structure
uv run python scripts/debug_tools.py
# This will show:
# - Available MCP tools
# - Tool types and attributes
# - Server configurationComprehensive Testing
Run the full integration test suite:
# Run comprehensive tests
uv run python tests/test_integration/comprehensive_test.py
# This tests:
# - All optimization tools (9 categories)
# - Server health and functionality
# - Performance benchmarks
# - End-to-end workflowsDocker Build Instructions
Image Details
Base: Python 3.12 Slim (Debian-based)
Size: ~649MB (optimized with multi-stage builds)
Architecture: Multi-platform support (x86_64, ARM64)
Security: Non-root user, minimal dependencies
Performance: Optimized Python bytecode, cleaned build artifacts
Local Build Commands
# Standard build
docker build -t mcp-optimizer:latest .
# Build with development dependencies
docker build --build-arg ENV=development -t mcp-optimizer:dev .
# Build with cache mount for faster rebuilds
docker build --mount=type=cache,target=/build/.uv -t mcp-optimizer .
# Check image size
docker images mcp-optimizer
# Run container
docker run -p 8000:8000 mcp-optimizer:latest
# For development with volume mounting
docker run -p 8000:8000 -v $(pwd):/app mcp-optimizer:latest
# Test container functionality
docker run --rm mcp-optimizer:latest python -c "from mcp_optimizer.mcp_server import create_mcp_server; print('✅ MCP Optimizer works!')"🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Git Flow Policy
This project follows a standard Git Flow workflow:
Feature branches →
developbranchRelease branches →
mainbranchHotfix branches →
mainanddevelopbranches
📚 Documentation:
Contributing Guide - Complete development workflow and Git Flow policy
Release Process - How releases are created and automated
Repository Setup - Complete setup guide including branch protection and security configuration
Development Setup
# Clone and setup
git clone https://github.com/dmitryanchikov/mcp-optimizer.git
cd mcp-optimizer
# Create feature branch from develop
git checkout develop
git checkout -b feature/your-feature-name
# Install dependencies
uv sync --extra dev
# Run tests
uv run pytest tests/ -v
# Run linting
uv run ruff check src/
uv run mypy src/
# Create PR to develop branch (not main!)📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
OR-Tools - Google's optimization tools
PuLP - Linear programming in Python
FastMCP - Fast MCP server implementation
📞 Support
📧 Email: support@mcp-optimizer.com
🐛 Issues: GitHub Issues
📖 Documentation: docs/
Made with ❤️ for the optimization community
📊 Docker Image Size Analysis
The MCP Optimizer Docker image has been optimized to balance functionality and size:
Component | Size | % of Total | Description |
Python packages (/venv) | 237.0 MB | 42.8% | Virtual environment with dependencies |
System libraries (/usr) | 173.2 MB | 31.3% | Base Debian system + Python |
Other | 137.4 MB | 24.8% | Base image, filesystem |
Configuration (/var, /etc) | 6.2 MB | 1.1% | System settings |
Application code (/code) | 0.2 MB | 0.04% | MCP Optimizer source code |
Key Dependencies by Size
OR-Tools: 75.0 MB (27.8% of venv) - Critical optimization solver (requires pandas + numpy)
pandas: 45.0 MB (16.7% of venv) - Required by OR-Tools for data operations
NumPy: 24.0 MB (8.9% of venv) - Required by OR-Tools for numerical computing
PuLP: 34.9 MB (12.9% of venv) - Linear programming solver
FastMCP: 15.2 MB (5.6% of venv) - MCP server framework
Pydantic: 12.8 MB (4.7% of venv) - Data validation
Dependencies Analysis
Core packages cannot be reduced further: OR-Tools (our main optimization engine) requires both pandas and numpy as mandatory dependencies
Optional examples moved: Additional packages for examples (streamlit, plotly) moved to
[examples]extraMinimal core impact: Moving examples to optional dependencies only affects development/demo usage
Image Optimization
Current optimized size: ~420MB
Core functionality: Includes all necessary dependencies for production optimization
Example support: Install with
[examples]extra for additional demo functionalityOR-Tools constraint: Cannot remove pandas/numpy due to hard dependency requirements
Available Tools
13 toolsoptimize_portfolio_toolA
Optimize portfolio allocation to maximize return or minimize risk.
Args:
assets: List of asset dictionaries with expected return, risk, and sector
objective: Optimization objective ("maximize_return", "minimize_risk", "maximize_sharpe", "risk_parity")
budget: Total budget to allocate (default: 1.0)
risk_tolerance: Maximum acceptable portfolio risk (optional)
sector_constraints: Maximum allocation per sector (optional)
min_allocation: Minimum allocation per asset (default: 0.0)
max_allocation: Maximum allocation per asset (default: 1.0)
solver_name: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal portfolio allocation
| Name | Required | Description | Default |
|---|---|---|---|
| assets | Yes | ||
| objective | No | maximize_return | |
| budget | No | ||
| risk_tolerance | No | ||
| sector_constraints | No | ||
| min_allocation | No | ||
| max_allocation | No | ||
| solver_name | No | CBC | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are absent, so the description must carry the burden of behavioral disclosure. However, it only states that the tool performs optimization and returns a result, without mentioning permissions, side effects (e.g., data mutations), or computational constraints beyond the time limit parameter.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured with an Args/Returns format, covering all parameters with defaults and brief explanations. Every sentence adds value, and there is no redundant or irrelevant text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description thoroughly documents the 9 input parameters but provides minimal detail on the output ('Optimization result with optimal portfolio allocation'). With no output schema, more return value specificity (e.g., fields like weights, performance metrics) would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite 0% schema description coverage, the tool's description provides detailed explanations for each parameter (e.g., 'assets: List of asset dictionaries with expected return, risk, and sector'), adding crucial meaning beyond the raw schema types. This fully compensates for the missing schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Optimize portfolio allocation to maximize return or minimize risk,' specifying a concrete action and resource. It distinguishes itself from sibling tools (e.g., production planning, scheduling) by focusing on portfolio optimization.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description does not mention when-not-to-use or suggest other tools from the sibling list, leaving the agent to infer from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
optimize_production_plan_toolA
Optimize multi-period production planning to maximize profit or minimize costs.
Args:
products: List of product dictionaries with costs and resource requirements
resources: List of resource dictionaries with capacity constraints
periods: Number of planning periods
demand: List of demand requirements per product per period
objective: Optimization objective ("maximize_profit", "minimize_cost", "minimize_time")
inventory_costs: Optional inventory holding costs per product
setup_costs: Optional setup costs per product
solver_name: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal production plan
| Name | Required | Description | Default |
|---|---|---|---|
| products | Yes | ||
| resources | Yes | ||
| periods | Yes | ||
| demand | Yes | ||
| objective | No | maximize_profit | |
| inventory_costs | No | ||
| setup_costs | No | ||
| solver_name | No | CBC | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It does not disclose whether the tool is read-only, destructive, requires authentication, or has side effects. The return value is vaguely described without detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, front-loaded with purpose, and lists parameters efficiently. However, it could be more structured with clearer separation of purpose and usage.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity and lack of output schema/annotations, the description provides parameter explanations but lacks detailed return format or examples. It feels incomplete for an AI agent to fully understand the result.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite 0% schema description coverage, the description's Args section adds meaning to each parameter, e.g., 'products: List of product dictionaries with costs and resource requirements.' This compensates well for the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool optimizes multi-period production planning to maximize profit or minimize costs. This specific verb and resource distinguish it from sibling optimization tools that solve other types of problems.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for production planning but does not explicitly state when to use it versus alternatives like solve_linear_program_tool. No exclusions or context are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_assignment_problem_toolA
Solve assignment problem using OR-Tools Hungarian algorithm.
Args:
workers: List of worker names
tasks: List of task names
costs: 2D cost matrix where costs[i][j] is cost of assigning worker i to task j
maximize: Whether to maximize instead of minimize (default: False)
max_tasks_per_worker: Maximum tasks per worker (optional)
min_tasks_per_worker: Minimum tasks per worker (optional)
Returns:
Dictionary with solution status, assignments, total cost, and execution time
| Name | Required | Description | Default |
|---|---|---|---|
| workers | Yes | ||
| tasks | Yes | ||
| costs | Yes | ||
| maximize | No | ||
| max_tasks_per_worker | No | ||
| min_tasks_per_worker | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description explains the tool solves the assignment problem and returns a dictionary with solution details. However, it does not disclose behavior for infeasible problems, error handling, or edge cases. Without annotations, the burden is higher, but the description provides basic transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured in a docstring format with Args and Returns sections. Every sentence adds value, no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity and lack of output schema or annotations, the description is fairly complete: it details all parameters, algorithm, and return format. Missing edge cases or limitation details, but sufficient for a solver tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates by explaining each parameter: workers and tasks are lists, costs is a 2D matrix, and optional constraints are described. This adds significant meaning beyond the schema titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool solves assignment problems using OR-Tools Hungarian algorithm. It specifies the exact problem type, differentiating it from sibling optimization tools that handle other problems like knapsack or TSP.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not explicitly guide when to use this tool vs alternatives. While the purpose is clear, there is no mention of scenarios where this tool is preferable or not, leaving the agent to infer based on the problem name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_employee_shift_schedulingB
Solve Employee Shift Scheduling to assign employees to shifts optimally.
Args:
employees: List of employee names
shifts: List of shift dictionaries with time and requirements
days: Number of days to schedule
employee_constraints: Optional constraints and preferences per employee
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with employee schedules and coverage statistics
| Name | Required | Description | Default |
|---|---|---|---|
| employees | Yes | ||
| shifts | Yes | ||
| days | Yes | ||
| employee_constraints | No | ||
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description should disclose behavioral traits. It mentions optimality and a time limit default of 30 seconds, but does not explain the optimization method, constraints impact, side effects, or computational complexity. The behavior is vaguely described.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured as a docstring with Args and Returns sections, which is readable. However, it could be more concise by removing redundancy (e.g., repeats 'Optional' in the default value comment). Overall adequate but not exemplary.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and 5 parameters with 0% coverage, the description should cover more. It mentions return value vaguely ('Optimization result with employee schedules and coverage statistics') and does not explain constraint details or error handling. The description is insufficient for full understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must add meaning. It lists parameters with brief explanations (e.g., 'List of employee names', 'List of shift dictionaries with time and requirements'), but lacks details on expected keys for shifts or the format of employee_constraints. It adds some value beyond the schema but is incomplete.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it solves employee shift scheduling to assign employees to shifts optimally. This distinguishes it from sibling tools like solve_job_shop_scheduling or solve_vehicle_routing_problem, which address different scheduling problems.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives such as solve_assignment_problem_tool or solve_job_shop_scheduling. It does not mention prerequisites, limitations, or scenarios where this tool is preferred.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_integer_program_toolA
Solve an integer or mixed-integer programming problem using PuLP.
This tool solves optimization problems where some or all variables must
take integer values, which is useful for discrete decision problems.
Use cases:
- Facility location: Decide where to build warehouses or service centers
- Project selection: Choose which projects to fund (binary decisions)
- Crew scheduling: Assign integer numbers of staff to shifts
- Network design: Design networks with discrete components
- Cutting stock: Minimize waste when cutting materials
- Capital budgeting: Select investments when partial investments aren't allowed
Args:
objective: Objective function with 'sense' and 'coefficients'
variables: Variable definitions with types "continuous", "integer", or "binary"
constraints: List of linear constraints
solver: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum time to spend solving (optional)
Returns:
Optimization result with integer/binary variable values
Example:
# Binary knapsack: select items to maximize value within weight limit
solve_integer_program(
objective={"sense": "maximize", "coefficients": {"item1": 10, "item2": 15}},
variables={
"item1": {"type": "binary"},
"item2": {"type": "binary"}
},
constraints=[
{"expression": {"item1": 5, "item2": 8}, "operator": "<=", "rhs": 10}
]
)
| Name | Required | Description | Default |
|---|---|---|---|
| objective | Yes | ||
| variables | Yes | ||
| constraints | Yes | ||
| solver | No | CBC | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must fully convey behavior. It does not mention side effects, read-only status, or resource usage. The description only notes the optimization method and return type, leaving behavioral traits unclear.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a purpose statement, use cases, args, returns, and example. It is comprehensive but somewhat verbose; every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
All input parameters are explained, and an example is provided. However, there is no output schema, and the return description ('Optimization result with integer/binary variable values') lacks detail on fields like status or objective value.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description compensates fully with an 'Args' section explaining each parameter (e.g., objective has 'sense' and 'coefficients', variables have types). It adds meaning beyond the schema fields.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it solves integer/mixed-integer programming problems using PuLP, with explicit use cases like facility location and project selection. It distinguishes itself from sibling tools like solve_linear_program_tool by specifying the integer variable constraint.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear use cases and explains the tool's purpose for discrete decision problems. However, it lacks explicit guidance on when not to use it or alternatives for continuous optimization.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_job_shop_schedulingB
Solve Job Shop Scheduling Problem to optimize machine utilization and completion times.
Args:
jobs: List of job dictionaries with tasks and constraints
machines: List of available machine names
horizon: Maximum time horizon for scheduling
objective: Optimization objective ("makespan" or "total_completion_time")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with job schedule and machine assignments
| Name | Required | Description | Default |
|---|---|---|---|
| jobs | Yes | ||
| machines | Yes | ||
| horizon | Yes | ||
| objective | No | makespan | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden. It only states the return type ('Optimization result with job schedule and machine assignments') but does not disclose side effects, state modifications, error behavior, or what happens if no solution is found.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a one-sentence purpose, then an Args list, and a Returns line. It is concise without redundancy, though the Args descriptions could be slightly more compact.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of job shop scheduling, the description lacks detail on job dictionary structure, constraint representation, and the exact return value format. No output schema is provided, so the description is insufficient for a complete understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates by explaining each parameter: jobs as 'list of job dictionaries with tasks and constraints', machines as 'list of available machine names', etc. This adds meaning beyond the bare schema types and defaults, though the structure of job dictionaries remains underspecified.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool solves the Job Shop Scheduling Problem to optimize machine utilization and completion times. It uses a specific verb+resource and distinguishes from sibling optimization tools (e.g., linear programming, traveling salesman) by naming a distinct problem type.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool over alternatives or when not to use it. The description only implies usage for job shop scheduling but does not provide explicit when/when-not criteria or mention other tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_knapsack_problem_toolA
Solve knapsack optimization problems using OR-Tools.
This tool solves knapsack problems where items need to be selected
to maximize value while staying within capacity constraints.
Use cases:
- Cargo loading: Optimize loading of trucks, ships, or planes by weight and volume
- Portfolio selection: Choose optimal set of investments within budget constraints
- Resource allocation: Select projects or activities with limited budget or resources
- Advertising planning: Choose optimal mix of advertising channels within budget
- Menu planning: Select dishes for a restaurant menu considering costs and popularity
- Inventory optimization: Decide which products to stock in limited warehouse space
Args:
items: List of items, each with 'name', 'value', 'weight', and optionally 'volume', 'quantity'
capacity: Weight capacity constraint
volume_capacity: Volume capacity constraint (optional)
knapsack_type: Type of knapsack problem ('0-1', 'bounded', 'unbounded')
max_items_per_type: Maximum items per type for bounded knapsack
Returns:
Knapsack result with total value and selected items
Example:
# Select items to maximize value within weight limit
solve_knapsack_problem(
items=[
{"name": "Item1", "value": 10, "weight": 5, "volume": 2},
{"name": "Item2", "value": 15, "weight": 8, "volume": 3},
{"name": "Item3", "value": 8, "weight": 3, "volume": 1}
],
capacity=10,
volume_capacity=5
)
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | ||
| capacity | Yes | ||
| volume_capacity | No | ||
| knapsack_type | No | 0-1 | |
| max_items_per_type | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It states the tool solves knapsack problems maximizes value within capacity, but does not disclose potential side effects, time complexity, or permissions. It is adequate but not detailed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a summary, use cases, args, returns, and example. It is slightly lengthy but every section serves a purpose. The key information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (knapsack with multiple types and constraints) and the absence of an output schema, the description covers input parameters, provides a return description, and includes an example. Missing default values for knapsack_type, but overall complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite schema description coverage of 0%, the description thoroughly explains each parameter in the 'Args' section, including types and constraints (e.g., 'items' list with fields, 'knapsack_type' options). It adds significant meaning beyond the bare schema titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool solves knapsack optimization problems using OR-Tools. It lists specific use cases like cargo loading and portfolio selection, distinguishing it from sibling tools that handle other optimization problems.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a list of use cases (cargo loading, portfolio selection, etc.) that imply when to use this tool. However, it does not explicitly state when not to use it or compare it to alternatives, which would strengthen guidelines.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_linear_program_toolA
Solve a linear programming problem using PuLP.
This tool solves general linear programming problems where you want to
optimize a linear objective function subject to linear constraints.
Use cases:
- Resource allocation: Distribute limited resources optimally
- Diet planning: Create nutritionally balanced meal plans within budget
- Manufacturing mix: Determine optimal product mix to maximize profit
- Investment planning: Allocate capital across different investment options
- Supply chain optimization: Minimize transportation and storage costs
- Energy optimization: Optimize power generation and distribution
Args:
objective: Objective function with 'sense' ("minimize" or "maximize")
and 'coefficients' (dict mapping variable names to coefficients)
variables: Variable definitions mapping variable names to their properties
(type: "continuous"/"integer"/"binary", lower: bound, upper: bound)
constraints: List of constraints, each with 'expression' (coefficients),
'operator' ("<=", ">=", "=="), and 'rhs' (right-hand side value)
solver: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum time to spend solving (optional)
Returns:
Optimization result with status, objective value, variable values, and solver info
Example:
# Maximize 3x + 2y subject to 2x + y <= 20, x + 3y <= 30, x,y >= 0
solve_linear_program(
objective={"sense": "maximize", "coefficients": {"x": 3, "y": 2}},
variables={
"x": {"type": "continuous", "lower": 0},
"y": {"type": "continuous", "lower": 0}
},
constraints=[
{"expression": {"x": 2, "y": 1}, "operator": "<=", "rhs": 20},
{"expression": {"x": 1, "y": 3}, "operator": "<=", "rhs": 30}
]
)
| Name | Required | Description | Default |
|---|---|---|---|
| objective | Yes | ||
| variables | Yes | ||
| constraints | Yes | ||
| solver | No | CBC | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must convey behavioral traits. It explains the solving process, solver options, and time limit, but does not detail error handling, infeasibility behavior, or external solver dependencies. The return value description is vague.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with a summary, use cases, args, returns, and an example. While some text could be tightened (use cases list), every sentence adds value and the structure aids readability.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of linear programming and lack of output schema, the description covers the main aspects: what the tool does, how to specify inputs, and what to expect in return. Minor gaps in error behavior and installation prerequisites prevent a higher score.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema coverage, the description fully compensates by explaining each parameter in detail, including the structure of objective, variables, constraints, and optional parameters. The example further clarifies usage, making the schema's loose typing manageable.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it solves linear programming problems and lists diverse use cases, distinguishing it from general optimization. However, it does not explicitly differentiate from sibling tools like integer or mixed-integer programming, which limits clarity slightly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'Use cases' section provides context for when to apply the tool, but there is no guidance on when not to use it or which sibling tool to use for integer/mixed-integer problems. Implied usage is present but exclusions are missing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_mixed_integer_programB
Solve Mixed-Integer Programming (MIP) problems with integer, binary, and continuous variables.
Args:
variables: List of variable definitions with bounds and types
constraints: List of constraint definitions with coefficients and bounds
objective: Objective function definition with coefficients and direction
solver_name: Solver to use ("SCIP", "CBC", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal variable values and objective
| Name | Required | Description | Default |
|---|---|---|---|
| variables | Yes | ||
| constraints | Yes | ||
| objective | Yes | ||
| solver_name | No | SCIP | |
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fails to disclose behavioral traits such as potential solver unavailability, performance constraints, or side effects. Only a simple functional description is given.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with a clear purpose statement and structured Args list. Every sentence adds value, no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description lacks details about the return structure, error handling, and validation. Given the complexity and absent output schema, it is incomplete for an agent to use confidently.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite 0% schema coverage, the description adds meaning for all five parameters: explains variable definitions, constraints, objective components, solver options, and default time limit. However, it could provide more structure details for nested objects.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it solves Mixed-Integer Programming problems and specifies the variable types (integer, binary, continuous). This distinguishes it from siblings like solve_linear_program_tool or solve_integer_program_tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like solve_integer_program_tool or solve_linear_program_tool. There is no mention of contexts or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_transportation_problem_toolB
Solve transportation problem using OR-Tools.
Args:
suppliers: List of supplier dictionaries with 'name' and 'supply' keys
consumers: List of consumer dictionaries with 'name' and 'demand' keys
costs: 2D cost matrix where costs[i][j] is cost of shipping from supplier i to consumer j
Returns:
Dictionary with solution status, flows, total cost, and execution time
| Name | Required | Description | Default |
|---|---|---|---|
| suppliers | Yes | ||
| consumers | Yes | ||
| costs | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description mentions using OR-Tools and specifies the return structure, but without annotations, it does not disclose safety, side effects, or constraints like balanced/unbalanced problems. It provides some behavioral context but is insufficiently transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a well-structured docstring with Args and Returns sections, concise and easy to parse. However, it could be slightly more compact without losing clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description adequately explains parameters and return values given no output schema. It is complete for basic use but lacks details on handling unbalanced problems or error cases, which are important for a solve tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates by explaining each parameter's expected structure (e.g., suppliers have 'name' and 'supply', costs is a 2D matrix). This adds significant meaning beyond the schema. Slightly docked for not specifying that matrices should align with supplier/consumer order.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it solves a transportation problem using OR-Tools, with a specific verb and resource. However, it does not explicitly differentiate from sibling tools like assignment or linear programming, though the name and context imply distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives such as solve_assignment_problem_tool or solve_linear_program_tool. The description lacks context for selecting the appropriate optimization tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_traveling_salesman_problemB
Solve Traveling Salesman Problem (TSP) to find the shortest route visiting all locations.
Args:
locations: List of location dictionaries with name and coordinates
distance_matrix: Optional pre-calculated distance matrix
start_location: Index of starting location (default: 0)
return_to_start: Whether to return to starting location (default: True)
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with route and total distance
| Name | Required | Description | Default |
|---|---|---|---|
| locations | Yes | ||
| distance_matrix | No | ||
| start_location | No | ||
| return_to_start | No | ||
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description should disclose behavioral traits. It mentions time limit and return-to-start but omits critical details like non-destructive nature, input validation, error handling, or algorithmic approach (exact/heuristic).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is short, front-loaded with purpose, and uses a clear docstring format with Args and Returns. Every sentence adds value, though it could be slightly more concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description should fully describe the return value. It only says 'Optimization result with route and total distance,' which is vague. It also lacks constraints on input size or behavior with invalid data, leaving the agent underinformed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must add meaning. It explains that locations have name and coordinates, distance_matrix is optional, and start_location indices are zero-based. However, it lacks precise format for coordinates and does not specify required keys in location dictionaries.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool solves the Traveling Salesman Problem to find the shortest route. It uses specific verb 'solve' and resource 'TSP', and is distinct from sibling optimization tools like portfolio or production planning.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for shortest route problems but does not explicitly state when to use this tool over alternatives like vehicle routing or assignment. No exclusions or contextual advice are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
solve_vehicle_routing_problemB
Solve Vehicle Routing Problem (VRP) to optimize routes for multiple vehicles.
Args:
locations: List of location dictionaries with name, coordinates, and demand
vehicles: List of vehicle dictionaries with capacity constraints
distance_matrix: Optional pre-calculated distance matrix
time_matrix: Optional pre-calculated time matrix
depot: Index of depot location (default: 0)
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with routes for all vehicles
| Name | Required | Description | Default |
|---|---|---|---|
| locations | Yes | ||
| vehicles | Yes | ||
| distance_matrix | No | ||
| time_matrix | No | ||
| depot | No | ||
| time_limit_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It fails to disclose behavioral traits such as whether the solver is deterministic, what constraints are enforced, or error handling. The description only states the function purpose without depth.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured with a clear docstring format. It front-loads the purpose and lists parameters, but the parameter descriptions are repetitive and could be more compact.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (6 parameters, no output schema, many sibling tools), the description is insufficient. It does not explain return value structure, algorithm behavior, or use cases. A more comprehensive description is needed for effective agent selection.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description adds basic meaning by listing parameter expectations (e.g., locations as dicts with name, coordinates, demand). However, it lacks detail on format constraints, optional matrix usage, or what defaults imply.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool solves Vehicle Routing Problems (VRP) to optimize routes for multiple vehicles, with specific arguments listed. This verb+resource pair distinguishes it well from sibling optimization tools like solve_linear_program or solve_traveling_salesman.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for VRP scenarios but does not provide explicit guidance on when to use this tool versus alternatives (e.g., traveling salesman for single vehicle, linear programming for different constraints). No when-not-to-use or prerequisites are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_optimization_inputC
Validate input data for optimization problems.
Args:
problem_type: Type of optimization problem
input_data: Input data to validate
Returns:
Validation result with errors, warnings, and suggestions
| Name | Required | Description | Default |
|---|---|---|---|
| problem_type | Yes | ||
| input_data | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must fully disclose behavioral traits. It indicates the return includes errors, warnings, and suggestions, but does not state whether the tool is read-only, has side effects, or any other important behavioral characteristics.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very short and efficient, but includes parameter docstrings that could be better placed in the schema. It is front-loaded with the purpose but could be more structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (validation with two parameters, no output schema, 0% schema coverage), the description is incomplete. It does not specify the validation logic, the format of the return value, or how to use the results effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate. It briefly explains problem_type and input_data but lacks details on valid values for problem_type or structure of input_data. This adds minimal meaning beyond the parameter names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool validates input data for optimization problems. While it doesn't explicitly differentiate from sibling tools, the siblings are all problem-solving tools, so the purpose is distinct and clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies that this tool should be used to validate input before running optimization, but it does not provide explicit guidance on when to use it versus alternatives, nor does it mention prerequisites or typical workflows.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
13 tool updates
- First observed
optimize_portfolio_tool - First observed
optimize_production_plan_tool - First observed
solve_assignment_problem_tool - First observed
solve_employee_shift_scheduling - First observed
solve_integer_program_tool - First observed
solve_job_shop_scheduling - First observed
solve_knapsack_problem_tool - First observed
solve_linear_program_tool - First observed
solve_mixed_integer_program - First observed
solve_transportation_problem_tool - First observed
solve_traveling_salesman_problem - First observed
solve_vehicle_routing_problem - First observed
validate_optimization_input
TDQS
Most tools target distinct optimization problems (portfolio, production, assignment, scheduling, etc.), but there is some overlap: solve_integer_program_tool and solve_mixed_integer_program both handle integer programming, and solve_linear_program_tool and solve_integer_program_tool cover similar mathematical optimization domains. Descriptions help differentiate, but an agent might need to choose between them for certain use cases.
Naming is mixed: most tools use a verb_noun pattern (e.g., optimize_portfolio_tool, solve_assignment_problem_tool), but some deviate (solve_employee_shift_scheduling, solve_integer_program_tool vs. solve_mixed_integer_program). The suffix '_tool' is inconsistently applied, and there's a mix of snake_case with minor variations, making the pattern readable but not fully consistent.
With 13 tools, the count is well-scoped for an optimization server covering diverse problem types (portfolio, production, scheduling, routing, etc.). Each tool addresses a specific optimization domain, and the set feels comprehensive without being overwhelming, fitting typical MCP server expectations.
The tool set provides broad coverage of optimization domains, including portfolio, production, assignment, scheduling, linear/integer programming, knapsack, transportation, TSP, VRP, and input validation. There are no obvious gaps; agents can handle a wide range of optimization workflows from formulation to solution, with tools for both specific and general problems.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
QuLab MCP remote server (Streamable HTTP) for computational science and lab tools.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP Server for an Agent Task Marketplace
MCP server for aerospace calculations: orbital mechanics, ephemeris, DSN operations, ...
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA Model Context Protocol (MCP) server that exposes MiniZinc constraint solving capabilities to Large Language Models.180MIT
- AlicenseNot gradedqualityDmaintenanceMCP-ORTools integrates Google's OR-Tools constraint programming solver with Large Language Models through the MCP, enabling AI models to: Submit and validate constraint models Set model parameters Solve constraint satisfaction and optimization problems Retrieve and analyze solution21MIT
- AlicenseNot gradedqualityDmaintenanceEnables solving Constraint Satisfaction Problems (CSP) like N-Queens, graph coloring, and Sudoku, as well as Linear Programming optimization problems through both MCP tools and HTTP API endpoints.2MIT
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables Large Language Models to interactively create, edit, and solve constraint models using backends like MiniZinc, Z3, PySAT, and Clingo. It bridges natural language with symbolic reasoning for solving complex logical, SAT, SMT, and optimization problems.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dmitryanchikov/mcp-optimizer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server