LensBench MCP
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LensBench MCP import my design.zmx and run an MTF analysis"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LensBench MCP (lensbench-mcp)
Platform requirement: Windows 10 / 11 (64-bit) for Free, Personal Basic and Personal Pro desktop editions (macOS & Linux are supported on Enterprise).
Official Model Context Protocol (MCP) launcher for LensBench by OpticChat (optic.chat) — a text-first optical lens design workbench with a built-in native ray-tracing and optimization engine, bidirectional Zemax .zmx interoperability, deterministic evidence IDs (ev-...) and diff-first human review.
LensBench ships its own local optical calculation engine and requires no external optical software — standard MCP and CLI are free across every edition (the Free edition covers learning, evaluation and teaching), letting you connect Claude Code, Claude Desktop, Cursor, VS Code (GitHub Copilot), OpenAI Codex or Google Antigravity with zero optic.chat token usage.
Key Capabilities
Plain-text
.lensDSL: Git-diffable prescriptions using standard Zemax conventions (OBJ=0 … IMA, post-surface glass,mm/µm/°).Bidirectional
.zmx&.seqInterop: Import existing.zmxfiles, inspect prescriptions, reconcile paraxial/spot/MTF/Seidel numbers, and export.zmx.Zero Hallucinated Numbers: Every optical analysis returns a deterministic
ev-...evidence ID binding the prescription hash, engine build and sampling parameters, plus framed PNG plots directly to multimodal models.Diff-First Safety & Undo: Mutating tools support
dry_run=trueto preview.lensdiffs and before/afterEFFL / BFL / FNO / TOTRbefore applying; every edit is journaled and reversible.Context-Friendly On-Demand Toolset (
--toolset auto): Pins 33 core tools (open,new,import_zmx,show,check,lens_apply,set,paraxial,spot,mtf,field_curvature,seidel,plot,spec_add,verify,optimize,job_*,find_tools,run_tool) while dynamically unlocking tolerancing, thermal defocus, ghost paths, ISO 10110 / GB 2D drawings, 3D STEP CAD and multi-physics study steps on demand.Strict Workspace Sandbox: File reads and writes are confined to
--root(E-PATH-ROOTblocks anything outside, including symlinks and..), and untrusted strings inside third-party.lens/.zmxfiles are fenced inside⟦ ⟧markers.
Related MCP server: DiffBeam MCP Server
Quick Setup (2 Minutes)
Step 1 — Install LensBench Desktop & Sign In (Windows 10/11 x64)
Download the code-signed installer
LensBench-Setup-<version>.exefrom optic.chat/en/install.html (direct release post with SHA-256).Sign in once with your free
optic.chataccount inside the desktop app, or from a terminal using the bundled CLI (bridge\lb.exeinside your LensBench install folder, default%LOCALAPPDATA%\Programs\LensBench\bridge\lb.exe):& "$env:LOCALAPPDATA\Programs\LensBench\bridge\lb.exe" login # Headless / remote session: & "$env:LOCALAPPDATA\Programs\LensBench\bridge\lb.exe" login --device
Step 2 — Connect Your MCP Client
Option A: Zero-config via npx or uvx
Add to your client's MCP configuration (.mcp.json, claude_desktop_config.json, ~/.cursor/mcp.json, or ~/.gemini/config/mcp_config.json):
{
"mcpServers": {
"lensbench": {
"command": "npx",
"args": ["-y", "lensbench-mcp", "--root", "D:/lens-projects"]
}
}
}Or with Python uvx:
{
"mcpServers": {
"lensbench": {
"command": "uvx",
"args": ["lensbench-mcp", "--root", "D:/lens-projects"]
}
}
}For VS Code (.vscode/mcp.json), use the top-level "servers" key:
{
"servers": {
"lensbench": {
"type": "stdio",
"command": "npx",
"args": ["-y", "lensbench-mcp", "--root", "${workspaceFolder}"]
}
}
}Option B: Direct local binary via lb mcp-config
Once LensBench is installed, generate or merge client configs directly using bridge\lb.exe (shown below assuming bridge is on PATH, or replace lb with "$env:LOCALAPPDATA\Programs\LensBench\bridge\lb.exe"):
lb mcp-config --client claude-code --lang en --write
lb mcp-config --client claude-desktop --lang en --write
lb mcp-config --client cursor --scope user --root D:/lens-projects --lang en --write
lb mcp-config --client vscode --lang en --write
lb mcp-config --client codex --lang en
lb mcp-config --client antigravity --lang en --writePrivacy & Local Computation
Local computation: Ray tracing, optimization and file I/O run locally on your machine; LensBench never uploads your design files (
.lensprescriptions and scene project files stay on disk).Online features & diagnostics: Standard local MCP checks account credentials and logs daily entry-point counts without uploading prescriptions. If you invoke online built-in AI, automated proposals or diagnostic advice, LensBench sends diagnostic information and analysis metrics computed from the design to
optic.chatservers or backend LLM providers; we cannot rule out that hackers or backend LLM providers could reverse-engineer part or all of a design prescription from those diagnostics. See the full Privacy Policy and Terms of Use.
Links & Support
Website & Docs: https://optic.chat/en/ · AI & MCP Guide · Zemax Mapping
Community & Bug Reports: https://forum.optic.chat
Contact:
support@optic.chatLauncher License: MIT (
bin/lensbench-mcp.js&py_launcher/contain zero proprietary optical kernel code; LensBench Desktop itself is governed by the LensBench Terms of Use).
Available Tools
17 toolscheckB
Run full DSL, glass, build and thickness/clearance diagnostics.
Inputs: no named parameters.
export_zmxC
Export the active lens to Zemax .zmx.
Inputs: out.
find_toolsB
Search extended tools (tolerancing, thermal, ghost, housing, ISO 10110 drawings, STEP CAD) by stage or keyword.
Inputs: query, stage.
import_zmxB
Import a sequential Zemax .zmx file into .lens format and open it in the session.
Inputs: zmx_path (required).
lens_applyB
Apply one or more .lens DSL statements in a single call (preview with dry_run=true). [Mutates design]
Inputs: statements (required), dry_run.
mtfC
Compute polychromatic FFT MTF (tangential & sagittal) vs diffraction limit.
Inputs: max_freq.
newB
Create a new lens design from a template (singlet, cooke, blank) and open it. [Mutates design]
Inputs: path (required), template.
openB
Open a .lens file or design folder as the active session.
Inputs: path (required).
optimizeB
Optimize active variables to minimize the merit function. [Mutates design] [Long-running]
Inputs: mode, dry_run, background.
paraxialC
Compute paraxial system data (EFFL, BFL, F/#, pupils, TOTR, cardinal points).
Inputs: no named parameters.
plotC
Render framed publication-grade figures (PNG/SVG/PDF) with evidence id.
Inputs: kind (required).
run_toolC
Execute an extended tool discovered via find_tools.
Inputs: name (required), arguments.
setB
Modify parameters on a single optical surface (minimal edit preserving comments). [Mutates design]
Inputs: surf (required), values (required), dry_run.
showB
Display the lens prescription table (Lens Data Editor view).
Inputs: no named parameters.
spec_addC
Append acceptance specification (spec) rows with explicit units.
[Mutates design]
Inputs: spec (required), dry_run.
spotB
Compute RMS and geometric spot radii (µm) across fields and wavelengths.
Inputs: rings.
verifyB
Independently evaluate gating spec rows using canonical sampling.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools target distinct optical-design actions such as creation, import/export, analysis, plotting, specification, and optimization. There is some overlap between `lens_apply` and `set` (both mutate design parameters), and `new` vs `open` both establish an active session, but the descriptions clarify the boundaries.
Names are readable and mostly lowercase, but they mix single verbs (`new`, `show`, `check`, `set`), verb_noun compounds (`import_zmx`, `find_tools`), and noun_verb compounds (`lens_apply`, `spec_add`). The inconsistent ordering and use of domain nouns rather than a uniform verb_noun pattern makes the convention only moderately predictable.
The server has 17 tools, which is somewhat heavy but justified by the broad optical-design workflow: creation, import/export, editing, diagnostics, analyses, specs, verification, optimization, and extended tools. Each tool maps to a reasonably distinct step rather than redundant functionality.
The surface covers the core lifecycle well: create/open/import, edit, inspect, analyze, add and verify specs, optimize, plot, and access extended domains like tolerancing via `find_tools`/`run_tool`. Minor lifecycle gaps such as explicit save/close or session-management operations remain, but core design workflows are well supported.
Maintenance
Related MCP Connectors
Optical design, simulation and analysis with GPU-powered ray tracing. Import from Zemax and CAD.
Optical engineering for AI agents: generic GPU ray tracing, freeform surface design, CAD export
Inspect, edit, and simulate an open Modeloop control-system model from your coding agent.
Build, check, and export parametric CAD models in your ForgeCAD Projects from your AI agent.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to control Ansys Zemax OpticStudio via ZOS-API, allowing optical design tasks like aperture settings, optimization, and analysis through natural language.19-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents and engineering tools to validate and simulate Gaussian beam optical systems, search component catalogs, and create immutable design links for optical design workflows.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceSafety-first MCP server enabling AI assistants to drive Zemax OpticStudio sequential-mode optical design workflows, including a mock backend for validation.1-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to autonomously perform end-to-end optical design and optimization tasks in Zemax OpticStudio, including modeling, ray tracing, optimization, manufacturing audits, and aberration analysis with closed-loop feedback.6MIT