OR-Tools

by jacck

9 stars
318 downloads
Not rated
GitHub

About

Integrates Google's OR-Tools to solve constraint satisfaction and optimization problems for decision-making in logistics and operations research.

Details

Author
jacck
Repository
Jacck/mcp-ortools
GitHub stars
9
Downloads
318
License
MIT License
Categories
AI, Design, Developer Tools, Search, Infrastructure, Other

- Integrates Google OR-Tools CP-SAT solver
- JSON-based model specification
- Supports integer and boolean variables
- Linear constraints using OR-Tools method syntax
- Linear optimization objectives and solver parameters

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name OR-Tools
    Command (node, npx, python, etc.) python
    Arguments
    • Argument 1 -m
    • Argument 2 mcp_ortools.server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Install the package:

pip install git+https://github.com/Jacck/mcp-ortools.git

2. Configure Claude Desktop
Create the configuration file at %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
"mcpServers": {
"ortools": {
"command": "python",
"args": ["-m", "mcp_ortools.server"]
}
}
}

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "or-tools": {
            "cwd": null,
            "env": {},
            "args": [
                "-m",
                "mcp_ortools.server"
            ],
            "shell": false,
            "command": "python"
        }
    }
}

Linux

{
    "cwd": null,
    "env": [],
    "args": [
        "-m",
        "mcp_ortools.server"
    ],
    "shell": false,
    "command": "python"
}

Macos

{
    "cwd": null,
    "env": [],
    "args": [
        "-m",
        "mcp_ortools.server"
    ],
    "shell": false,
    "command": "python"
}

Windows

{
    "cwd": null,
    "env": [],
    "args": [
        "-m",
        "mcp_ortools.server"
    ],
    "shell": false,
    "command": "python"
}

MCP-ORTools

A Model Context Protocol (MCP) server implementation using Google OR-Tools for constraint solving. Designed for use with Large Language Models through standardized constraint model specification.

Overview

MCP-ORTools integrates Google's OR-Tools constraint programming solver with Large Language Models through the Model Context Protocol, enabling AI models to:
- Submit and validate constraint models
- Set model parameters
- Solve constraint satisfaction and optimization problems
- Retrieve and analyze solutions

Installation

1. Install the package:

pip install git+https://github.com/Jacck/mcp-ortools.git

2. Configure Claude Desktop
Create the configuration file at %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
"mcpServers": {
"ortools": {
"command": "python",
"args": ["-m", "mcp_ortools.server"]
}
}
}

Model Specification

Models are specified in JSON format with three main sections:
- variables: Define variables and their domains
- constraints: List of constraints using OR-Tools methods
- objective: Optional optimization objective

Constraint Syntax

Constraints must use OR-Tools method syntax:
- .__le__() for less than or equal (<=)
- .__ge__() for greater than or equal (>=)
- .__eq__() for equality (==)
- .__ne__() for not equal (!=)

Usage Examples

Simple Optimization Model

{
    "variables": [
        {"name": "x", "domain": [0, 10]},
        {"name": "y", "domain": [0, 10]}
    ],
    "constraints": [
        "(x + y).__le__(15)",
        "x.__ge__(2  y)"
    ],
    "objective": {
        "expression": "40  x + 100 * y",
        "maximize": true
    }
}

Knapsack Problem

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.