3D Slicer logo

3D Slicer

Community
zhaoyouj

A Model Context Protocol server for 3D Slicer integration

Publisherzhaoyouj
Repositorymcp-slicer
LanguagePython
Forks
5
Stars
39
Available tools
3
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    3D Slicer exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 3 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    39 stars and 5 forks from the linked repository.

MCP-Slicer - 3D Slicer Model Context Protocol Integration

English | 简体中文

Python Version License: MIT PyPI version PyPI - Downloads

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

  3. capture_screenshot: Capture real-time screenshots of Slicer views

    • Full application window (including module panels)
    • Individual slice views (Red/Yellow/Green)
    • 3D rendering view
    • Enables complete REACT loop with visual feedback

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

bash
brew install uv

On Windows

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

and then

bash
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:

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

Cline Intergration

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

Usage

Check Claude Settings

Open Slicer Web Server

  1. Open the Slicer Web Server module,
  2. ensure the required interfaces are checked,
  3. 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.

- capture_screenshot

Capture the current state of Slicer to provide visual feedback to AI

Usage examples:

  • capture_screenshot() - Capture full application window
  • capture_screenshot(view_type="slice", view_name="red") - Capture Red slice view
  • capture_screenshot(view_type="3d", camera_axis="A") - Capture 3D view from anterior

This enables a complete REACT loop where AI can:

  1. Reason about what to do
  2. Act using execute_python_code
  3. Observe the result using capture_screenshot

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.

Installation

TypingMind
Prerequisites:

Node.js 18+

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

Available Tools

  • list_nodes

    $2d

  • execute_python_code

    $2e

  • capture_screenshot

    $2f

Use 3D Slicer MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once 3D Slicer is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add 3D Slicer as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the 3D Slicer MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "3d-slicer": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-slicer"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the 3D Slicer MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the 3D Slicer MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 3D Slicer to help me with this task?
3D Slicer
Sure. I read it.
Here is what I found using 3D Slicer.

Frequently asked questions

What is the 3D Slicer MCP server used for?

3D Slicer is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use 3D Slicer MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use 3D Slicer with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use 3D Slicer MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With 3D Slicer connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect 3D Slicer MCP to TypingMind?

3D Slicer runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does 3D Slicer MCP provide in TypingMind?

3D Slicer exposes 3 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use 3D Slicer MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If 3D Slicer requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇