OCP Viewer MCP Server
Enables AI assistants to capture screenshots from the OCP CAD Viewer, allowing visual analysis and feedback on 3D CAD models created with CadQuery or Build123d.
README
OCP Viewer MCP Server
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:
- You're designing a part in a Jupyter notebook with CadQuery
- You run
show(my_part)to display it in the OCP viewer - You ask the AI: "capture the current view - does this geometry look correct?"
- The AI captures a screenshot and can analyze the 3D model visually
Installation
pip install ocp-viewer-mcp
Requirements:
- Python 3.10+
- OCP CAD Viewer VS Code/Cursor extension
- ocp-vscode Python package (for
show()function)
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
- Open your CadQuery/Build123d project in Cursor or VS Code
- Start the OCP CAD Viewer (Cmd+Shift+P → "OCP CAD Viewer: Open Viewer")
- Display a model using
show(your_model)in a notebook or script - 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_msif 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
Related Projects
- 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.