A Model Context Protocol server that exposes tools for solving combinatorial, convex, integer programming, and non-linear optimization problems. Exposes interfaces to the following solvers:
- highs - Linear and mixed-integer programming solver
- ortools - Combinatorial optimization solver
- cvxpy - Convex optimization solver
- z3 - SMT solver over booleans, integers, reals, and strings
To install run the install.py script. This will install the MPC server for Claude Desktop and/or Cursor.
Then open Claude or Cursor and you should see the MCP tool usolver available in the tool list.
To run the individual solver examples you can invoke the individual example modules. Each module contains a docstring which can be used to prompt the language model to solve the problem.
- Chemical Engineering - Pipeline design optimization using Z3 SMT solver for fluid transport systems with flow continuity, pressure drop, and economic constraints
- Chained Solvers - Multi-stage restaurant optimization combining OR-Tools for table layout and CVXPY for staff scheduling
- Job Shop Scheduling - Complex scheduling problem using OR-Tools to minimize makespan while respecting operation precedence and machine capacity
- Logistics - Transportation network optimization using HiGHS to minimize shipping costs in multi-stage supply chains
- Nurse Scheduling - Hospital staff scheduling using OR-Tools to assign nurses to shifts with fairness and availability constraints
- Portfolio Theory - Modern portfolio optimization using CVXPY to maximize returns while constraining risk across asset classes
- Production Planning - Manufacturing optimization using HiGHS to maximize profit subject to machine, labor, and material constraints
- Resource Allocation - Project portfolio selection using HiGHS mixed-integer programming to maximize value within budget and resource limits
- Network Flow - Shortest path optimization using HiGHS linear programming to find minimum-cost routes through directed graphs with flow conservation constraints
- Coin Problem - Classic logic puzzle using Z3 to find which 6 US coins total $1.15 but cannot make change for various denominations
- Cryptarithmetic - Solve cryptarithmetic puzzles like SEND + MORE = MONEY using Z3 constraint programming
- Knapsack Problem - Classic 0/1 knapsack optimization using OR-Tools to maximize value within weight constraints
- Multilinear Optimization - Linear programming with mixed constraints using Z3 to minimize objective functions subject to linear inequalities
- N-Queens - Place N queens on an N×N chessboard using OR-Tools constraint programming with no attacking positions
- Sparse Solver - Large-scale optimization demonstrating sparse matrix formats for memory-efficient resource allocation across facilities and time periods
This can be fed into usolver and it will generate a constraint system:
$C$ is the collection of the six unknown coin values, $c_1$ through $c_6$, each of which must be a positive whole number representing cents.
$$ C = \{c_1, c_2, c_3, c_4, c_5, c_6\}, \quad \text{where each } c_i \in \mathbb{Z}^+ $$
$\mathcal{S}$ is the collection of every possible way you could choose two or more of your six coins.
$$ \mathcal{S} = \{S \mid S \subseteq C \land |S| \ge 2 \} $$
Exclude the 50 cent coin from being used in the vending machine.
$$ v(x) = \begin{cases} 0 & \text{if } x = 50 \\ x & \text{if } x \neq 50 \end{cases} $$
Constraint 0: The sum of the values of all six coins is 115 cents.
$$ \sum_{i=1}^{6} c_i = 115 $$
Constraint 1: Cannot make change for a dollar.
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} x \neq 100 $$
Constraint 2: Cannot make change for half a dollar.
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} x \neq 50 $$
Constraint 3: Cannot make change for a quarter.
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} x \neq 25 $$
Constraint 4: Cannot make change for a dime.
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} x \neq 10 $$
Constraint 5: Cannot make change for a nickel
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} x \neq 5 $$
Constraint 6: Cannot buy the candy bar for 95 cents if half dollar is excluded.
$$ \forall S \in \mathcal{S}, \quad \sum_{x \in S} v(x) \neq 95 $$
If you feed this to solver it will synthesize the above constraint system, solve it with Z3, and return the solution.
A finance example:
This is compiled by the langauge model down into a convex optimization problem that can be cvxopt.
$$ \begin{align} \text{maximize} \quad & 0.08x_1 + 0.12x_2 + 0.10x_3 + 0.15x_4 \\ \text{subject to} \quad & x_1 + x_2 + x_3 + x_4 = 1 \\ & x_1 \leq 0.4 \\ & x_2 \leq 0.6 \\ & x_3 \leq 0.3 \\ & x_4 \leq 0.2 \\ & 0.02x_1 + 0.15x_2 + 0.08x_3 + 0.20x_4 \leq 0.10 \\ & x_1, x_2, x_3, x_4 \geq 0 \end{align} $$
Where:
- $x_1$ = Bonds allocation
- $x_2$ = Stocks allocation
- $x_3$ = Real Estate allocation
- $x_4$ = Commodities allocation
The answer is then:
A chemical engineering example:
A multilinear optimization example:
This is compiled by the language model down into a constraint satisfaction problem that can be solved with Z3.
$$ \begin{aligned} \text{minimize} \quad & 12x + 20y \\ \text{subject to} \quad & 6x + 8y \geq 100 \\ & 7x + 12y \geq 120 \\ & x \geq 0 \\ & y \in [0, 3] \end{aligned} $$
Where:
- $x$ = First decision variable (continuous, non-negative)
- $y$ = Second decision variable (continuous, bounded)
The optimal solution is:
A simple convex optimization problem minimizing the 2-norm of a linear system:
A classic worker shift scheduling problem:
A chained example that uses both OR-Tools to optimize for table layout and CVXPY to optimize for staff scheduling.
Can also run the MCP server directly from the GitHub Container Registry.
Then add the following to your client:
Released under the Apache License 2.0. See the LICENSE file for details.
.png)



