Skip to main content
Glama

Google OR-Tools server

by Jacck

MCP-ORツール

制約解決にGoogle OR-Toolsを用いたモデルコンテキストプロトコル(MCP)サーバー実装。標準化された制約モデル仕様を通じて大規模言語モデルで使用できるように設計されています。

概要

MCP-ORTools は、モデル コンテキスト プロトコルを介して Google の OR-Tools 制約プログラミング ソルバーを大規模言語モデルと統合し、AI モデルで次のことが可能になります。

  • 制約モデルの送信と検証
  • モデルパラメータを設定する
  • 制約充足問題と最適化問題を解く
  • ソリューションを取得して分析する

インストール

  1. パッケージをインストールします。
pip install git+https://github.com/Jacck/mcp-ortools.git
  1. Claude Desktop を構成する%APPDATA%\Claude\claude_desktop_config.json (Windows) または~/Library/Application Support/Claude/claude_desktop_config.json (macOS) に構成ファイルを作成します。
{ "mcpServers": { "ortools": { "command": "python", "args": ["-m", "mcp_ortools.server"] } } }

モデル仕様

モデルは、次の 3 つの主要なセクションを持つ JSON 形式で指定されます。

  • variables : 変数とそのドメインを定義する
  • constraints : OR-Toolsメソッドを使用した制約のリスト
  • objective : オプションの最適化目的

制約構文

制約には OR-Tools メソッド構文を使用する必要があります。

  • .__le__() 、以下 (<=) を表します。
  • .__ge__()より大きいか等しい (>=) を表します。
  • 等価性 (==) を表す.__eq__()
  • 等しくない (!=) の場合は.__ne__()

使用例

シンプルな最適化モデル

{ "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 } }

ナップサック問題

例: 値が [3,1,2,1]、重量が [2,2,1,1] で、合計重量制限が 2 であるアイテムを選択します。

{ "variables": [ {"name": "p0", "domain": [0, 1]}, {"name": "p1", "domain": [0, 1]}, {"name": "p2", "domain": [0, 1]}, {"name": "p3", "domain": [0, 1]} ], "constraints": [ "(2*p0 + 2*p1 + p2 + p3).__le__(2)" ], "objective": { "expression": "3*p0 + p1 + 2*p2 + p3", "maximize": true } }

追加の制約の例:

{ "constraints": [ "p0.__eq__(1)", // Item p0 must be selected "p1.__ne__(p2)", // Can't select both p1 and p2 "(p2 + p3).__ge__(1)" // Must select at least one of p2 or p3 ] }

特徴

  • OR-Tools CP-SATソルバーの完全サポート
  • JSONベースのモデル仕様
  • サポート対象:
    • 整数変数とブール変数(ドメイン: [最小値、最大値])
    • OR-Toolsメソッド構文を使用した線形制約
    • 線形最適化目標
    • タイムアウトとソルバーパラメータ
    • バイナリ制約と関係
    • ポートフォリオ選択の問題
    • ナップザックの問題

制約内でサポートされている操作

  • 基本的な算術: +、-、*
  • 比較: 。()、。()、。 eq (), .()
  • 変数の線形結合
  • 制約の組み合わせによるバイナリロジック

発達

開発用に設定するには:

git clone https://github.com/Jacck/mcp-ortools.git cd mcp-ortools pip install -e .

モデル応答形式

ソルバーは JSON 形式でソリューションを返します。

{ "status": "OPTIMAL", "solve_time": 0.045, "variables": { "p0": 0, "p1": 0, "p2": 1, "p3": 1 }, "objective_value": 3.0 }

ステータス値:

  • 最適: 最適な解決策が見つかりました
  • 実現可能: 実現可能な解決策が見つかった
  • 実行不可能: 解決策は存在しない
  • 不明: 解決策を決定できませんでした

ライセンス

MITライセンス - 詳細はLICENSEファイルを参照

-
security - not tested
A
license - permissive license
-
quality - not tested

MCP-ORTools は、MCP を介して Google の OR-Tools 制約プログラミング ソルバーを大規模言語モデルと統合し、AI モデルで次のことが可能になります。

制約モデルの提出と検証、モデルパラメータの設定、制約充足と最適化問題の解決、ソリューションの取得と分析

  1. 概要
    1. インストール
      1. モデル仕様
        1. 制約構文
      2. 使用例
        1. シンプルな最適化モデル
        2. ナップサック問題
      3. 特徴
        1. 制約内でサポートされている操作
      4. 発達
        1. モデル応答形式
          1. ライセンス

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol (MCP) server that exposes MiniZinc constraint solving capabilities to Large Language Models.
              Last updated -
              83
              Python
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              MCP-Logic is a server that provides AI systems with automated reasoning capabilities, enabling logical theorem proving and model verification using Prover9/Mace4 through a clean MCP interface.
              Last updated -
              20
              MIT License
              • Linux
              • Apple
            • A
              security
              A
              license
              A
              quality
              This server provides a minimal template for creating AI assistant tools using the ModelContextProtocol, featuring a simple 'hello world' tool example and development setups for building custom MCP tools.
              Last updated -
              1
              1
              8
              TypeScript
              The Unlicense
              • Apple
            • -
              security
              F
              license
              -
              quality
              A production-ready MCP server built with FastAPI, providing an enhanced tool registry for creating, managing, and documenting AI tools for Large Language Models (LLMs).
              Last updated -
              13
              Python

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jacck/mcp-ortools'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server