Fiji MCP Server
Fiji MCP Server lets an AI assistant discover, run, and verify Fiji/ImageJ operations through MCP tools.
Discover installed commands/plugins, search by name, inspect command input metadata, and list update-site extensions.
List open images; inspect dimensions, channels/slices/frames, bit depth, and ROI statistics; check runtime health.
Open images from disk and save the active image.
Execute ImageJ macros singly, in batches, or as multi-step workflows with optional per-step screenshots and error handling.
Capture screenshots of the full screen, active image, or Results table, and compare before/after screenshots with MAE/RMSE plus a visual diff.
Parse macro or Results output into structured JSON; list and fetch bundled macro templates.
View or clear an in-process session trace of tool calls.
Allows AI agents to control Fiji/ImageJ for microscopy image analysis, including opening images, applying filters, thresholding, particle analysis, skeletonization, and running macros.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Fiji MCP Server Apply a Gaussian blur with sigma 4 and show me the result."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Fiji MCP Server
An MCP server that lets an AI assistant work in Fiji/ImageJ: open and save images, find and run installed commands and plugins, run ImageJ macros or Groovy, read the Results table, and check its work with screenshots.

A recorded run on the ImageJ blobs sample: the assistant opened the image, thresholded it with a macro, counted 43 particles, and compared before and after screenshots.
A one-page walkthrough poster (PDF) walks you step by step from setup to your first results, for people who use AI apps but do not code.
Tools
Tool | What it does |
| Reports whether Fiji is running, which images are open, and the Results table size. |
| Searches Fiji's installed commands and plugins and shows how each can be called. |
| Runs one installed command with its parameters. |
| Runs an ImageJ macro (IJM) or a Groovy script. |
| Opens a local image and makes it the active one. |
| Saves the active image to a new file. |
| Reads the Results table, a page at a time. |
| Returns a PNG of the active image or the Results table. |
| Compares two saved screenshots, by eye and by pixel values. |
The tool reference lists every argument, return field, and limit.
Related MCP server: Cellpose MCP Server
Install
Needs Python 3.10 or newer and a local Fiji installation.
python -m pip install fiji-mcp-serverEvery client below needs two settings: FIJI_PATH, the Fiji folder that contains jars/ and plugins/ (for example /Applications/Fiji), and FIJI_MODE=headless. Fiji starts on the first tool call, which can take a minute.
Connect
Claude Code
claude mcp add fiji -e FIJI_PATH=/Applications/Fiji -e FIJI_MODE=headless -- fiji-mcp-serverCodex
codex mcp add fiji --env FIJI_PATH=/Applications/Fiji --env FIJI_MODE=headless -- fiji-mcp-serverThen set startup_timeout_sec = 120 and tool_timeout_sec = 300 under [mcp_servers.fiji] in ~/.codex/config.toml, so Codex waits for Fiji to start and for long operations.
Claude Desktop, Cursor, Gemini CLI, and Antigravity use the same entry:
{
"mcpServers": {
"fiji": {
"command": "fiji-mcp-server",
"env": { "FIJI_PATH": "/Applications/Fiji", "FIJI_MODE": "headless" }
}
}
}Client | Where the entry goes |
Claude Desktop |
|
Cursor |
|
Gemini CLI |
|
Antigravity | Agent panel |
If a client cannot find fiji-mcp-server, use the full path that which fiji-mcp-server prints (where on Windows).
Use
Open
/data/cells.tif, threshold it with Otsu, measure the particles, and show me the Results table and a before-and-after screenshot.
Search the installed commands for "Gaussian Blur" and run it with sigma 2.
Evaluation
The figure above comes from a scripted run of the server on ImageJ's blobs sample: open the image, threshold it with Otsu, measure particles of at least 50 pixels that do not touch the edge, and compare before and after screenshots. Fiji found 43 particles, from 81 to 902 px². An independent count of the saved mask, written without Fiji, finds the same 43 particles with identical areas.
FIJI_PATH=/Applications/Fiji python examples/blobs/run_blobs.py --output my-run
python examples/blobs/check_blobs.py my-runThe recorded run is in examples/blobs/run: every tool call in order, Fiji's Results table, and the check. CI runs the unit and MCP contract tests on Python 3.10–3.12 for every push.
Limits
run_scriptruns any macro or Groovy code with your permissions. Use the server only with a client you trust on your own computer.Headless mode cannot answer dialogs. Plugins that need a dialog, mouse, or keyboard may fail; set
FIJI_MODE=guionly when you want Fiji's window.An operation that runs longer than
FIJI_OPERATION_TIMEOUT_SEC(default 240 s) stops the server, because Java work cannot be cancelled safely. Restart the client's connection, and keep the client's tool timeout above this value.save_imagewill not overwrite an existing file;screenshotandcompare_screenshotswill, so give them new paths when you want to keep old ones.
Development
python -m pip install -e ".[test,dev]"
python -m pytest -m "not integration"The integration tests need a local Fiji; see tests/test_integration_runtime.py. The changelog lists each release.
Credits and license
Built on Fiji, ImageJ, PyImageJ, and FastMCP. napari-mcp inspired the design. The example image is ImageJ's blobs sample.
The code is BSD-3-Clause; see LICENSE. Image credits and terms are in THIRD_PARTY_NOTICES.md.
Available Tools
19 toolsclear_session_traceARead-onlyIdempotent
Clear the in-process session trace (does not close Fiji images).
Inputs: no named parameters. Returns: ok, cleared
compare_screenshotsARead-onlyIdempotent
Compare two screenshot_fiji payloads (before/after). Returns mean absolute error and RMSE on aligned grayscale patches plus a side-by-side JPEG for quick visual diff.
Inputs: image_base64_before (required), image_base64_after (required). Returns: ok, mime_type, format, width, +10 more
describe_pluginARead-onlyIdempotent
Resolve one command by name and return SciJava input metadata when available. Legacy ImageJ1-only plugins may omit inputs; use run_macro in that case.
Inputs: command_name (required). Returns: ok, command, inputs, inputs_available, +1 more
get_image_infoARead-onlyIdempotent
Read dimensions, channel/frame/slice counts, bit depth, and ROI statistics for one image. Uses the front image when image_title is omitted.
Inputs: image_title. Returns: ok, title, width, height, +8 more
get_macro_templateARead-onlyIdempotent
Fetch one bundled macro template by id (from list_macro_templates).
Inputs: template_id (required). Returns: ok, template
get_session_traceARead-onlyIdempotent
Return recent tool invocations (run_macro, open_image, …) in order plus optional live open-image list. Trace is in-process only (resets when the MCP server restarts).
Inputs: limit, include_open_images. Returns: ok, returned_events, events, open_images, +1 more
health_checkARead-onlyIdempotent
Return runtime health: Fiji path, headless/GUI mode, ImageJ version, and configured operation timeout. Use before long jobs to confirm the bridge is alive.
Inputs: no named parameters. Returns: ok, initialized, fiji_path, mode, +2 more
list_all_commandsARead-onlyIdempotent
Enumerate Fiji/ImageJ commands from SciJava CommandService and legacy ij.Menus. Large installs return thousands of entries; lower limit for faster responses.
Inputs: limit. Returns: ok, total, returned, commands
list_extensionsARead-onlyIdempotent
List configured ImageJ update sites (name and URL) when the updater classes are present. May return an empty list on minimal installs; see note field.
Inputs: no named parameters. Returns: ok, extensions, count, note
list_macro_templatesARead-onlyIdempotent
List bundled macro snippets (filters, segmentation, Z-project, channels, optional Fiji plugins) with stable ids. Filter by category: filters, process, segment, analyze, image, annotate, channels, stack, plugins.
Inputs: category. Returns: ok, count, templates
list_open_imagesARead-onlyIdempotent
List open image windows with id, title, dimensions, and ImageJ type constant.
Inputs: no named parameters. Returns: ok, count, images
open_imageA
Open an image from disk in Fiji and show it as the active window. Verify the path exists on the MCP host before calling.
Inputs: path (required). Returns: ok, title, width, height, +1 more
parse_macro_outputARead-onlyIdempotent
Turn macro return text or a pasted Results snippet into structured JSON: detected format, key/value map, tabular rows, and/or extracted numbers. Prefer macros that return a small JSON or key=value string for best results.
Inputs: text (required), format_hint. Returns: ok, format_detected, parsed_json, values, +2 more
run_batch_macrosA
Run several macros in sequence. On failure, behavior depends on continue_on_error: either stop or record the error and continue. Each successful step returns the same shape as run_macro.
Inputs: macros (required), continue_on_error, retries_per_step. Returns: ok, total_steps, completed_steps, failed_steps, +1 more
run_macroA
Execute ImageJ1 macro text in the current Fiji session. Returns macro return value and a tail of the ImageJ log. Prefer small, focused macros; increase timeout for heavy I/O.
Inputs: macro_code (required), retries. Returns: ok, result, log_tail
run_workflowA
Run a scripted pipeline: each step runs a macro, optionally followed by a screenshot. Supports MCP progress when the client requests it. Use verify_each_step=false for faster runs.
Inputs: steps (required), verify_each_step, continue_on_error. Returns: ok, results, total_steps, failed_steps, +2 more
save_imageA
Save the currently active image to disk using ImageJ's saveAs. Requires an image window to be frontmost in Fiji.
Inputs: path (required), format_hint. Returns: ok, path, title, format
screenshot_fijiARead-only
Capture pixels for verification: full_screen (primary monitor via Robot), active_image (current ImagePlus), or results_table (render Measure/Results data). Use active_image or results_table when running headless without a display.
Inputs: capture_mode. Returns: ok, capture_mode, mime_type, format, +4 more
search_commandsARead-onlyIdempotent
Search installed commands by substring on name/class, plus fuzzy title matching. Use before describe_plugin to find the exact menu label.
Inputs: query (required), limit. Returns: ok, query, total_matches, matches
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have distinct purposes, e.g., run_macro vs run_batch_macros vs run_workflow are clearly differentiated by descriptions. Some related tools like describe_plugin and search_commands could cause slight confusion but are still separable.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., clear_session_trace, compare_screenshots, list_open_images). No mixing of styles or ambiguous verbs.
With 19 tools, the set is well-scoped for an image processing MCP server covering session management, macro execution, image I/O, and metadata. No signs of bloat or insufficiency.
The tool surface covers core workflows: image management, macro execution, command discovery, and session tracing. Minor gaps like missing direct close_image or ROI manipulation exist but are manageable via macros.
Maintenance
Related MCP Connectors
Image & PDF tools for AI agents: compress, convert, resize, PDF, AI vision, pipeline.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Build and run agents and automations across hundreds of apps using natural language.
Image and video AI tools and your own pipelines, run from any AI assistant.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, modify, and manage Figma designs through natural language commands via a specialized MCP server and plugin bridge. It supports a wide range of operations including element creation, property modification, component management, and accessibility checks.105MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to perform cell segmentation through natural language commands, including 2D/3D segmentation, batch processing, image restoration, and custom model training.122BSD 3-Clause
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to control RELION 5.x cryo-EM structure determination software through natural language, providing 23 tools for the complete single-particle analysis pipeline.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control GIMP for image editing tasks such as opening, resizing, filtering, exporting, and batch processing images through Python-Fu scripting.MIT