Napari MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| init_viewerA | Create or return the napari viewer, with viewer detection. When Parameterstitle : str, optional Optional window title (only for local viewer). width : int, optional Optional initial canvas width (only for local viewer). height : int, optional Optional initial canvas height (only for local viewer). port : int, optional If provided, attempt to connect to an external napari-mcp bridge on this port (default is taken from NAPARI_MCP_BRIDGE_PORT or 9999). detect_only : bool, default=False If True, only detect available viewers without initialising. |
| close_viewerA | Close the viewer window and clear all layers. |
| session_informationA | Get comprehensive information about the current napari session. |
| list_layersC | Return a list of layers with key properties. |
| get_layerA | Get detailed info about a layer, optionally including data. Always returns metadata (shape, dtype, scale, translate, type-specific
properties). When Parametersname : str
Layer name (exact match).
include_data : bool, default False
If True, include data statistics (min/max/mean/std) and, for
small layers, inline data values.
slicing : str, optional
Numpy-style index string, e.g. |
| add_layerA | Add a layer to the viewer. Parameterslayer_type : str
One of: |
| remove_layerC | Remove a layer by name. |
| set_layer_propertiesA | Set properties on a layer by name. Parametersname : str Layer name (exact match). visible, opacity, colormap, blending, contrast_limits, gamma Standard layer rendering properties. new_name : str, optional Rename the layer. active : bool, optional If True, make this the selected/active layer. Setting to False has no effect (use viewer selection directly). |
| reorder_layerA | Reorder a layer by name. Provide exactly one of:
|
| apply_to_layersA | Apply property changes to multiple layers matching a filter. Parametersfilter_type : str, optional
Layer type name to match (e.g., "Image", "Labels", "Points").
filter_pattern : str, optional
Glob pattern matched against layer names (e.g., "seg_*").
properties : dict, optional
Properties to set on matched layers. Supported keys: |
| configure_viewerA | Configure viewer display: camera, dimensions, and grid. All parameters are optional — set any combination in one call. Parametersreset_view : bool, default False
If True, reset the camera to fit all data.
center : list[float], optional
Camera center position.
zoom : float, optional
Camera zoom factor (must be > 0).
angles : list[float], optional
Camera angles as [azimuth, elevation, roll] in degrees.
ndisplay : int, optional
Number of displayed dimensions (2 or 3).
dims_axis : int, optional
Axis index for slider position (use with |
| save_layer_dataA | Save a layer's data to a file. Parametersname : str
Layer name.
path : str
Output file path. Format is inferred from extension unless
format is specified. Supported: |
| screenshotA | Take a screenshot, or a timelapse series by sweeping a dims axis. For a single screenshot, call with no Parameterscanvas_only : bool, default True
If True, only capture the canvas area.
save_path : str, optional
Save single screenshot to this file path (returns metadata).
axis : int, optional
Dims axis to sweep for timelapse (e.g., temporal axis).
slice_range : str, optional
Python-like slice string, e.g. |
| execute_codeA | Execute arbitrary Python code in the server's interpreter. Similar to napari's console. The execution namespace persists across calls and includes 'viewer', 'napari', and 'np'. Parameterscode : str Python code string. The value of the last expression (if any) is returned as 'result_repr'. line_limit : int, default=30 Maximum number of output lines to return. Use -1 for unlimited output. Warning: Using -1 may consume a large number of tokens. NoteIn standalone mode, code execution runs synchronously on the main thread (required for Qt/napari operations) and has no timeout. In bridge mode, a 600-second timeout is enforced. |
| install_packagesA | Install Python packages using pip. Parameterspackages : list of str List of package specifiers (e.g., "scikit-image", "torch==2.3.1"). upgrade : bool, optional If True, pass --upgrade flag. no_deps : bool, optional If True, pass --no-deps flag. index_url : str, optional Custom index URL. extra_index_url : str, optional Extra index URL. pre : bool, optional Allow pre-releases (--pre flag). line_limit : int, default=30 Maximum number of output lines to return. Use -1 for unlimited output. timeout : int, default=240 Timeout for pip install in seconds. |
| read_outputA | Read stored tool output with optional line range. Parametersoutput_id : str Unique ID of the stored output. start : int, default=0 Starting line number (0-indexed). end : int, default=-1 Ending line number (exclusive). If -1, read to end. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/royerlab/napari-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server