Skip to content
MCP server

optlens

Debug LP and MILP models: find conflicting constraints, minimal fixes and what-if costs

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
0.0.4
Listing updated
2 days ago

About optlens

optlens is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.

optlens is for the moment a model comes back infeasible, or solves to an answer nobody trusts. It computes the set of constraints that conflict (an IIS), groups them by constraint family, proposes the smallest change per family that restores feasibility, and re-solves every fix before offering it.

It works on a model that already exists and does not write models. Pyomo, gurobipy and PuLP models load directly, as do LP and MPS files. Solving runs on HiGHS, SCIP, or your own Gurobi license, with a hard time limit on every solve.

Beyond the debugger, a session supports what-if edits kept as versions, why-not questions, marginal values and sensitivity, suspicious data values, and side-by-side comparison of scenarios. The authors report a 400-case benchmark with solver-verified answers, with models of up to 837,000 constraints. It runs from Python, any MCP client or a Claude Code plugin, and the project is open source.

Install

Run in a terminal

claude mcp add optlens -- uvx optlens

Add to claude_desktop_config.json

{
  "mcpServers": {
    "optlens": {
      "command": "uvx",
      "args": [
        "optlens"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "optlens": {
      "command": "uvx",
      "args": [
        "optlens"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "optlens": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "optlens"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "optlens": {
      "command": "uvx",
      "args": [
        "optlens"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "optlens": {
      "command": "uvx",
      "args": [
        "optlens"
      ]
    }
  }
}

What it does

Infeasibility diagnosis
Finds the conflicting constraints and groups them by family.
Smallest-fix menu
Offers the minimum change per family that restores feasibility.
What-if versions
Applies edits as versions without touching your model code.
Sensitivity analysis
Reports marginal values and sensitivity for a model.
Scenario comparison
Compares status, objective and metrics across models side by side.
Multiple solvers
Runs on HiGHS or SCIP, or on Gurobi with your own license.

Good for

  • Explain why a scheduling model is infeasible in business terms
  • Find a mistyped input, such as a target entered ten times too large
  • Price each business rule by what it costs the objective
  • Compare two planning scenarios before choosing one
  • Debug a Pyomo model where log_infeasible_constraints shows nothing

Pricing

Open source

Open source; Gurobi requires your own license

Prices change. Check optlens.dev before you buy.

optlens FAQ

Which solvers work?

HiGHS and SCIP are open source; Gurobi works if you bring your own license.

Does it build models?

No. It works on a model that is already built.

What Python version is needed?

Python 3.12 or later.

How do I add it to Claude Code?

Run claude plugin marketplace add jjd-lab/optlens, then claude plugin install optlens@optlens.

Is optlens free?

Yes. optlens is open source, so you can use and self-host it for free.

How do I add optlens to Claude Code?

Run this command in your terminal: claude mcp add optlens -- uvx optlens

What are the best alternatives to optlens?

The closest alternatives to optlens are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

Alternatives to optlens

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Open-source analytics app where an AI agent builds charts and dashboards from your data

    • Remote
    • Open source
    • 7.7K GitHub stars
    • Analytics and data