optlens MCP server
io.github.jjd-lab/optlens·v0.0.4Debug and explain LP/MILP models: why infeasible, the smallest fix, what-if and sensitivity.
not scanned yet
0 stars183 downloads/wk
Reviews
Write oneNobody has reviewed optlens yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
optlens tools
No tool declarations could be read from the package source. They show once the server is installed.
How optlens compares
Against every graded MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 92/100
- higher than 95% of 48,255 servers
- Downloads a week
- 183
- more than 74% of 12,191 servers with a package
Release history: 2 versions in the registry since 2026-10-08, latest 2026-10-24, typically one every 16 days.
Install optlens in Claude Code, Cursor or VS Code
claude mcp add optlens -- uvx optlens
What the publisher says
From the optlens repository's README, as published. We do not edit it. Read it on GitHub
optlens
A solver-agnostic debugger and explainer for LP and MILP models. Give it a model that is infeasible, or one that solves to an answer you don't trust. optlens finds the conflicting constraints, the smallest changes that fix them, and what each change costs. Every result is text that an agent or a person can read. Use it from your own Python, from Claude Code through the plugin, or from any MCP client.
optlens works on a model that is already built. It does not write models.
<!-- mcp-name: io.github.jjd-lab/optlens -->
Install
Python 3.12 or later:
pip install "optlens[scip,mcp]" # core: numpy, scipy, HiGHSTo run the quickstart below or the tests, clone the repository and install it from the clone (git clone https://github.com/jjd-lab/optlens && cd optlens && pip install ".[scip,mcp]").
Some networks cannot reach GitHub, for example behind a proxy or a VPN. There, copy the source over another way, such as a zip of the repository. Install it with pip install "[scip,mcp]", and add the Claude Code plugin with claude plugin marketplace add .
Quickstart
import optlens as od
from optlens.session import Session, Version
if __name__ == "__main__": # solves run in worker processes, which start by re-importing this script
md = od.load("tests/fixtures/ex_milp_tutorial__rhs_tighten__0.mps") # LP or MPS
s = Session({"v0": Version(md, None, "original model")})
print(s.get_model_overview()) # size, status (here INFEASIBLE), constraint families
print(s.compute_iis()) # the conflicting constraints, grouped by family
print(s.fix_menu()) # the smallest change per family that restores feasibility
print(s.modify_and_resolve(changes=[{"action": "set_rhs", "name": "resource[Monika]", "upper": 1}]))Save it as a file and run it from the repository root. Keep the if name == "main": guard in any script that solves. Solves run in worker processes. Windows starts them with spawn, and each one re-imports the script. Without the guard, the script runs again in every solver process.
Every Session method returns text, and optlens.session.TOOLS holds the matching JSON schemas for an agent. A session also covers feasibility relaxation, what-if edits as versions, why-not questions, sensitivity and marginal values, suspicious data values, and comparisons between versions or models.
A model built in Pyomo, gurobipy or PuLP loads directly, from the object or from the file that builds it. optlens runs the file without its if name == "main": block and stops at the first solve call (optimize(), solve()). It reads the model of that call. Nothing is solved, so a large gurobipy model loads on Gurobi's size-limited license.
md = od.from_object(model) # a Pyomo ConcreteModel, gurobipy Model or PuLP LpProblem
md = od.load("my_model.py") # the model it solves, else its one model or build_model()
md = od.load("my_model.py:make_scenario") # a named model, or a function with no arguments that returns oneLP files written by Gurobi (bracketed names, which HiGHS rejects) load without gurobipy.
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
optlens: common questions
- Is optlens MCP server safe?
- Yes, by our scan: it is graded A (92/100). Read the optlens safety report
- How do I install optlens?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does optlens need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is optlens maintained?
- The last commit was 27 days ago (2026-10-08). The latest release is v0.0.4.
- How does optlens compare with other MCP servers?
- safety score 92/100 (higher than 95% of 48,255 servers); downloads a week 183 (more than 74% of 12,191 servers with a package). Full comparison.