3dslicer-claude-bridge

brainbloodbarrier/3dslicer-claude-bridge

3.3

If you are the rightful owner of 3dslicer-claude-bridge and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The MCP Slicer Bridge provides Claude Code with programmatic access to 3D Slicer for AI-assisted medical image analysis.

Tools
4
Resources
0
Prompts
0

MCP Slicer Bridge

Model Context Protocol (MCP) server providing Claude Code with programmatic access to 3D Slicer for AI-assisted medical image analysis.

Overview

The MCP Slicer Bridge enables Claude Code to interact with 3D Slicer, a powerful open-source platform for medical image analysis, surgical planning, and radiomics research.

Use Cases:

  • AI-assisted surgical planning with real-time visualization
  • Automated radiomics analysis workflows
  • Interactive medical image segmentation
  • Teaching medical imaging concepts with AI guidance

Features

Tools (12)

ToolDescription
capture_screenshotCapture PNG from any viewport (axial, sagittal, coronal, 3D, full)
list_scene_nodesInspect MRML scene structure and node metadata
execute_pythonExecute Python code in Slicer's environment
measure_volumeCalculate segmentation volumes in mm³/mL
list_sample_dataDiscover available sample datasets
load_sample_dataLoad sample datasets (MRHead, CTChest, etc.)
set_layoutConfigure viewer layout (FourUp, OneUp3D, etc.)
import_dicomImport DICOM files from folder into database
list_dicom_studiesList all studies in DICOM database
list_dicom_seriesList series within a DICOM study
load_dicom_seriesLoad DICOM series as volume
run_brain_extractionBrain extraction/skull stripping (HD-BET or Swiss)

Resources (3)

ResourceDescription
slicer://sceneCurrent MRML scene structure
slicer://volumesLoaded volumes with metadata
slicer://statusConnection health status

Prerequisites

1. 3D Slicer

Download 3D Slicer 5.0+ and enable WebServer extension:

  1. ViewExtension Manager → Search "WebServer" → Install
  2. Restart Slicer
  3. ModulesDeveloper ToolsWebServerStart Server

2. Python Environment

# Install uv package manager
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
cd slicer-bridge
uv sync

Installation

Add to ~/.claude/mcp.json:

{
  "mcpServers": {
    "slicer-bridge": {
      "command": "uv",
      "args": ["--directory", "/path/to/slicer-bridge", "run", "slicer-mcp"],
      "env": {
        "SLICER_URL": "http://localhost:2016"
      }
    }
  }
}

Restart Claude Code to load the configuration.

Usage Examples

Scene inspection:

"What volumes are loaded in Slicer?"

Screenshot capture:

"Show me an axial view of the current volume"

Volume measurement:

"Calculate the volume of the tumor segmentation"

Custom analysis:

"Apply a Gaussian blur with sigma=2.0 to the current volume"

Troubleshooting

ErrorSolution
SLICER_CONNECTION_ERRORStart Slicer, enable WebServer, check port 2016
SLICER_TIMEOUTRestart Slicer (may be frozen)
PYTHON_EXECUTION_ERRORAdd import slicer to code
MCP server not startingCheck mcp.json syntax, verify path, run uv sync

Development

uv run pytest -v                     # Run tests
uv run pytest --cov=slicer_mcp       # Coverage
uv run black src tests               # Format
uv run ruff check src tests          # Lint

Security Notice

This is an educational/research tool for localhost use only. Not suitable for clinical data or production environments. See for details.

Documentation

  • - Quick reference index
  • - Detailed reference documentation

License

Acknowledgments