Skip to main content
Glama

Fiji MCP Server

PyPI version Python versions License

Give your AI assistant hands inside Fiji/ImageJ. Fiji MCP Server is a small stdio Model Context Protocol bridge that can open and save images, discover and run installed commands, execute IJM or Groovy, read Results, and verify changes with screenshots.

This README documents v0.2.0. The public surface is deliberately limited to nine tools; Fiji's live command registries and scripting APIs provide the plugin reach without a large custom framework.

Quick start

You need Python 3.10 or newer and a local Fiji installation.

  1. Install the server:

    python -m pip install "fiji-mcp-server==0.2.0"

    Before v0.2.0 is published on PyPI, install from a source checkout instead:

    python -m pip install .
  2. Locate the Fiji root directory. It must directly contain jars/ and plugins/; on this Mac, for example, it is /Applications/Fiji.

  3. Configure your MCP client with FIJI_PATH and FIJI_MODE=headless; see the client-specific instructions below. The MCP client owns the stdio process and starts fiji-mcp-server when needed.

Fiji starts lazily on the first Fiji-backed tool call. The bridge prefers one compatible JVM bundled inside the selected Fiji installation.

Related MCP server: Cellpose MCP Server

Connect Codex

The official Codex CLI, IDE extension, and ChatGPT desktop app share MCP configuration on the same Codex host. Add this stdio server from a terminal:

codex mcp add fiji \
  --env FIJI_PATH=/Applications/Fiji \
  --env FIJI_MODE=headless \
  -- fiji-mcp-server
codex mcp list

Or add the equivalent entry to ~/.codex/config.toml (or a trusted project's .codex/config.toml):

[mcp_servers.fiji]
command = "fiji-mcp-server"
startup_timeout_sec = 120
tool_timeout_sec = 300

[mcp_servers.fiji.env]
FIJI_PATH = "/Applications/Fiji"
FIJI_MODE = "headless"

In ChatGPT desktop, you can also open Settings → MCP servers → Add server, choose STDIO, and then restart after saving. See the official Codex MCP documentation for current client controls.

Other JSON-based MCP clients

Many local MCP clients use this common JSON shape. Their configuration-file location and restart control are client-specific:

{
  "mcpServers": {
    "fiji": {
      "command": "fiji-mcp-server",
      "env": {
        "FIJI_PATH": "/Applications/Fiji",
        "FIJI_MODE": "headless"
      }
    }
  }
}

If the client cannot find fiji-mcp-server, replace command with the full path reported by which fiji-mcp-server (macOS/Linux) or where fiji-mcp-server (Windows).

Try these prompts

Prompt: Open /data/cells.tif, inspect its dimensions and current C/Z/T position, and show me an active-image screenshot.

Prompt: Search the installed Fiji commands for “Gaussian Blur”. Show the best matching command's invocation route and accepted inputs, then run it with sigma 2 only if that parameter is supported.

Prompt: Run an ImageJ macro that thresholds the active image and measures it, then return the Results table in pages of 200 rows.

Prompt: Save a screenshot to /tmp/before.png, apply the chosen threshold, save /tmp/after.png, and compare them. If the expected change is absent, inspect state and logs before adjusting the threshold once; do not blindly repeat a mutation whose outcome is unknown.

Prompt: Use Groovy to call an installed scriptable plugin that is not representable as a structured command, then summarize its bounded result and the active-image state.

Prompt: Save the active image as /data/output/processed.tiff. Do not overwrite an existing file, and report the exact path Fiji created.

What can it do?

  • Inspect and move data: read live state, open a local image, save the active image, and page through the Results table.

  • Use installed commands: search Fiji's SciJava and ImageJ1 registries, then invoke a selected command through structured parameters or legacy options when that route is supported.

  • Reach scriptable plugins: use trusted IJM or Groovy for ROIs, unusual Java inputs, and installed plugins that do not fit the registered command route.

  • Verify visually: render the active plane or Results table, save before and after PNGs, and compare dimensions and same-size pixel metrics.

The server does not install plugins, click dialogs, drive menus, or promise structured parameters for every plugin.

The nine tools

Tool

Purpose

get_state

Read Fiji lifecycle, active/open images, and Results-table state.

search_commands

Search registered SciJava and ImageJ1 commands and inspect their routes.

run_command

Run one resolved installed command with supported parameters or options.

run_script

Run one trusted IJM or Groovy script.

open_image

Open an existing local image and make it current.

save_image

Save the active image to a new exact lowercase supported path.

get_results

Read an ordered, paginated page from Fiji's live Results table.

screenshot

Return and optionally save a PNG of the active plane or Results.

compare_screenshots

Compare two saved raster paths visually and, when sizes match, numerically.

See the complete nine-tool reference for signatures, return fields, limits, and failure behavior.

How it works

AI client ── stdio JSON-RPC ──▶ FastMCP ── serialized bridge ──▶ PyImageJ ──▶ Fiji + installed plugins

Fiji operations share one process-wide lock. Read-only operations receive at most one retry for a small allowlist of transient failures. Commands, scripts, image opens, and saves are never automatically repeated after dispatch.

Safety and limitations

run_script executes trusted arbitrary local code. IJM and Groovy can read or modify anything available to the MCP process, so run this server only for a trusted local client. It is not a remote multi-user service or a sandbox.

Python diagnostics and ordinary Java output are redirected to stderr to protect stdio JSON-RPC. Plugins that require GUI dialogs, mouse/keyboard automation, or unscriptable interaction may fail in headless mode. Use FIJI_MODE=gui only for an intentional local desktop workflow supported by that plugin.

save_image is strict within this MCP server process: its requested suffix must be one of the exact lowercase formats documented in the tool reference, and an output that exists when the serialized save begins is rejected. It is not a cross-process atomic publisher, so another local process can still race that check; use a dedicated output directory when other writers are active. screenshot and compare_screenshots overwrite an existing save_path; use a new path when preserving an existing PNG is required. After any mutation with an unknown outcome, inspect state or take a screenshot before deciding whether to retry.

License

BSD-3-Clause. See LICENSE.

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
3Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • Create and manage AI agents that collaborate and solve problems through natural language interacti…

  • Build and run visual creative-production workflows from your AI agent.

View all MCP Connectors

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/surajinacademia/Fiji_imageJ_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server