Advanced installation options for napari MCP server including manual configuration, development setup, and zero-install approaches.
!!! tip "Quick Setup Available" Most users should use the Quick Start Guide with the automated CLI installer. This guide is for advanced users who need manual configuration or development setups.
The easiest way is using the automated installer:
pip install napari-mcp
napari-mcp-install install <application>→ See Quick Start for step-by-step instructions
For users who prefer manual setup or need custom configurations.
The CLI installer auto-detects these locations. For manual setup, you need to know where each application stores its MCP config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- All platforms:
~/.claude.json
- Global:
~/.cursor/mcp.json - Project:
.cursor/mcp.json(in project root)
- macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Windows:
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Linux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Note: For VS Code Insiders, replace "Code" with "Code - Insiders"
- macOS:
~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Windows:
%APPDATA%/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Linux:
~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
- Global:
~/.gemini/settings.json - Project:
.gemini/settings.json(in project root)
- All platforms:
~/.codex/config.toml(TOML format)
Most applications use this JSON format:
{
"mcpServers": {
"napari-mcp": {
"command": "uv",
"args": ["run", "--with", "napari-mcp", "napari-mcp"]
}
}
}This uses uv for zero-install execution (no permanent installation required).
If you have napari-mcp installed in your Python environment:
{
"mcpServers": {
"napari-mcp": {
"command": "python",
"args": ["-m", "napari_mcp.server"]
}
}
}Or with a specific Python path:
{
"mcpServers": {
"napari-mcp": {
"command": "/path/to/your/python",
"args": ["-m", "napari_mcp.server"]
}
}
}{
"mcpServers": {
"napari-mcp": {
"command": "uv",
"args": ["run", "--with", "napari-mcp", "napari-mcp"],
"cwd": ".",
"timeout": 600000,
"trust": false
}
}
}{
"mcpServers": {
"napari-mcp": {
"command": "uv",
"args": ["run", "--with", "napari-mcp", "napari-mcp"],
"alwaysAllow": ["screenshot", "list_layers"],
"disabled": false
}
}
}[mcp_servers.napari_mcp]
command = "uv"
args = ["run", "--with", "napari-mcp", "napari-mcp"]Run napari MCP without permanent installation using uv:
# Direct execution (for testing)
uv run --with napari-mcp napari-mcp
# Add a napari GUI backend when needed
uv run --with napari-mcp --with napari[pyqt6] napari-mcpThe configuration files use uv automatically. You can also ask napari-mcp-install
to include a backend with --backend all, --backend pyqt5, --backend pyqt6,
--backend pyside, --backend none, or a custom value.
See Zero Install Guide for details.
For contributors and plugin developers:
# Clone repository
git clone https://github.com/royerlab/napari-mcp.git
cd napari-mcp
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Or with uv (recommended)
uv pip install -e ".[dev]"# Configure to use your development installation
napari-mcp-install install claude-desktop --persistent
# This will use your local Python with the editable installation# Fast tests (skip GUI)
pytest -m "not realgui"
# With coverage
pytest --cov=src --cov-report=html -m "not realgui"
# Include GUI tests (requires display)
pytest -m realgui# Install pre-commit hooks
pre-commit install
# Run linting
ruff check src/ tests/
# Format code
ruff format src/ tests/# Create environment
python -m venv napari-mcp-env
# Activate (macOS/Linux)
source napari-mcp-env/bin/activate
# Activate (Windows)
napari-mcp-env\Scripts\activate
# Install
pip install napari-mcp
# Configure
napari-mcp-install install <app> --persistent# Create environment
conda create -n napari-mcp python=3.11
# Activate
conda activate napari-mcp
# Install
pip install napari-mcp
# Configure
napari-mcp-install install <app> --persistentnapari-mcp can also be used as a napari plugin for direct integration with a running napari session.
!!! tip "When to Use Plugin Mode" - Working with existing napari workflows and loaded data - Want to switch between manual and AI-assisted analysis - Integrating with other napari plugins
-
Start napari (with or without data):
napari # Or: napari path/to/image.tif -
Open the MCP Server Control widget:
- In napari: Plugins → napari-mcp: MCP Server Control
-
Start the bridge server:
- Click "Start Server" button (default port: 9999)
- The widget shows connection URL:
http://localhost:9999/mcp
-
Configure your AI app:
napari-mcp-install install <app>
The installer auto-configures to detect your bridge server.
-
Test the connection:
- Restart your AI app
- Ask: "Can you list the layers in my current napari session?"
- Standalone Mode (default): MCP server creates its own napari viewer
- Plugin Mode: MCP bridge server connects to your current napari session
Plugin mode enables AI assistants to control your active napari instance rather than starting a new viewer.
→ See Complete Plugin Guide for detailed instructions, use cases, and troubleshooting
Advanced configuration via environment variables:
# Qt platform (for headless systems)
export QT_QPA_PLATFORM=offscreen
# MCP bridge port (for external viewer)
export NAPARI_MCP_BRIDGE_PORT=9999
# Output limits
export NAPARI_MCP_MAX_OUTPUT_ITEMS=2000
# Logging
export MCP_LOG_LEVEL=INFOAdd to your config:
{
"mcpServers": {
"napari-mcp": {
"command": "uv",
"args": ["run", "--with", "napari-mcp", "napari-mcp"],
"env": {
"QT_QPA_PLATFORM": "offscreen",
"NAPARI_MCP_BRIDGE_PORT": "9999"
}
}
}
}- Permissions: Grant terminal access in System Preferences
- Python path: Use
which python3to find interpreter - M1/M2: Ensure native ARM Python for best performance
- Path format: Use forward slashes in JSON:
"C:/Python/python.exe" - Environment variables: Access with
%VAR%syntax - PowerShell: May need execution policy changes
- Display: X11 or Wayland required for GUI (or use offscreen mode)
- Permissions: Ensure config directories are writable
- Headless: Use
QT_QPA_PLATFORM=offscreenfor servers
Common installation issues and solutions:
# Verify installation
pip list | grep napari-mcp
# Check PATH
which napari-mcp-install
# Reinstall
pip install --force-reinstall napari-mcp# Verify config created
napari-mcp-install list
# Check file syntax
python -m json.tool < config-file.json
# Force reinstall
napari-mcp-install install <app> --force# Check Python version
python --version # Should be 3.10+
# Verify napari-mcp is accessible
python -c "import napari_mcp; print('OK')"
# Use specific Python
napari-mcp-install install <app> --python-path $(which python)→ See Troubleshooting Guide for comprehensive help
- Quick Start - If you haven't tried the automated installer
- Integration Guides - Application-specific setup
- API Reference - Available tools and functions
- Troubleshooting - Common issues
For most users, the Quick Start Guide with automated CLI installer is the recommended approach!