# optlens

> optlens is an open-source MCP server for developer tools. Debug LP and MILP models: find conflicting constraints, minimal fixes and what-if costs. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Website:** https://optlens.dev
- **Repository:** https://github.com/jjd-lab/optlens
- **MCP Registry name:** io.github.jjd-lab/optlens
- **Categories:** developer tools, analytics and data
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
claude mcp add optlens -- uvx optlens
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "optlens": {
      "command": "uvx",
      "args": [
        "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

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.

---
Source: https://ai-powered.com/mcp/optlens
