Skip to main content

OCP Viewer MCP Server

PyPI version License: MIT

An MCP (Model Context Protocol) server that captures screenshots from the OCP CAD Viewer, allowing AI assistants like Cursor to "see" your 3D CAD models.

What it does

When working with CAD tools like CadQuery or Build123d, you can display models in the OCP CAD Viewer using show(). This MCP server lets you ask an AI assistant to capture what's currently displayed, enabling visual feedback and AI-assisted CAD development.

Example workflow:

  1. You're designing a part in a Jupyter notebook with CadQuery
  2. You run show(my_part) to display it in the OCP viewer
  3. You ask the AI: "capture the current view - does this geometry look correct?"
  4. The AI captures a screenshot and can analyze the 3D model visually

Installation

pip install ocp-viewer-mcp

Requirements:

Configuration

Cursor

Add to your ~/.cursor/mcp.json:

{
  "mcpServers": {
    "ocp-viewer": {
      "command": "python",
      "args": ["-m", "ocp_viewer_mcp.server"]
    }
  }
}

If you're using a virtual environment (recommended), specify the full Python path:

{
  "mcpServers": {
    "ocp-viewer": {
      "command": "/path/to/your/venv/bin/python",
      "args": ["-m", "ocp_viewer_mcp.server"]
    }
  }
}

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "ocp-viewer": {
      "command": "python",
      "args": ["-m", "ocp_viewer_mcp.server"]
    }
  }
}

Usage

  1. Open your CadQuery/Build123d project in Cursor or VS Code
  2. Start the OCP CAD Viewer (Cmd+Shift+P → "OCP CAD Viewer: Open Viewer")
  3. Display a model using show(your_model) in a notebook or script
  4. Ask the AI to capture the view:
    • "Capture the current OCP view"
    • "Show me what the model looks like"
    • "Take a screenshot of the CAD viewer"

Tool Reference

capture_ocp_screenshot

Captures a screenshot of the OCP CAD Viewer.

Parameter Type Default Description
port integer 3939 The port where OCP viewer is running
wait_ms integer 1000 Milliseconds to wait for rendering

Returns: A PNG screenshot as a base64-encoded image.

Troubleshooting

"Could not connect to OCP viewer"

  • Make sure the OCP CAD Viewer is open in VS Code/Cursor
  • Check that the viewer backend is running (look for "Viewer backend started" in terminal)
  • Verify the port (default is 3939)

"ocp_vscode not installed"

The MCP server needs ocp-vscode installed in the same Python environment:

pip install ocp-vscode

Screenshot not capturing

  • Make sure a model is displayed (run show(something) first)
  • Try increasing wait_ms if the model is complex

Development

# Clone the repo
git clone https://github.com/dmilad/ocp-viewer-mcp.git
cd ocp-viewer-mcp

# Install with Poetry
poetry install

# Run locally
poetry run python -m ocp_viewer_mcp.server

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

License

MIT

  • OCP CAD Viewer - The VS Code extension this MCP server integrates with
  • CadQuery - Python parametric CAD scripting
  • Build123d - Python CAD scripting with a builder pattern
  • MCP - Model Context Protocol specification

Metadata

Release files for ocp-viewer-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocp-viewer-mcp 0.1.0
File Size Uploaded Provenance
ocp_viewer_mcp-0.1.0.tar.gz 5.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ocp-viewer-mcp 0.1.0
File Interpreter ABI Platform
ocp_viewer_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / ocp_viewer_mcp-0.1.0.tar.gz

Download URL ocp_viewer_mcp-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2fc29bac7b0d3a25a8760b37a58ce372f711059d12a18535a9fe0b0e52ca5e3a
BLAKE2b-256 checksum
How to use checksums
61e526890af47844821fa7bf9cc699ca80f5a03be94a7ba4a0b4ba428ce321ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 25, 2025.

Transparency log

Release files / ocp_viewer_mcp-0.1.0-py3-none-any.whl

Download URL ocp_viewer_mcp-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37f30f50bc410d119735b929f61d0fb8c159729c9013606a9184236885e78d6f
BLAKE2b-256 checksum
How to use checksums
ce23ea7d79ea047430cda8d3d7df15fbda106080cd38f618e35ccf11eb62e1e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 25, 2025.

Transparency log

Security for ocp-viewer-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ocp_viewer_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 25, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page