jupytercad-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An MCP server for JupyterCAD that allows you to control it using LLMs/natural language.
https://github.com/user-attachments/assets/7edb31b2-2c80-4096-9d9c-048ae27c54e7
Suggestions and contributions are very welcome.
Usage
The default transport mechanism is stdio. To start the server with stdio, use the following command:
To use the streamable-http transport, use this command instead:
Example
An example using the OpenAI Agents SDK is available at examples/openai_agents_client.py. To run it, follow these steps:
1. Clone the repository and navigate into the directory:
2. Install the OpenAI Agents SDK. A Makefile target is provided for convenience:
3. In examples/openai_agents_client.py, update line 13 to configure a MODEL (see supported models).
4. Run JupyterLab from the project's root directory:
5. In JupyterLab, create a new "CAD file" and rename it to **my_cad_design.jcad**. This file path matches the default JCAD_PATH in the example, allowing you to visualise the changes made by the JupyterCAD MCP server.
6. (Optional) The OpenAI Agents SDK supports tracing to record events like LLM generations and tool calls. To enable it, set USE_MLFLOW_TRACING=True and run the MLflow UI:
7. Run the example with the default instruction, "Add a box with width/height/depth 1":
Interactive Chat Interface
The example includes an interactive chat interface using the OpenAI Agents SDK's
REPL utility. To enable it, set USE_REPL=True.
streamable-http
To use the streamable-http transport, first start the MCP server:
Then, run the example with the TRANSPORT variable set to "streamable-http" in the client example.
Tools
The following tools are available:
- **get_current_cad_design**: Reads the current content of the JCAD document.
- **remove**: Remove an object from the document.
- **rename**: Rename an object in the document.
- **add_annotation**: Add an annotation to the document.
- **remove_annotation**: Remove an annotation from the document.
- **add_occ_shape**: Add an OpenCascade TopoDS shape to the document.
- **add_box**: Add a box to the document.
- **add_cone**: Add a cone to the document.
- **add_cylinder**: Add a cylinder to the document.
- **add_sphere**: Add a sphere to the document.