MCP-Slicer
MCP-Slicer - 3D 슬라이서 모델 컨텍스트 프로토콜 통합
MCP-Slicer는 모델 컨텍스트 프로토콜(MCP)을 통해 3D 슬라이서를 Claude Desktop이나 Cline과 같은 모델 클라이언트와 연결하여 3D 슬라이서의 직접적인 상호작용 및 제어를 가능하게 합니다. 이러한 통합을 통해 의료 영상 처리, 장면 생성 및 자연어를 활용한 조작이 가능해집니다.
특징
list_nodes: Slicer MRML 노드를 나열하고 필터링하고 해당 속성을 확인합니다.
execute_python_code: Slicer 환경에서 Python 코드 실행
Related MCP server: QGIS MCP
설치
필수 조건
3D 슬라이서 5.8 이상
Python 3.13 이상
uv 패키지 관리자
Mac을 사용 중이라면 uv를 설치하세요.
지엑스피1
윈도우에서
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"그런 다음
set Path=C:\Users\nntra\.local\bin;%Path%그렇지 않은 경우 설치 지침은 해당 웹사이트에 있습니다: uv 설치
⚠️ 먼저 UV를 설치해주세요
데스크톱 통합을 위한 Claude
Claude > 설정 > 개발자 > 구성 편집 > claude_desktop_config.json으로 이동하여 다음을 포함합니다.
{
"mcpServers": {
"slicer": {
"command": "uvx",
"args": ["mcp-slicer"]
}
}
}클라인 통합
{
"mcpServers": {
"slicer": {
"command": "uvx",
"args": ["mcp-slicer"]
}
}
}용법
클로드 설정 확인
오픈 슬라이서 웹 서버
Slicer 웹 서버 모듈을 엽니다.
필요한 인터페이스가 체크되었는지 확인하세요.
그런 다음 서버를 시작하세요
예시
- 리스트_노드
지금 슬라이서 장면에 어떤 마크업 노드가 있는지, 각 노드의 이름을 나열하고, 선일 경우 길이와 각도일 경우 각도를 알려주세요.
- 파이썬 코드 실행
슬라이서 장면에 8cm 크기의 반투명한 녹색 큐브를 그린 다음, 꼭짓점을 표시한 다음, 그 안에 빨간색 구를 그립니다.
기술적 세부 사항
기존 Slicer 웹 서버 인터페이스를 활용합니다. 기술적인 세부 정보는 Slicer 웹 서버 사용자 가이드를 참조하십시오.
제한 사항 및 보안 고려 사항
execute_python_code도구를 사용하면 3D Slicer에서 임의의 Python 코드를 실행할 수 있는데, 이는 강력하지만 잠재적으로 위험합니다.⚠️ 프로덕션 용도로는 권장하지 않습니다.
복잡한 작업은 더 작은 단계로 나누어야 할 수도 있습니다.
기여하다
기여를 환영합니다! 풀 리퀘스트도 자유롭게 제출해 주세요.
부인 성명
이는 3D Slicer 팀에서 개발한 것이 아닌 타사 통합 프로젝트입니다.
Available Tools
3 toolscapture_screenshotA
Capture a screenshot from 3D Slicer's views.
This tool provides real-time visual feedback of the current state of Slicer, enabling AI to observe the GUI and make informed decisions in a complete REACT loop.
Parameters: view_type (str): Type of screenshot to capture. Options: - "application" (default): Full application window including all panels and views - "slice": A specific slice view (Red/Yellow/Green) - "3d": The 3D rendering view
view_name (str): For slice views, specify which view to capture. Options: "red", "yellow", "green" Only used when view_type="slice"
slice_offset (float): For slice views, offset in mm relative to slice origin. Only used when view_type="slice"
slice_orientation (str): For slice views, specify orientation. Options: "axial", "sagittal", "coronal" Only used when view_type="slice"
camera_axis (str): For 3D views, specify camera view direction. Options: "L" (Left), "R" (Right), "A" (Anterior), "P" (Posterior), "I" (Inferior), "S" (Superior) Only used when view_type="3d"
image_size (int): Pixel size of output image (for slice and 3D views). Only used when view_type="slice" or view_type="3d"
Returns: A list containing text and/or image content. The image is returned in MCP's standard format for proper display in AI clients.
Examples:
Capture full application: {"tool": "capture_screenshot", "arguments": {"view_type": "application"}}
Capture Red slice view: {"tool": "capture_screenshot", "arguments": {"view_type": "slice", "view_name": "red"}}
Capture 3D view from anterior: {"tool": "capture_screenshot", "arguments": {"view_type": "3d", "camera_axis": "A"}}
Capture axial slice: {"tool": "capture_screenshot", "arguments": {"view_type": "slice", "view_name": "red", "slice_orientation": "axial"}}
Inputs: view_type, view_name, slice_offset, slice_orientation, +2 more.
execute_python_codeA
Execute Python code in 3D Slicer.
Parameters: code (str): The Python code to execute.
The code parameter is a string containing the Python code to be executed in 3D Slicer's Python environment.
The code should be executable by Python's exec() function. To get return values, the code should assign the result to a variable named __execResult.
Examples:
Create a sphere model: {"tool": "execute_python_code", "arguments": {"code": "sphere = slicer.vtkMRMLModelNode(); slicer.mrmlScene.AddNode(sphere); sphere.SetName('MySphere'); __execResult = sphere.GetID()"}}
Get the number of nodes in the current scene: {"tool": "execute_python_code", "arguments": {"code": "__execResult = len(slicer.mrmlScene.GetNodes())"}}
Calculate 1+1: {"tool": "execute_python_code", "arguments": {"code": "__execResult = 1 + 1"}}
Returns: dict: A dictionary containing the execution result.
If the code execution is successful, the dictionary will contain the following key-value pairs:
- "success": True
- "message": The result of the code execution. If the code assigns the result to `__execResult`, the value of `__execResult` is returned, otherwise it returns empty.
If the code execution fails, the dictionary will contain the following key-value pairs:
- "success": False
- "message": A string containing an error message indicating the cause of the failure. The error message may come from the Slicer Web Server or the Python interpreter.Examples:
Successful execution: {"success": True, "message": 2} # Assuming the result of 1+1 is 2
Successful execution: {"success": True, "message": "vtkMRMLScene1"} # Assuming the created sphere id is vtkMRMLScene1
Python execution error: {"success": False, "message": "Server error: name 'slicer' is not defined"}
Connection error: {"success": False, "message": "Connection error: ..."}
HTTP error: {"success": False, "message": "HTTP Error 404: Not Found"}
Inputs: code (required).
list_nodesA
List MRML nodes via the Slicer Web Server API.
The filter_type parameter specifies the type of node information to retrieve. Possible values include "names" (node names), "ids" (node IDs), and "properties" (node properties). The default value is "names".
The class_name, name, and id parameters are optional and can be used to further filter nodes. The class_name parameter allows filtering nodes by class name. The name parameter allows filtering nodes by name. The id parameter allows filtering nodes by ID.
Examples:
List the names of all nodes: {"tool": "list_nodes", "arguments": {"filter_type": "names"}}
List the IDs of nodes of a specific class: {"tool": "list_nodes", "arguments": {"filter_type": "ids", "class_name": "vtkMRMLModelNode"}}
List the properties of nodes with a specific name: {"tool": "list_nodes", "arguments": {"filter_type": "properties", "name": "MyModel"}}
List nodes with a specific ID: {"tool": "list_nodes", "arguments": {"filter_type": "ids", "id": "vtkMRMLModelNode123"}}
Returns a dictionary containing node information. If filter_type is "names" or "ids", the returned dictionary contains a "nodes" key, whose value is a list containing node names or IDs. Example: {"nodes": ["node1", "node2", ...]} or {"nodes": ["id1", "id2", ...]} If filter_type is "properties", the returned dictionary contains a "nodes" key, whose value is a dictionary containing node properties. Example: {"nodes": {"node1": {"property1": "value1", "property2": "value2"}, ...}} If an error occurs, a dictionary containing an "error" key is returned, whose value is a string describing the error.
Inputs: filter_type, class_name, name, id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool serves a distinct, non-overlapping purpose: capture_screenshot provides visual feedback, execute_python_code runs arbitrary code, and list_nodes retrieves node information. Their descriptions clearly differentiate their functions, eliminating any confusion about which tool to use for a given task.
The tools follow a consistent verb_noun pattern (capture_screenshot, execute_python_code, list_nodes), making them predictable and readable. The minor deviation is that 'execute_python_code' uses a verb-object structure instead of a simple verb like 'run', but this is still clear and fits the overall naming style.
With only 3 tools, the set feels thin for interacting with a complex application like 3D Slicer. While the tools cover core functionalities (visualization, code execution, and data listing), essential operations like creating, updating, or deleting nodes are missing, limiting the server's scope and utility.
The toolset is severely incomplete for the domain of 3D Slicer interaction. It lacks basic CRUD operations for nodes (e.g., create_node, update_node, delete_node) and other common actions like loading/saving data or manipulating views. This will cause significant agent failures when trying to perform typical workflows in the application.
Maintenance
Related MCP Connectors
Connect AI agents to Replynodes over the Model Context Protocol.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Connect your AI assistant to Blender for 3D modeling, Geometry Nodes, materials, lighting, animation, rendering and export. Inspect real scenes and viewport images, refine the result and restore checkpoints. OAuth connects your chat to Blender Bridge Desktop on an online Windows 10/11 x64 computer running Blender 4.2+. The chat can run on another device. Requires an active Blender Bridge account; 7-day trial available. AI model access is separate.
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- AlicenseBqualityCmaintenanceConnects Blender to AI through the Model Context Protocol to enable prompt-assisted 3D modeling and scene manipulation. It supports object creation, material control, and arbitrary Python code execution directly within the Blender environment.22MIT
- AlicenseNot gradedqualityDmaintenanceConnects QGIS to an LLM through the Model Context Protocol, allowing agentic interaction with and control of QGIS for prompt-assisted project creation, layer loading, code execution, and more.GPL 3.0
- AlicenseNot gradedqualityDmaintenanceConnects Blender to AI assistants through the Model Context Protocol, enabling direct AI control of 3D modeling, scene creation, and manipulation via natural language.MIT
- AlicenseAqualityDmaintenanceConnects Blender 3D to AI assistants via the Model Context Protocol, enabling natural language driven 3D scene creation, manipulation, and rendering.15MIT