Docs / MCP reference

MCP reference

Photonica features a built-in Model Context Protocol (MCP) server, allowing AI assistants like Claude to directly control the application, design optical systems, and run simulations.

Setup

The MCP server is a standalone executable (photonica-mcp.exe) included with your Photonica installation. It connects locally to the running Photonica instance.

Claude Code

To use Photonica with Claude Code, run the following command in your terminal, replacing <folder> with your Photonica installation path:

claude mcp add photonica -- "<folder>\photonica-mcp.exe"

Claude Desktop

To use it with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "photonica": {
      "command": "C:\\Path\\To\\Photonica\\photonica-mcp.exe"
    }
  }
}

Tools reference

The MCP server exposes 28 tools organized into several categories, giving the assistant comprehensive control over the simulation.

CategoryToolDescription
State & measurementget_stateRetrieve the current scene state and part parameters
State & measurementmeasureMeasure positions, angles, spot sizes, and optical path lengths
Partsadd_partAdd lenses, mirrors, prisms, or structural parts
Partsupdate_partModify parameters like radii, materials (Sellmeier), or position
Partsremove_partDelete a part from the scene
Screens & sourceadd_screenAdd a detector screen to measure light distribution
Screens & sourceupdate_screenMove or resize a screen
Screens & sourceupdate_sourceConfigure the light source (wavelength, coherence, type)
Ray tracinginspect_rayTrace a specific ray and return its intersection sequence and Jones vectors
OptimisationautofocusAutomatically adjust distances to minimize spot size
OptimisationoptimizeRun damped least-squares optimisation on selected variables
OptimisationtolerancePerform Monte-Carlo tolerancing on the design
Time of flightlight_in_flightSimulate and visualize light travel time
Camera & outputset_cameraAdjust the 3D viewport camera
Camera & outputscreenshotCapture an image of the current viewport
Camera & outputrender_videoRender an animation or time-of-flight video
Projectsave_projectSave the current scene to disk
Projectopen_projectLoad a saved scene
ProjectundoUndo the last action
ProjectredoRedo the last undone action

Example prompts

Try these prompts with your AI assistant to explore its capabilities:

Validation suite

Photonica's validation suite consists of 33 rigorous physical checks. All of these tests were automated and verified entirely through the MCP interface, demonstrating its accuracy and control capabilities. See the validation report for details.