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
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
2. ๐ฆ pip + venv - Cross-platform
Standard approach
3. ๐ uvx - Linux/Windows (full), macOS (partially)
macOS 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:
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:
Add to your
claude_desktop_config.json
:
Restart Claude Desktop and look for the ๐จ tools icon
Option 2: Using pip + venv
Then add to your Claude Desktop config:
Option 3: Using uvx
Add to your claude_desktop_config.json
:
Note: On macOS, uvx provides limited functionality (PuLP solver only) or see
Advanced Docker Setup (for remote MCP clients)
SSE 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):
Alternative configurations:
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
Local Package Build and Run
For testing and development, you can build the package locally and run it with uvx:
Note: 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
Standalone Server Commands
Transport 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)
SSE Transport (for remote MCP clients)
Available CLI Options
๐ง Platform Compatibility & Troubleshooting
macOS Compatibility
โ Full Functionality:
Homebrew + pip:
brew install or-tools && pip install mcp-optimizer
Virtual environments:
python -m venv venv && source venv/bin/activate && pip install ortools mcp-optimizer
Docker: 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:
Root 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)
2. Manual Fix
3. Use pip (Always Works)
4. Use Docker (Production Ready)
๐ฏ 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:
Manual Testing:
Test 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
/timeout
For Docker tests:
docker
+ local requirementsmacOS:
brew install coreutils
(for gtimeout)
CI/CD Integration:
๐ Usage Examples
Linear Programming
Assignment Problem
Knapsack Problem
Portfolio Optimization
๐๏ธ Architecture
๐งช Test Results
โ Comprehensive Test Suite
โ 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
Kubernetes
Monitoring
๐ฏ 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
2. Create PR to main
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_TOKEN
secret in GitHub repositoryEnsure all tests pass
Follow semantic versioning
๐ ๏ธ Development Tools
Debug Tools
Use the debug script to inspect MCP server structure:
Comprehensive Testing
Run the full integration test suite:
Docker 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
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Git Flow Policy
This project follows a standard Git Flow workflow:
Feature branches โ
develop
branchRelease branches โ
main
branchHotfix branches โ
main
anddevelop
branches
๐ 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
๐ 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
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
mcp-optimizer
- ๐ Quick Start
- ๐ง Platform Compatibility & Troubleshooting
- ๐ง macOS uvx Troubleshooting
- ๐ฏ Features
- ๐ Usage Examples
- ๐๏ธ Architecture
- ๐งช Test Results
- ๐ง Technical Details
- ๐ Requirements
- ๐ Production Deployment
- ๐ฏ Project Status
- ๐ Usage Examples
- ๐ Recent Updates
- ๐ Fully Automated Release Process
- ๐ ๏ธ Development Tools
- ๐ค Contributing
- ๐ License
- ๐ Acknowledgments
- ๐ Support
- ๐ Docker Image Size Analysis
Related MCP Servers
- MIT License
- MIT License
- MIT License