MiniZinc MCP Server
This server lets an LLM client work with MiniZinc constraint models: list solvers, validate models, and solve them from code or files.
List installed MiniZinc solvers (e.g. gecode, chuffed, highs).
Validate and type-check MiniZinc model code without solving it.
Solve a model from source code, with parameters, solver choice, all-solutions mode, max solutions, and time limit.
Solve a model from file paths, optionally with a .dzn data file.
Compare multiple solvers on the same model and see per-solver results.
Inspect a model's solve method, expected parameters, and output variables without solving.
Compile a model to FlatZinc for low-level inspection and debugging.
Return structured JSON results: status, solutions, objective, and solver statistics, with errors captured in the result.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MiniZinc MCP Server Solve this MiniZinc model: var 1..10: x; solve maximize x;"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MiniZinc MCP Server
An MCP server that exposes MiniZinc constraint solving and optimization to LLM clients such as opencode, Claude Desktop, and Cursor. It lets an agent parse, type-check, and solve MiniZinc models directly from a chat session.
Built with the MCP Python SDK v2 and the MiniZinc Python binding.
Demo
Related MCP server: Google OR-Tools server
Install it
1. Prerequisites
Only two things need to be installed, once per machine:
uv —
curl -LsSf https://astral.sh/uv/install.sh | shMiniZinc 2.6+ with the
minizincexecutable onPATH(includes a default solver, Gecode)
Everything else is fetched automatically by uv — there is no clone, no venv setup, and no manual pip install on your side.
2. Install the server (pick one)
From PyPI (recommended)
Install the latest released version globally (best if you use it in several projects):
uv tool install minizinc-mcpOr run the latest released version on demand, with nothing installed:
uvx minizinc-mcpFrom GitHub (latest development version)
To run the latest development version directly from the repository, use:
uvx --from git+https://github.com/carban/minizinc-mcp minizinc-mcpTo install that development version globally instead:
uv tool install --from git+https://github.com/carban/minizinc-mcp minizinc-mcpThe GitHub installation tracks the repository's main branch; PyPI provides released versions.
3. Wire it into your MCP client
The server runs over stdio. Tell your MCP client to launch it:
opencode — project level (add this to opencode.jsonc in your project):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"minizinc": {
"type": "local",
"command": ["uvx", "minizinc-mcp"]
}
}
}opencode — global (add the same mcp.minizinc block to ~/.config/opencode/opencode.json):
{
"mcp": {
"minizinc": {
"type": "local",
"command": ["uvx", "minizinc-mcp"]
}
}
}Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"minizinc": {
"command": "uvx",
"args": ["minizinc-mcp"]
}
}
}If you are using the GitHub installation instead, replace ["uvx", "minizinc-mcp"] in the opencode configuration with ["uvx", "--from", "git+https://github.com/carban/minizinc-mcp", "minizinc-mcp"], and replace the Claude Desktop arguments with ["--from", "git+https://github.com/carban/minizinc-mcp", "minizinc-mcp"].
4. Verify it works
Restart your client. Eight tools should now be available, prefixed with minizinc_:
minizinc_list_toolsminizinc_list_solversminizinc_validate_modelminizinc_solve_modelminizinc_compare_solversminizinc_solve_model_by_pathminizinc_get_model_infominizinc_get_flatzinc
Quick sanity check — ask your client: "list the available MiniZinc solvers". You should see gecode, chuffed, highs, and anything else installed on the machine.
Using the MiniZinc skill with opencode
The skills/minizinc/ folder contains an opencode skill that steers an agent through constraint programming, combinatorial, and optimization work: modeling problems with MiniZinc, type-checking models, running or comparing solvers, and rendering results as Markdown tables (instead of raw JSON).
The skill lives in a top-level skills/ folder so it is visible in the repo, but opencode does not auto-discover it from there — you must install it first.
1. Prerequisite
Register the MCP server as shown in the Wire it into your MCP client section above.
2. Install the skill (pick one)
Copy it into a project where you want it active (auto-discovered by opencode, no config needed):
cp -r skills/minizinc <your-project>/.opencode/skills/Or install it globally so it is available in every project:
cp -r skills/minizinc ~/.config/opencode/skills/Or point opencode at this repo's skills/ folder (scanned recursively for SKILL.md) by adding to opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"skills": {
"paths": ["/path/to/minizinc-mcp/skills"]
}
}Claude Code users can copy the folder to ~/.claude/skills/minizinc/ instead of ~/.config/opencode/skills/.
3. Use it
Restart your client, then simply describe a problem. For example:
"Solve this knapsack as a MiniZinc model."
"Optimize a production schedule with MiniZinc."
"Compare the available solvers on this model and recommend one."
"Write a MiniZinc model for this timetabling problem and check it."
The skill activates automatically and drives the minizinc_* tools — modeling, validating, solving, comparing solvers, and presenting results as tables.
What it does
Tool | Description |
| Lists the names of all tools exposed by this MiniZinc MCP server, including |
| Lists every MiniZinc solver installed on the machine. The returned tag names (e.g. |
| Parses and type-checks MiniZinc model code without solving it. Useful for checking model syntax up front. Returns |
| Solves a MiniZinc model given as source code: once, exhaustively ( |
| Solves the same model once with each requested solver and returns the individual |
| Same as |
| Inspects a model without solving it: returns its solve method (satisfy/minimize/maximize) and the declared input parameters and output variables with their types. Useful for an agent to know exactly which |
| Compiles a model (and optional data) to FlatZinc text without solving it. Returns the |
solve_model arguments
Argument | Type | Default | Description |
|
| (required) | The MiniZinc source code ( |
|
|
| Parameter assignments like a |
|
|
| Which solver to use (see |
|
|
| Compute all solutions of a |
|
|
| Stop after at most this many solutions. |
|
|
| Solver time limit in seconds. |
compare_solvers arguments
Argument | Type | Default | Description |
|
| (required) | The same MiniZinc source model to pass to every solver. |
|
| (required) | Solver tag names to run, normally from |
|
|
| The same parameter assignments to pass to every solver. |
|
|
| Compute all solutions of a |
|
|
| Stop each solver after finding at most this many solutions. |
|
|
| Per-solver time limit in seconds. |
compare_solvers calls solve_model once per requested solver and returns each result under results, keyed by solver name. A solver error is retained in that solver's result without stopping the remaining runs. The shape is:
{
"results": {
"gecode": {
"status": "OPTIMAL_SOLUTION",
"objective": 1700,
"statistics": { "time": 0.01, "nodes": 12 }
},
"chuffed": {
"status": "OPTIMAL_SOLUTION",
"objective": 1700,
"statistics": { "time": 0.02, "nodes": 8 }
}
}
}The solve_model result is a JSON object like:
{
"status": "OPTIMAL_SOLUTION",
"objective": 9,
"solution": { "objective": 9, "x": 9, "y": 1 },
"statistics": { "time": 0.204, "nodes": 3, ... }
}status is one of SATISFIED, OPTIMAL_SOLUTION, ALL_SOLUTIONS, UNSATISFIABLE, UNKNOWN, or ERROR. validate_model, solve_model, and each individual compare_solvers run never raise in normal operation — errors are returned inside the result dict.
The tool descriptions also instruct the client agent to present solving results, solver comparisons, and model info to you as Markdown tables instead of raw JSON, so solve_model and compare_solvers answers read like tables even though the tools themselves always return structured JSON.
Developing locally
Clone the repo, then:
uv sync # create the environment and install mcp + minizincThe server speaks the MCP stdio transport, so it is launched as a subprocess by an MCP client. Run it with the SDK inspector:
uv run mcp dev server.pythat opens the MCP Inspector in the browser where every tool can be called interactively. A minimal programmatic smoke test:
uv run python -c "
import asyncio
from mcp import Client
from mcp.client.stdio import StdioServerParameters
async def main():
params = StdioServerParameters(command='uv', args=['run', 'python', 'server.py'], cwd='.')
async with Client(params) as client:
result = await client.call_tool('solve_model', {
'model_code': 'var 1..10: x; var 1..10: y; constraint x + y = 10; solve maximize x;'
})
print(result.content[0].text)
asyncio.run(main())
"Running the tests
Install the test dependencies, then run the suite:
uv sync --group dev
uv run pytest -qThe tests in tests/ launch the server end-to-end over stdio and call every tool through the MCP protocol, solving the example model in example/. They need a working MiniZinc install (the same prerequisite as for developers).
Notes and limitations
paramsfollows JSON representation: JSON arrays map to MiniZinc arrays; numbers, strings, and booleans map to their native MiniZinc types. Exotic types like sets and enums are not fully expressible this way.Do not combine
all_solutionswithmax_solutions; the MiniZinc driver rejects the combination.MiniZinc requires a solver that supports the model (e.g.
chuffed/gecodefor CP,highs/cbcfor MIP models). Uselist_solversto see what is installed.Solutions are returned inline in the tool result;
read_only_hintis set on all tools, so they do not modify your files or system.
Available Tools
4 toolslist_solversB
List MiniZinc solvers
Inputs: no named parameters. Returns: result
solve_modelC
Solve a MiniZinc model
Inputs: model_code (required), params, solver, all_solutions, +2 more.
solve_model_by_pathB
Solve a MiniZinc model given by file paths
Inputs: model_path (required), solver, data_path, all_solutions, +2 more.
validate_modelC
Validate a MiniZinc model
Inputs: model_code (required), params.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
list_solvers and validate_model are clearly distinct, but solve_model and solve_model_by_path overlap heavily in purpose. The descriptions distinguish file-based solving from a generic solve action, but an agent may be uncertain which to use for an inline model versus a file path.
All tools follow a consistent verb_noun pattern: list_solvers, validate_model, solve_model, solve_model_by_path. The by_path suffix is a clear modifier rather than a convention break.
Four tools is a reasonable scope for a specialized MiniZinc server. Each tool addresses a core workflow need, though the set is slightly minimal.
The server covers the main MiniZinc operations: enumerate solvers, validate a model, and solve a model. Minor gaps exist such as solver-specific configuration or more granular result controls, but the core workflow is not blocked.
Maintenance
Related MCP Connectors
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Solve production, blending, transport and scheduling problems with LP and MIP.
Structural FEM for AI agents: frames, plates, buckling, seismic and Eurocode checks, solved locally.
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol (MCP) server that exposes MiniZinc constraint solving capabilities to Large Language Models.6187MIT
- AlicenseNot gradedqualityDmaintenanceMCP-ORTools integrates Google's OR-Tools constraint programming solver with Large Language Models through the MCP, enabling AI models to: Submit and validate constraint models Set model parameters Solve constraint satisfaction and optimization problems Retrieve and analyze solution22MIT
- AlicenseAqualityFmaintenanceProvides constraint satisfaction and optimization capabilities to LLMs and AI agents for scheduling, resource allocation, routing, budget optimization, and configuration problems using Google OR-Tools CP-SAT solver.55Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables Large Language Models to interactively create, edit, and solve constraint models using backends like MiniZinc, Z3, PySAT, and Clingo. It bridges natural language with symbolic reasoning for solving complex logical, SAT, SMT, and optimization problems.MIT