Get the FREE Ultimate OpenClaw Setup Guide →

usolver

A model context protocol server for solving combinatorial optimization problems with logical and numerical constraints.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sdiehl-usolver uvx sdiehl-usolver

How to use

USolver is a Model Context Protocol server that exposes multiple optimization solvers to help you solve combinatorial, convex, integer programming, and non-linear problems. It provides interfaces to Highs for linear and mixed-integer programming, OR-Tools for combinatorial optimization, CVXPY for convex optimization, and Z3 for SMT-style constraint solving. After installing, you’ll see the usolver tool in your MCP-enabled environment (Claude Desktop or Cursor) and you can invoke the various example modules included with the server to prompt for solutions. Each example module contains a docstring that can be used as a prompt template to guide the solver in solving the problem at hand.

To use USolver, first ensure the installation script has been run (see installation steps). Then select the usolver tool in your MCP tool list and choose an example that matches your problem domain (e.g., Job Shop Scheduling with OR-Tools, Portfolio Theory with CVXPY, or a Z3-based SMT puzzle). You can also present your own optimization problem to the solver by framing it as one of the supported models, and the server will route the request to the appropriate backend solver depending on the problem structure (linear/MIP with Highs, combinatorial with OR-Tools, convex with CVXPY, or SMT with Z3).

Examples span a variety of optimization domains, including production planning, resource allocation, network flow, nurse scheduling, and cryptarithms. The included modern portfolio theory and logic puzzle sections illustrate how to encode real-world constraints and objectives, and how the model context can synthesize or verify the constraint system using the chosen solver.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Internet access to fetch dependencies
  • A compatible environment to run uv (Claude Desktop or Cursor integration works out-of-the-box)

Installation steps:

  1. Ensure your environment is prepared for MCP servers and that Python is accessible from your PATH.

  2. Run the installation script provided by USolver:

    uv run install.py

    This script will install the MCP server components for USolver, including the necessary solver backends (Highs, OR-Tools, CVXPY, Z3) and any required Python packages.

  3. After installation completes, restart your MCP-enabled environment (Claude Desktop or Cursor) and you should see the usolver tool available in the tool list.

  4. Invoke the usolver tool from the MCP interface to run example modules or to submit your own optimization prompts framed for the supported solvers.

Additional notes

Tips and notes:

  • The server exposes multiple backends; pick the solver that best fits your problem type (Highs for linear/MIP, OR-Tools for combinatorial problems, CVXPY for convex optimization, Z3 for SMT-style reasoning).
  • Each example module includes a docstring that can guide you in formatting prompts for the solver, which is especially helpful for complex constraints.
  • If you encounter installation issues, ensure Python dependencies are accessible and that there is network access for package installation performed by install.py.
  • Some problems may require reformulation to fit the capabilities of a chosen backend (e.g., converting a non-convex problem to a convex relaxation for CVXPY or selecting an appropriate OR-Tools model for scheduling problems).
  • Environment variables can be added under the mcp_config if there are configuration needs (e.g., API keys or solver-specific flags); currently, env is empty but can be populated as needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers