Skip to main content
Glama

Google OR-Tools server

by Jacck

MCP-ORTools

제약 조건 해결을 위해 Google OR-Tools를 활용한 모델 컨텍스트 프로토콜(MCP) 서버 구현. 표준화된 제약 조건 모델 명세를 통해 대규모 언어 모델과 함께 사용하도록 설계되었습니다.

개요

MCP-ORTools는 모델 컨텍스트 프로토콜을 통해 Google의 OR-Tools 제약 프로그래밍 솔버와 대규모 언어 모델을 통합하여 AI 모델이 다음을 수행할 수 있도록 합니다.

  • 제약 조건 모델 제출 및 검증
  • 모델 매개변수 설정
  • 제약 조건 만족 및 최적화 문제를 해결합니다.
  • 솔루션 검색 및 분석

설치

  1. 패키지를 설치하세요:

지엑스피1

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

모델 사양

모델은 세 가지 주요 섹션으로 구성된 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 메서드 구문을 사용한 선형 제약 조건
    • 선형 최적화 목표
    • 시간 초과 및 솔버 매개변수
    • 이진 제약 조건 및 관계
    • 포트폴리오 선택 문제
    • 배낭 문제

제약 조건에서 지원되는 작업

  • 기본 산술: +, -, *
  • 비교: . (), . ge (), . 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 }

상태 값:

  • OPTIMAL: 최적의 솔루션을 찾았습니다
  • 실현 가능: 실현 가능한 솔루션을 찾았습니다.
  • 불가능: 해결책이 존재하지 않음
  • 알 수 없음: 해결책을 결정할 수 없습니다.

특허

MIT 라이센스 - 자세한 내용은 라이센스 파일을 참조하세요.

-
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