3d slicer.com
3d slicer.com logo

3D Slicer

Bridges medical professionals with 3D Slicer's medical imaging platform, enabling MRML node listing and direct Python co...

Created byApr 23, 2025

MCP-Slicer - 3D Slicer Model Context Protocol Integration

[English](README.md) | [ ](README_zh.md)
[![Python Version](https://img.shields.io/badge/python-3.13%2B-blue.svg)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PyPI version](https://img.shields.io/pypi/v/mcp-slicer.svg)](https://pypi.org/project/mcp-slicer/)
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
  1. 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**
**On Windows**
and then
Otherwise installation instructions are on their website: [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
** Please install UV first**

Claude for Desktop Integration

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

Cline Intergration

Usage

Check Claude Settings

Open Slicer Web Server

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

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

- 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.

Technical Details

Utilizes existing Slicer Web Server interfaces. For technical details, please see [Slicer web server user guide](https://slicer.readthedocs.io/en/latest/user_guide/modules/webserver.html)

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.