HiGHS MCP Server
A Model Context Protocol (MCP) server that provides linear programming (LP) and mixed-integer programming (MIP) optimization capabilities using the HiGHS solver.
Overview
This MCP server exposes the HiGHS optimization solver through a standardized interface, allowing AI assistants and other MCP clients to solve complex optimization problems including:
Linear Programming (LP) problems
Mixed-Integer Programming (MIP) problems
Quadratic Programming (QP) problems for convex objectives
Binary and integer variable constraints
Multi-objective optimization
Requirements
Node.js >= 16.0.0
Installation
Or clone and build from source:
Usage
As an MCP Server
The server can be run directly:
Or if built from source:
Integration with Claude
To use this tool with Claude, add it to your Claude configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
After adding the configuration, restart Claude to load the HiGHS optimization tool.
Integration with Other MCP Clients
The HiGHS MCP server is compatible with any MCP client. Some popular options include:
Claude Desktop: Anthropic's AI assistant with native MCP support
MCP CLI: Command-line interface for testing MCP servers
MCP Inspector: Web-based tool for debugging MCP servers
Custom Applications: Any application using the MCP SDK
Tool API
The server provides a single tool: optimize-mip-lp-tool
Input Schema
Output Schema
Notes on Quadratic Programming (QP)
Convex QP only: The quadratic matrix Q must be positive semidefinite
Continuous variables only: Integer/binary variables are not supported with quadratic objectives (no MIQP)
Format: Objective function is: minimize c^T x + 0.5 x^T Q x
Matrix specification: When specifying Q, values should be doubled to account for the 0.5 factor
Use Cases
1. Production Planning
Optimize production schedules to maximize profit while respecting resource constraints:
2. Transportation/Logistics
Minimize transportation costs across a supply chain network:
3. Portfolio Optimization
Optimize investment allocation with risk constraints:
4. Portfolio Optimization with Risk (Quadratic Programming)
Minimize portfolio risk (variance) while achieving target return:
5. Resource Allocation
Optimize resource allocation across projects with integer constraints:
5. Large Sparse Problems
For large optimization problems with mostly zero coefficients, use the sparse format for better memory efficiency:
Use sparse format when:
Problem has > 1000 variables or constraints
Matrix has < 10% non-zero coefficients
Memory efficiency is important
6. Enhanced Solver Options
Fine-tune solver behavior with comprehensive HiGHS options:
Key Option Categories:
Solver Control: Algorithm selection, parallelization, time limits
Tolerances: Precision control for feasibility and optimality
Simplex Options: Strategy, scaling, pricing, iteration limits
MIP Options: Symmetry detection, node limits, gap tolerances
Logging: Output control, debugging levels, file output
Algorithm-specific: IPM and PDLP specialized options
Features
High Performance: Built on the HiGHS solver, one of the fastest open-source optimization solvers
Sparse Matrix Support: Efficient handling of large-scale problems with sparse constraint matrices
Type Safety: Full TypeScript support with Zod validation for robust error handling
Compact Variable Format: Self-contained variable specifications with smart defaults
Flexible Problem Types: Supports continuous, integer, and binary variables
Multiple Solver Methods: Choose between simplex, interior point, and other algorithms
Comprehensive Output: Returns primal solution, dual values, and reduced costs
Development
Building
Testing
Type Checking
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - Copyright (c) 2024 Wilfred Springer
Related Projects
HiGHS - The underlying optimization solver
Model Context Protocol - The protocol specification
MCP SDK - SDK for building MCP servers