mcp-slicer
A Model Context Protocol server for 3D Slicer integration
claude mcp add --transport stdio zhaoyouj-mcp-slicer uvx mcp-slicer
How to use
MCP-Slicer bridges 3D Slicer with model clients (e.g., Claude Desktop or Cline) using the Model Context Protocol (MCP). It exposes tools that let you inspect the Slicer scene, run Python code inside Slicer, and capture visual feedback from Slicer views. Specifically, you can list and filter MRML nodes and view their properties, execute Python snippets directly in the Slicer environment, and capture real-time screenshots of the full application, a specific slice view, or the 3D view. This enables a complete feedback loop where the AI can reason about a task, act by issuing Python commands to manipulate Slicer data, and observe results through images sent back to the user interface.
To use it, run the MCP server via your preferred MCP client (configured to communicate with uvx and the mcp-slicer package). Once connected, you’ll access the available tools through the MCP interface: list_nodes to inspect current scene state and properties, execute_python_code to perform operations like creating or modifying models and scenes, and capture_screenshot to provide visual context for downstream reasoning. The integration is designed to work with common MCP clients that support the uvx-based workflow, allowing you to drive Slicer workflows from natural language prompts and inline code.
How to install
Prerequisites\n- 3D Slicer 5.8 or newer\n- Python 3.13 or newer\n- uv package manager\n\nInstall uv (examples shown for macOS and Windows):\nbash\n# macOS (Homebrew)\nbrew install uv\n````\nbash\n# Windows (PowerShell)\npowershell -c "irm https://astral.sh/uv/install.ps1 | iex"\n````\nIf you are on other platforms, follow uv’s installation guidance at https://docs.astral.sh/uv/getting-started/installation/ and ensure uv is available in your PATH.\n\nInstall the MCP-Slicer package (Python):\nbash\npip install mcp-slicer\n\n\nConfigure the MCP server (example with uvx):\nbash\nuvx mcp-slicer\n\nThis will expose the MCP endpoints/commands defined by the mcp-slicer package and allow clients to connect using the uvx workflow. If you need to integrate with Claude or Cline, ensure their settings point to the mcp-slicer server as shown in the README examples, e.g. in Claude: {\n "mcpServers": {\n "slicer": {\n "command": "uvx",\n "args": ["mcp-slicer"]\n }\n }\n}\n
Additional notes
Tips and considerations:\n- Ensure UV is installed before attempting to run the MCP server, as shown in the installation steps.\n- The tools include potentially dangerous capabilities (e.g., executing arbitrary Python code in Slicer). Use with caution, especially in production environments.\n- Verify that your 3D Slicer installation is compatible with the Python version required by mcp-slicer (Python 3.13+ is recommended).\n- The MCP server uses the uvx workflow; make sure uvx is accessible from your shell/terminal where you start the MCP server.\n- If you run into connection issues, confirm that the listener/port settings used by your MCP client match those exposed by uvx.\n- This integration focuses on core actions (list_nodes, execute_python_code, capture_screenshot); for more advanced pipelines, you can script sequences of these operations from your MCP client.\n
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP