Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-slicer

MCP.Pizza Chef: zhaoyouj

MCP-Slicer is a Model Context Protocol server that integrates 3D Slicer with LLM clients like Claude Desktop and Cline. It enables natural language interaction for medical image processing, scene creation, and manipulation by exposing 3D Slicer's MRML nodes and allowing Python code execution within the Slicer environment. This facilitates advanced medical imaging workflows through conversational AI.

Use This MCP server To

List and filter 3D Slicer MRML nodes with detailed properties Execute Python scripts directly in the 3D Slicer environment Control medical image processing workflows via natural language Create and manipulate 3D medical scenes interactively Integrate 3D Slicer capabilities into AI-assisted diagnostic tools

README

logo

MCP-Slicer - 3D Slicer Model Context Protocol Integration

English | 简体中文

Python Version License: MIT PyPI version

MCP-Slicer connects 3D Slicer with model clients like Claude Desktop or Cline through the Model Context Protocol (MCP), enabling direct interaction and control of 3D Slicer. This integration allows for medical image processing, scene creation, and manipulation using natural language.

Features

  1. list_nodes: List and filter Slicer MRML nodes and view their properties

  2. execute_python_code: Execute Python code in the Slicer environment

Installation

Prerequisites

  • 3D Slicer 5.8 or newer
  • Python 3.13 or newer
  • uv package manager

If you're on Mac, please install uv as

brew install uv

On Windows

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

and then

set Path=C:\Users\nntra\.local\bin;%Path%

Otherwise installation instructions are on their website: Install uv

⚠️ Please install UV first

Claude for Desktop Integration

Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json to include the following:

{
  "mcpServers": {
    "slicer": {
      "command": "uvx",
      "args": ["mcp-slicer"]
    }
  }
}

Cline Intergration

{
  "mcpServers": {
    "slicer": {
      "command": "uvx",
      "args": ["mcp-slicer"]
    }
  }
}

Usage

Check Claude Settings

Image

Make sure you see the corresponding slicer tools added to the Claude Desktop App

Image

Image

Open Slicer Web Server

  1. Open the Slicer Web Server module,
  2. ensure the required interfaces are checked,
  3. then start the server

Image

Examples

- list_nodes

What Markups nodes are in the Slicer scene now, list their names, what is their length if it is a line, and what is its angle if it is an angle

Image

- execute python code

Draw a translucent green cube of 8 cm in the Slicer scene, mark its vertices, and then draw a red sphere inscribed in it.

example_code_execute_en

Technical Details

Utilizes existing Slicer Web Server interfaces. For technical details, please see Slicer web server user guide

Limitations & Security Considerations

  • The execute_python_code tool allows running arbitrary Python code in 3D Slicer, which is powerful but potentially dangerous.

    ⚠️ Not recommended for production use.

  • Complex operations may need to be broken down into smaller steps.

Contributing

Contributions are welcome! Feel free to submit Pull Requests.

Disclaimer

This is a third-party integration project, not developed by the 3D Slicer team.

mcp-slicer FAQ

How do I install MCP-Slicer?
Install MCP-Slicer via PyPI using 'pip install mcp-slicer' with Python 3.13+.
Can MCP-Slicer execute custom Python code?
Yes, it supports executing Python code within the 3D Slicer environment for advanced control.
Which LLM clients are compatible with MCP-Slicer?
MCP-Slicer works with clients like Claude Desktop, Cline, and others supporting MCP.
What types of data can MCP-Slicer access in 3D Slicer?
It can list and filter MRML nodes and access their properties for detailed scene information.
Is MCP-Slicer limited to medical imaging tasks?
While optimized for medical imaging, it can be extended for any 3D Slicer scene manipulation.
Does MCP-Slicer require a specific Python version?
Yes, it requires Python 3.13 or higher for compatibility.
How does MCP-Slicer enhance 3D Slicer workflows?
By enabling natural language commands and script execution, it streamlines complex imaging tasks.
Is MCP-Slicer open source?
Yes, it is licensed under the MIT License and available on GitHub.