OptimEngine - Operations Scheduling & Routing Solver

Created By
MicheleCampi3 months ago
Solves Flexible Job Shop Scheduling (FJSP) and Capacitated Vehicle Routing with Time Windows (CVRPTW) using Google OR-Tools. MCP-native for AI agents. 5 tools: optimize_schedule, validate_schedule, optimize_routing, health_check, root.
Overview

⚡ OptimEngine — Operations Intelligence Solver

The first MCP Server for production scheduling, vehicle routing, and bin packing optimization.

An AI-native solver that assigns tasks to machines, deliveries to vehicles, and items to bins optimally using constraint programming. Built for the agentic economy: AI agents discover it, call it, and pay for it — autonomously.

MCP Compatible OR-Tools Python 3.12+ Tests License: MIT


What It Does

OptimEngine solves three families of NP-hard optimization problems that LLMs cannot compute:

1. Scheduling — Flexible Job Shop (FJSP)

Assign tasks to machines optimally with precedence, time windows, machine eligibility, setup times, priorities, and multiple objectives.

2. Routing — CVRPTW

Assign delivery locations to vehicles optimally with capacity constraints, time windows, service times, GPS coordinates, and multiple objectives.

3. Bin Packing

Assign items to bins/containers optimally with weight/volume constraints, item quantities, group constraints, and multiple objectives.

The core insight: LLMs understand optimization requests in natural language but cannot compute optimal solutions. These are NP-hard problems that require specialized solvers. OptimEngine is that solver, exposed as MCP tools that any AI agent can call.


MCP Tools

ToolProblemInputOutput
optimize_scheduleFlexible Job Shop SchedulingJobs, tasks, machines, constraintsOptimal schedule + Gantt + metrics
validate_scheduleSchedule verificationSchedule + constraintsViolations + suggestions
optimize_routingVehicle Routing + Time WindowsDepot, locations, vehicles, capacityOptimal routes + stop times + metrics
optimize_packingBin PackingItems (weight/volume), bins (capacity)Optimal assignments + bin summaries + metrics

Scheduling Capabilities

FeatureDetails
Flexible Job ShopTasks can run on multiple eligible machines
PrecedenceTasks within a job execute in defined order
Time WindowsEarliest start, latest end per job
Machine AvailabilityMachines have operational windows
Setup TimesPer-task setup time before processing
PrioritiesJob priority (1-10) for weighted objectives
4 ObjectivesMinimize makespan, total/max tardiness, balance load
Schedule ValidationVerify existing schedules, get violation reports
Gantt DataReady-to-render visualization in every response

Routing Capabilities

FeatureDetails
Capacity ConstraintsPer-vehicle maximum load
Time WindowsEarliest/latest arrival per location
Service TimesTime spent at each delivery point
GPS CoordinatesHaversine distance from lat/lon
Custom Distance MatrixOverride with your own distances/times
Drop VisitsSkip infeasible locations with penalty
Per-Vehicle LimitsMax travel time/distance per vehicle
4 ObjectivesMinimize distance, time, vehicles, or balance routes

Packing Capabilities

FeatureDetails
Weight + VolumeDual-dimension capacity constraints
Item QuantitiesPack N copies of an item type
Bin TypesMultiple bin sizes with different costs
Group ConstraintsKeep related items in the same bin
Max Items per BinLimit number of items per container
Partial PackingAllow unpacked items for over-constrained problems
4 ObjectivesMinimize bins, maximize value/items, balance load

Quick Start

1. Install & Run

git clone https://github.com/MicheleCampi/optim-engine.git
cd optim-engine
pip install -r requirements.txt
uvicorn api.server:app --host 0.0.0.0 --port 8000

Server starts at http://localhost:8000. Docs at /docs. MCP endpoint at /mcp.

2. Connect via MCP (Claude Desktop, Cursor, etc.)

{
  "mcpServers": {
    "optim-engine": {
      "command": "mcp-proxy",
      "args": ["https://optim-engine-production.up.railway.app/mcp"]
    }
  }
}

Example — Scheduling

curl -X POST https://optim-engine-production.up.railway.app/optimize_schedule \
  -H "Content-Type: application/json" \
  -d '{
    "jobs": [
      {"job_id": "J1", "tasks": [
        {"task_id": "cut", "duration": 3, "eligible_machines": ["M1", "M2"]},
        {"task_id": "weld", "duration": 2, "eligible_machines": ["M2"]}
      ], "due_date": 10},
      {"job_id": "J2", "tasks": [
        {"task_id": "cut", "duration": 4, "eligible_machines": ["M1"]},
        {"task_id": "weld", "duration": 3, "eligible_machines": ["M2"]}
      ], "due_date": 12}
    ],
    "machines": [{"machine_id": "M1"}, {"machine_id": "M2"}],
    "objective": "minimize_makespan"
  }'

Example — Routing

curl -X POST https://optim-engine-production.up.railway.app/optimize_routing \
  -H "Content-Type: application/json" \
  -d '{
    "depot_id": "warehouse",
    "locations": [
      {"location_id": "warehouse", "demand": 0},
      {"location_id": "customer_A", "demand": 20, "time_window_end": 3000, "service_time": 10},
      {"location_id": "customer_B", "demand": 15, "time_window_end": 4000, "service_time": 10},
      {"location_id": "customer_C", "demand": 25, "time_window_end": 5000, "service_time": 15}
    ],
    "vehicles": [
      {"vehicle_id": "truck_1", "capacity": 40},
      {"vehicle_id": "truck_2", "capacity": 40}
    ],
    "distance_matrix": [
      {"from_id": "warehouse", "to_id": "customer_A", "distance": 500, "travel_time": 500},
      {"from_id": "warehouse", "to_id": "customer_B", "distance": 800, "travel_time": 800},
      {"from_id": "warehouse", "to_id": "customer_C", "distance": 600, "travel_time": 600},
      {"from_id": "customer_A", "to_id": "warehouse", "distance": 500, "travel_time": 500},
      {"from_id": "customer_A", "to_id": "customer_B", "distance": 400, "travel_time": 400},
      {"from_id": "customer_A", "to_id": "customer_C", "distance": 700, "travel_time": 700},
      {"from_id": "customer_B", "to_id": "warehouse", "distance": 800, "travel_time": 800},
      {"from_id": "customer_B", "to_id": "customer_A", "distance": 400, "travel_time": 400},
      {"from_id": "customer_B", "to_id": "customer_C", "distance": 300, "travel_time": 300},
      {"from_id": "customer_C", "to_id": "warehouse", "distance": 600, "travel_time": 600},
      {"from_id": "customer_C", "to_id": "customer_A", "distance": 700, "travel_time": 700},
      {"from_id": "customer_C", "to_id": "customer_B", "distance": 300, "travel_time": 300}
    ],
    "objective": "minimize_total_distance"
  }'

Example — Bin Packing

curl -X POST https://optim-engine-production.up.railway.app/optimize_packing \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {"item_id": "laptop", "weight": 3, "volume": 8, "value": 1200, "quantity": 10},
      {"item_id": "monitor", "weight": 8, "volume": 25, "value": 500, "quantity": 5},
      {"item_id": "keyboard", "weight": 1, "volume": 3, "value": 80, "quantity": 20}
    ],
    "bins": [
      {"bin_id": "small_box", "weight_capacity": 20, "volume_capacity": 50, "cost": 5, "quantity": 5},
      {"bin_id": "large_box", "weight_capacity": 50, "volume_capacity": 120, "cost": 12, "quantity": 3}
    ],
    "objective": "minimize_bins"
  }'

Use Cases

  • Manufacturing: Production scheduling for contract manufacturing (cosmetics, pharma, food)
  • Logistics: Last-mile delivery routing with time windows and capacity
  • Warehouse: Bin packing for palletization, container loading, order fulfillment
  • Cloud/IT: Resource allocation (VMs to servers, jobs to clusters)
  • Food Delivery: Multi-driver route optimization
  • Supply Chain: End-to-end scheduling + routing + packing

Architecture

AI Agent (Claude, GPT, Gemini, etc.)
    ▼ MCP Protocol
┌────────────────────────────────────────┐
│  FastAPI + fastapi-mcp                  │  ← API layer
├────────────┬────────────┬──────────────┤
│ Scheduling │  Routing   │  Bin Packing │
│ CP-SAT     │  Routing   │  CP-SAT      │
│            │  Library   │              │  ← OR-Tools solvers
├────────────┴────────────┴──────────────┤
│  Pydantic Models                        │  ← Schema contract
└────────────────────────────────────────┘

Stack: Python 3.12 · FastAPI · OR-Tools (CP-SAT + Routing) · fastapi-mcp · Pydantic v2


Tests

pip install pytest
python -m pytest tests/ -v

97 tests covering: flexible job shop, time windows, due dates, machine availability, setup times, CVRPTW routing, capacity, GPS distances, bin packing, weight/volume constraints, group constraints, partial packing, and realistic manufacturing/delivery/warehouse scenarios.


Landing Page

🌐 optim-engine.vercel.app

Marketplace Listings


License

MIT


Built with Google OR-Tools — the optimization toolkit used by Google for fleet routing, scheduling, and resource allocation at scale.

Project Info
Created At
3 months ago
Updated At
3 months ago
Author Name
MicheleCampi
Star
-
Language
-
License
-
Category

Recommend Servers

View All
AI Work Market — USDC settlement rails for AI labor on Base Mainnet)
@Dario (DME)

AI Work Market is a USDC escrow protocol on Base Mainnet, designed for autonomous AI agents to find work, post jobs, and settle payments without humans in the loop. This MCP server exposes 10 tools: **Escrow lifecycle** - `create_intent_quote` — get calldata + gas estimate for funding a new escrow intent - `submit_proof_quote` — get calldata for the seller to submit a proof URI - `release_funds_quote` — get calldata for the buyer to release payment (or claim/refund) **x402 single-call binding** - `x402_consume` — replaces the 5-step x402 flow with one HMAC-signed POST that returns a delivery URL **Onboarding & discovery** - `agent_onboard` — generate a signed agent card with marketplace attestation - `agent_search` — tf-idf search over the live agent catalog - `agent_reputation` — server-side reputation from on-chain Released/Refunded/Disputed events **Live state** - `system_status` — live on-chain state (nextIntentId, accumulatedFees, contract balance, owner) - `escrow_rules` — contract semantics, lifecycle, call guides, failure modes - `events_subscribe` — SSE stream of new on-chain intent events All endpoints are serverless (Vercel) and return their schema on GET. No browser, no wallet UI required for an agent to integrate. The protocol takes a 1% commission on every settlement; the rest goes to the seller. The full AgentCard is at `/.well-known/agent-card.json` (A2A-compatible). The OpenAPI 3.0.3 spec is at `/.well-known/openapi.json` with `components.securitySchemes` (none, hmacX402). `robots.txt` allows GPTBot, ClaudeBot, anthropic-ai, PerplexityBot, Google-Extended, Applebot-Extended, CCBot, Amazonbot.

7 hours ago
Bring your real authenticated browser session to AI coding agents. Local-first MCP server + Chrome MV3 extension. No cloud. No telemetry.
@Cubenest

peek records the user's actual logged-in browser (DOM via rrweb, console events, network metadata, optional response bodies via opt-in Deep capture) through a Chrome MV3 extension. The extension ships events through a native-messaging stdio bridge to a local MCP server (peek-mcp), which persists them to a SQLite database at ~/.peek/sessions.db. AI coding agents (Claude Code, Cursor, Cline, Windsurf) read sessions from the database via 10 MCP tools: Tool What it does list_recent_sessions List recently recorded sessions (id, origin, ts, event count). get_session_summary LLM-readable narrative summary of a session. get_session_console_errors Console errors recorded in a session. get_session_network_errors Failed/notable network requests in a session. get_user_action_before_error Last N user actions before a console error. generate_playwright_repro Generate a runnable Playwright test from a session. get_dom_snapshot Reconstruct the DOM at a given timestamp. query_dom_history Timeline of attribute/text changes for a selector. request_authorization Side-panel consent for write actions (Level 3). execute_action Dispatch a UI action (gated by permission level + destructive blocklist). Why local-first matters Every other "browser session for AI" tool ships to a vendor cloud. peek's SQLite + extension live on the user's machine — no remote endpoints, no telemetry. The privacy policy (docs/peek/PRIVACY_POLICY.md) is the source of truth. Install # 1. Add the MCP server to Claude Code claude mcp add peek -- npx -y @peekdev/mcp # 2. Install the Chrome extension from the Chrome Web Store # (link added once the CWS listing is approved)

a day ago