Skip to main content

An MCP server for JupyterCAD that allows you to control it using natural language.

Project description

jupytercad-mcp

An MCP server for JupyterCAD that allows you to control it using 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:

uvx --with jupytercad-mcp jupytercad-mcp

To use the streamable-http transport, use this command instead:

uvx --with jupytercad-mcp jupytercad-mcp streamable-http

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:

    git clone git@github.com:asmith26/jupytercad-mcp.git
    cd jupytercad-mcp
    
  2. Install the OpenAI Agents SDK. A Makefile target is provided for convenience:

    make setup-examples-env
    
  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:

    make jupyter-lab
    
  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:

    make mlflow-ui
    
  7. Run the example with the default instruction, "Add a box with width/height/depth 1":

    make example-openai-agents-client
    

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:

uvx --with jupytercad-mcp jupytercad-mcp streamable-http

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.
  • add_torus: Add a torus to the document.
  • cut: Apply a cut boolean operation between two objects.
  • fuse: Apply a union boolean operation between two objects.
  • intersect: Apply an intersection boolean operation between two objects.
  • chamfer: Apply a chamfer operation on an object.
  • fillet: Apply a fillet operation on an object.
  • set_visible: Sets the visibility of an object.
  • set_color: Sets the color of an object.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupytercad_mcp-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupytercad_mcp-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file jupytercad_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: jupytercad_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jupytercad_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d7e998380557c02638c0f3006600e83a6977451aeb1ccb1df6181c07091986b
MD5 e552062dc83134f1f94b16283bc6b724
BLAKE2b-256 f6cbe8670ec16b20e721ca9b52730eb96f6881f78592b3721578cd03bd89cd5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupytercad_mcp-0.1.0.tar.gz:

Publisher: publish.yaml on asmith26/jupytercad-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jupytercad_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jupytercad_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jupytercad_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3b31e791272ab019633faa3405a31b041e7b329ed7593d722b73657a481e18c
MD5 224bcf9ae8303e6d048bd5a5e572f360
BLAKE2b-256 0e5d34f9e2c84436a4fe41e7790f720831bdb1ddfa0b83217440332e45881585

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupytercad_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on asmith26/jupytercad-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page