usolver
A model context protocol server for solving combinatorial optimization problems with logical and numerical constraints.
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:
-
Ensure your environment is prepared for MCP servers and that Python is accessible from your PATH.
-
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.
-
After installation completes, restart your MCP-enabled environment (Claude Desktop or Cursor) and you should see the usolver tool available in the tool list.
-
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
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
ReActMCP
ReActMCP is a reactive MCP client that empowers AI assistants to instantly respond with real-time, Markdown-formatted web search insights powered by the Exa API.
jmeter
✨ JMeter Meets AI Workflows: Introducing the JMeter MCP Server! 🤯
example
A ready-to-use MCP (Model Context Protocol) server template for extending Cursor IDE with custom tools. Deploy your own server to Heroku with one click, create custom commands, and enhance your Cursor IDE experience. Perfect for developers who want to add their own tools and commands to Cursor IDE without complex setup.
pfsense
pfSense MCP Server enables security administrators to manage their pfSense firewalls using natural language through AI assistants like Claude Desktop. Simply ask "Show me blocked IPs" or "Run a PCI compliance check" instead of navigating complex interfaces. Supports REST/XML-RPC/SSH connections, and includes built-in complian
cloudwatch-logs
MCP server from serkanh/cloudwatch-logs-mcp