MiniZinc MCP for your AI Agent A developer has released MiniZinc MCP, an open-source tool that connects AI agents to the MiniZinc constraint modeling language so they can model and solve combinatorial and optimization problems such as knapsack, scheduling, planning, and resource allocation. The MCP server exposes tools including list_solvers, validate_model, and solve_model, letting agents validate model syntax, run models against solvers like Gecode, Chuffed, and HiGHS, and analyze results through natural language. The project is available on GitHub at github.com/carban/minizinc-mcp. I just want to share a new tool I've been developing for the community: a MiniZinc MCP tool. This tool empowers your AI agents by allowing them to model and solve combinatorial and optimization problems. Check out the GitHub repository: 👉 github.com/carban/minizinc-mcp https://github.com/carban/minizinc-mcp In computer science, there are many combinatorial and optimization problems that researchers have been working on, for example problems like the Knapsack problem, scheduling optimization, planning, resource allocation, and more. All of these are great examples of problems we can model and solve using a Constraint Modeling Language. MiniZinc https://www.minizinc.org/ is a free and open-source constraint modeling language. You can use MiniZinc to model constraint satisfaction and optimization problems in a high-level, And that's why it's awesome: , a MiniZinc model does not dictate how to solve the problem. Instead, the MiniZinc compiler translates your model into different forms suitable for a wide range of underlying solvers such as Constraint Programming CP , Mixed Integer Linear Programming MIP or Boolean Satisfiability SAT solvers. You focus on the modeling, and the solver searches for the solution. In other words, it does the hard part for you . The MiniZinc language lets users write models in a way that is close to a mathematical formulation of the problem, using familiar notation such as existential and universal quantifiers, sums over index sets, or logical connectives like implications and if-then-else statements. Let's see an example: Imagine you are packing a backpack for a hike. You have a maximum weight capacity of 15 kg . You can choose from four items, each with a specific weight and value. You want to maximize the total value of the items you take without exceeding the weight limit. Available Items: Item 1: Weight = 2 kg, Value = $10 Item 2: Weight = 4 kg, Value = $10 Item 3: Weight = 6 kg, Value = $12 Item 4: Weight = 9 kg, Value = $18 Parameters: Decision Variables: Where: Constraints: Total weight cannot exceed capacity W : Which expands to: Objective Function: Maximize total value: js % Decision variables: 1 if item is included, 0 otherwise var 0..1: x1; var 0..1: x2; var 0..1: x3; var 0..1: x4; % Weight constraint constraint 2 x1 + 4 x2 + 6 x3 + 9 x4 <= 15; % Objective: Maximize total value solve maximize 10 x1 + 10 x2 + 12 x3 + 18 x4; % Output formatting output "x1: ", show x1 , "\n", "x2: ", show x2 , "\n", "x3: ", show x3 , "\n", "x4: ", show x4 , "\n", "Total Value: ", show 10 x1 + 10 x2 + 12 x3 + 18 x4 ; x1: 1 x2: 1 x3: 0 x4: 1 Total Value: 38 Today, in most cases, it's not even necessary to formally model problems from scratch; AI can do that for us in most cases, I repeat . This makes it much easier for developers to express questions in natural language, get answers from the model faster, and iterate or optimize workflows seamlessly. By pairing LLMs with MiniZinc via MCP , you can speed up problem modeling, validate correctness, execute models, and analyze results using natural language, unlocking one of the biggest advantages of working with modern AI agents. This MCP creates a layer of communication between your AI Agent and MiniZinc allowing you to: | Tool | Description | |---|---| | list solvers | Lists every MiniZinc solver installed on the machine. The returned tag names e.g. gecode , chuffed , highs can be passed to solve model . | | validate model | Parses and type-checks MiniZinc model code without solving it . Useful for checking model syntax up front. Returns VALID or INVALID with an error message. | | solve model | Solves a MiniZinc model given as source code: once, exhaustively all solutions , or with a solution / time limit. Returns the status, solution s , objective value for optimization problems , and solver statistics. | | solve model by path | Same as solve model but loads the model and its optional data .dzn file from paths instead of source code. | | get model info | 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 params a model expects. | | get flatzinc | Compiles a model and optional data to FlatZinc text without solving it. Returns the .fzn model, the .ozn output model, and flattening statistics. Useful for debugging and low-level inspection. | A basic one: "Find the optimal solution to a knapsack problem with items having weisghts 2,3,4,5 and values 3,4,5,6 and capacity 7" A tough one: "A banana cake which takes 250g of self-raising flour, 2 mashed bananas, 75g sugar and 100g of butter, and a chocolate cake which takes 200g of self-raising flour, 75g of cocoa, 150g sugar and 150g of butter. We can sell a chocolate cake for $4.50 and a banana cake for $4.00. And we have 4kg self-raising flour, 6 bananas, 2kg of sugar, 500g of butter and 500g of cocoa. The question is how many of each sort of cake should we bake for the fete to maximise the profit." Only two things need to be installed, once per machine : curl -LsSf https://astral.sh/uv/install.sh | sh minizinc executable on PATH 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. Install it globally best if you use it in several projects : uv tool install --from git+https://github.com/carban/minizinc-mcp minizinc-mcp Or run it on demand each time, with nothing installed: uvx --from git+https://github.com/carban/minizinc-mcp minizinc-mcp 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", "--from", "git+https://github.com/carban/minizinc-mcp", "minizinc-mcp" } } } Additionally, this tool aims to support scientific research and the integration of computational models with AI agents. By enabling new approaches to problem-solving, it opens up a wide range of possibilities. If you have new ideas, tools or improvements to this project just let me know commenting this post or creating a new issue in the GitHub repo github.com/carban/minizinc-mcp https://github.com/carban/minizinc-mcp This is open-source project and just getting started, you can star it on GitHub, it helps others find it.