Docs / 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.
The MCP server is a standalone executable (photonica-mcp.exe) included with your Photonica installation. It connects locally to the running Photonica instance.
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"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"
}
}
}The MCP server exposes 28 tools organized into several categories, giving the assistant comprehensive control over the simulation.
| Category | Tool | Description |
|---|---|---|
| State & measurement | get_state | Retrieve the current scene state and part parameters |
| State & measurement | measure | Measure positions, angles, spot sizes, and optical path lengths |
| Parts | add_part | Add lenses, mirrors, prisms, or structural parts |
| Parts | update_part | Modify parameters like radii, materials (Sellmeier), or position |
| Parts | remove_part | Delete a part from the scene |
| Screens & source | add_screen | Add a detector screen to measure light distribution |
| Screens & source | update_screen | Move or resize a screen |
| Screens & source | update_source | Configure the light source (wavelength, coherence, type) |
| Ray tracing | inspect_ray | Trace a specific ray and return its intersection sequence and Jones vectors |
| Optimisation | autofocus | Automatically adjust distances to minimize spot size |
| Optimisation | optimize | Run damped least-squares optimisation on selected variables |
| Optimisation | tolerance | Perform Monte-Carlo tolerancing on the design |
| Time of flight | light_in_flight | Simulate and visualize light travel time |
| Camera & output | set_camera | Adjust the 3D viewport camera |
| Camera & output | screenshot | Capture an image of the current viewport |
| Camera & output | render_video | Render an animation or time-of-flight video |
| Project | save_project | Save the current scene to disk |
| Project | open_project | Load a saved scene |
| Project | undo | Undo the last action |
| Project | redo | Redo the last undone action |
Try these prompts with your AI assistant to explore its capabilities:
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.