Local stdio FastMCP server for Tidy3D
Project description
Tidy3D MCP
A local Model Context Protocol (MCP) server that lets clients drive the Flexcompute Tidy3D viewer and consume viewer artifacts without needing a browser session.
Capabilities
- Authenticates against the remote FlexAgent MCP endpoint using OAuth.
- Proxies viewer automation commands such as launching the viewer, rotating the camera, toggling structure visibility, running simulation health checks, and capturing screenshots.
- Returns viewer captures as MCP images so downstream tools can consume them immediately.
Requirements
- Python 3.10 or newer
uvfor dependency management- Network access to the target FlexAgent MCP deployment (defaults to the hosted
https://flexagent.dev-simulation.cloud/endpoint)
Installation
uv sync
This resolves the project environment and installs the tidy3d-mcp console entry point.
Usage
Start the server from the project root:
uv run tidy3d-mcp
The server listens on stdio for MCP requests and forwards them to the remote FlexAgent server. The first invocation prompts OAuth consent in a browser, then stores the token under the cache location shown in Configuration.
Integrating with MCP Hosts
- VS Code / Cursor: Select the "Tidy3D MCP" binary (
uv run tidy3d-mcp) when configuring an stdio MCP provider. - Custom hosts: Launch the command above and connect using the Model Context Protocol over the process stdio pipes.
Configuration
Environment variables control the server at startup:
| Variable | Purpose | Default |
|---|---|---|
REMOTE_MCP_URL |
Target MCP endpoint to proxy. | https://flexagent.dev-simulation.cloud/ |
OAuth tokens persist under ~/.fastmcp/oauth-mcp-client-cache/<endpoint>/<workspace> to avoid
re-authentication per session. Delete the cache directory to force a new OAuth consent flow.
Tools Exposed to Clients
| Tool | Description |
|---|---|
start_viewer |
Launches the viewer for a simulation file and returns the resolved viewer_id. |
rotate_viewer |
Rotates the active viewer toward the requested direction (e.g. TOP, BOTTOM). |
show_structures |
Applies a boolean visibility array to the current viewer structures. |
capture |
Captures the current frame of the viewer. |
check_simulation |
Returns validation warnings or errors reported by the viewer. |
Development Tips
- Run
uv run ruff checkto lint the project anduv run ruff formatto apply formatting. - The server relies on
fastmcp.as_proxy; consult the upstream FastMCP documentation for advanced configuration such as custom authentication flows or additional transports. - When debugging viewer interactions, inspect the returned
data_urlto confirm that capture payloads reach the client.
Troubleshooting
- OAuth consent window never opens: Ensure the machine can launch a browser and that pop-up blockers allow the OAuth window.
- Viewer fails to start: Verify the simulation file exists, the MCP host provides the correct working directory, and the remote FlexAgent endpoint is reachable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tidy3d_mcp-0.8.0.tar.gz.
File metadata
- Download URL: tidy3d_mcp-0.8.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cb9d90d02a54a5f59210465288b26647c93227920496bdf9be99e8ed8bfdc86
|
|
| MD5 |
664787ee8931577fc3aa96fd0044274d
|
|
| BLAKE2b-256 |
b54099e5dfe77aa00ba7cfc156d512f5d8d72f6d8419bd230f42727d04bdf7bf
|
File details
Details for the file tidy3d_mcp-0.8.0-py3-none-any.whl.
File metadata
- Download URL: tidy3d_mcp-0.8.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57a788828688f5946c1cb98f8574f274985913ed4dc69ae0aec19e86812feac4
|
|
| MD5 |
43d33c629d2b18d10ca5bce29f8d7062
|
|
| BLAKE2b-256 |
b778d22b4fc0928d455dae8b12488882029f50b00a443dba17598f46824d37dc
|