Napari Integration & Setup
Installation guide for isolating Napari, setting up command wrappers, and connecting the MCP server to Claude Code.
Napari Installation & Setup
To prevent dependency conflicts with other tools (like PyMOL), Napari and its MCP plugin must be installed in a strictly isolated virtual environment.
Install Napari in an Isolated Environment
First, create and activate a dedicated virtual environment, then install Napari and the required plugins.
Open PowerShell and run:
python -m venv C:\Users\<user>\napari_env
C:\Users\<user>\napari_env\Scripts\activate
pip install "napari[all]"Open your terminal and run:
python3 -m venv ~/napari_env
source ~/napari_env/bin/activate
pip install "napari[all]"Open your terminal and run:
python3 -m venv ~/napari_env
source ~/napari_env/bin/activate
pip install "napari[all]"Configuring the Napari Command
To run Napari globally without breaking your environments, we will route the command through a "Safe Commands" directory or a symbolic link.
1. Create the "Safe Commands" Directory (If you already created this for PyMOL, skip to step 3). Open PowerShell and create a dedicated folder for your global commands:
mkdir C:\Users\<user>\MyCommands2. Add to PATH
- Go to your Windows Environment Variables -> Path -> Edit.
- Click New, add
C:\Users\<user>\MyCommands, and click OK to save.
3. Create the Batch Wrapper
- Inside the
MyCommandsfolder, create a new text document and name itnapari.bat(ensure Windows is not hiding the.txtextension). - Edit the file, paste the following code to route the command to your isolated environment, and save:
@echo off
"C:\Users\<user>\napari_env\Scripts\napari.exe" %*Open your terminal and create a symbolic link from your isolated environment's binary to your local bin directory:
sudo ln -s ~/napari_env/bin/napari /usr/local/bin/napariOpen your terminal and create a symbolic link from your isolated environment's binary to your local bin directory:
sudo ln -s ~/napari_env/bin/napari /usr/local/bin/napariVerification
Open a new terminal or command prompt session and verify the setup by triggering Napari's help or info command:
napari --info(If successful, your terminal will print the Napari environment details without requiring you to manually activate the virtual environment first.)
Connect to Claude Code
Now that Napari is safely isolated, you need to connect it to Claude Code.
Important: We must use the --persistent flag so Claude Code knows to hardcode your custom environment instead of dynamically building a new one with uv.
Open your terminal and add the server:
claude mcp add --persistent napari <your-mcp-start-command>