Skip to main content

MNE-MCP

CI License: MIT Python 3.12 MCP

English | 简体中文

A Model Context Protocol (MCP) server that gives AI assistants direct, conversational access to MNE-Python for analyzing human neurophysiology data — EEG, MEG, sEEG, ECoG, and fNIRS.

Describe your analysis in plain language — MNE-MCP loads your recording, runs the MNE pipeline (filtering, ICA, epoching, ERP/ERF averaging, time-frequency, source-level work via code), saves the figures, and explains the results.

Works in Claude Code and opencode (any MCP-capable client). Pairs with bundled Agent Skills — mne-analyst, mne-mcp-guard, plus a skeptical analysis suite (mne-methodology-critic + per-category skills) for reliable, archived workflows.


Why an MCP for MNE-Python?

MNE analysis is stateful and visual — unlike a one-shot statistics batch job:

  • You load a Raw recording once, then filter → re-reference → fit ICA → epoch → average → time-frequency, each step mutating large in-memory objects. MNE-MCP keeps one persistent session so recordings never get re-loaded between steps.
  • Every decision is driven by looking (PSD, sensor maps, ICA components, ERPs). Every plotting tool saves a PNG the assistant can read and interpret.
  • MNE has a large Python API. MNE-MCP gives you 41 structured tools spanning the common pipeline and advanced analysis (source localization, connectivity, decoding), plus an mne_run_code escape hatch that reaches the entire MNE API in the same live session.
  • Defaults (line frequency, montage, filter band, rejection threshold, ICA settings, epoch window, dirs, timeout) are user-configurable via an interactive mne-mcp configure wizard.

Requirements

  • Python 3.12
  • Git
  • Claude Code, Codex, opencode, or another MCP client

Cross-platform: unlike a closed engine, MNE-Python is pure Python, so analysis tools work on Windows, macOS, and Linux.


Installation

Install with your agent

Send this to a coding agent with terminal access:

Follow https://github.com/Exekiel179/MNE-MCP/blob/main/INSTALL_AGENT.md to install MNE-MCP and all companion skills in my existing MNE environment, configure my current client, and verify the result.

The agent checks the environment, installs missing MNE/core libraries when needed, installs the lightweight interface and all 14 skills, and registers the selected client. A client restart is required. Use the versioned v0.4.0 installation guide for a reproducible installation.

Manual installation

Activate your existing Python 3.12 MNE environment, then install the lightweight interface:

python -m pip install "mne-mcp==0.4.0"
python -m mne_mcp.cli setup --clients codex

Release downloads: v0.4.0. For a downloaded source archive, extract it and use python -m pip install . in that directory. Use claude, codex, or opencode (comma-separated) to choose clients. Restart them after setup. MNE and scientific libraries are user-managed; installing this package does not install them. See installation instructions for dependencies and troubleshooting.

Configuration

Repair or reconfigure

Run python -m mne_mcp.cli setup --clients codex in the same MNE environment. Setup registers that exact interpreter and installs the bundled skills for the selected clients. Existing configuration and skill files are backed up before updates.

Environment variables (optional .env)

MNE_MCP_TIMEOUT=300          # per-operation timeout (s); raise for ICA / TFR / large files
MNE_MCP_RESULTS_DIR=...      # where figures + exported objects are saved
MNE_MCP_DATA_DIR=...         # default directory mne_list_files scans

Configure analysis defaults (interactive wizard)

Set the defaults the structured tools fall back to — mains line frequency (50/60 Hz), default montage, filter band, EEG rejection threshold, ICA method/components, epoch window, directories, and timeout:

mne-mcp configure            # interactive prompts (Enter keeps current value)
mne-mcp configure --show     # print current defaults
mne-mcp configure --reset    # back to built-in defaults
mne-mcp configure --set line_freq=60 default_montage=biosemi64 reject_eeg_uv=120   # non-interactive

Defaults are saved to ~/.mne-mcp/config.json (override path with MNE_MCP_CONFIG). Precedence at runtime: environment variable > config file > built-in. View the active config in-session with the mne_get_config tool. Restart the MCP server for changes to take effect.

Skills

Setup installs all 14 skills into the selected client's skill directory, including their references. Claude also receives the methodology-review subagent. Other clients use the methodology-critic skill. Rerun setup after updating the package.


Usage

Just describe what you want:

加载 sub-01_raw.fif,看一下功率谱
对 raw 做 1–40 Hz 带通、50 Hz 陷波,然后跑 ICA 去眼电
Epoch around the 'target' trigger, -0.2 to 0.8 s, average it, and show the ERP topomaps at 100/200/300 ms

The assistant will:

  1. Check capabilities (mne_check_status)
  2. Load your recording into the persistent session
  3. Run the pipeline step by step, showing figures as PNGs
  4. Interpret each result in plain language
  5. Archive figures + the equivalent MNE code to mne_result/

Output

Every plotting tool saves a PNG to the results dir and returns its path:

> Figure: `C:\...\mne-mcp\results\psd_01.png`

With the mne-analyst skill installed, results and the exact MNE code that produced them are archived to mne_result/ in your working directory (sequence-numbered), so the analysis is fully reproducible.


Available Tools (41)

Status & Session (7)

mne_check_status · mne_session_info · mne_describe · mne_get_info · mne_reset_session · mne_run_code · mne_get_config

Data IO (2)

mne_list_files · mne_load_raw

Preprocessing (7)

mne_filter · mne_resample · mne_crop · mne_set_montage · mne_set_reference · mne_mark_bad_channels · mne_interpolate_bads

Visualization (3)

mne_plot_psd · mne_plot_raw · mne_plot_sensors

ICA (4)

mne_fit_ica · mne_plot_ica_components · mne_plot_ica_sources · mne_apply_ica

Events / Epochs / ERP (7)

mne_find_events · mne_events_from_annotations · mne_make_epochs · mne_plot_epochs_image · mne_average_evoked · mne_plot_evoked · mne_plot_topomap

Time-frequency (2)

mne_compute_tfr (Morlet/multitaper, custom cycles, ITC, trial power, baseline) · mne_tfr_morlet

Advanced analysis (8)

mne_decode (MVPA) · mne_connectivity · mne_compute_connectivity (bands, pairs, estimators) · mne_compute_noise_cov · mne_make_forward · mne_apply_inverse · mne_plot_source_estimate

mne_decoding_group_test provides participant-level max-T or cluster-corrected inference. Decoding reports separate numerical evidence, methods, interpretation, limitations and a results draft requiring scientific review. The code escape hatch is not equivalent to validated structured coverage of every MNE API.

Export (1)

mne_save

Anything still not covered — BIDS, custom statistics, beamformers, autoreject — is reachable through mne_run_code in the same live session. See TOOLS_REFERENCE.md for full parameter details. Advanced dependencies are checked per feature and are not bundled.


Development

# Compile check
python -m compileall src/mne_mcp

# Run tests
pytest

# CLI commands
mne-mcp status            # Check environment
mne-mcp setup --clients codex # Register in Claude Code / Codex / opencode + install skills
mne-mcp configure-claude  # Claude Code only

License

MIT — see LICENSE

Documentation

Metadata

Release files for mne-mcp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mne-mcp 0.4.0
File Size Uploaded Provenance
mne_mcp-0.4.0.tar.gz 189.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mne-mcp 0.4.0
File Interpreter ABI Platform
mne_mcp-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 370.6 kB

Release files / mne_mcp-0.4.0.tar.gz

Download URL mne_mcp-0.4.0.tar.gz
Size 189.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fe7f3f648c2acdcf8e74a06d00321b2f96de2e8f7dcb179ffc84cf5f350c6f90
BLAKE2b-256 checksum
How to use checksums
d70c03a1801f1098dce7e09c3a225e0af3708e736306f51eede8251d64a88dff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / mne_mcp-0.4.0-py3-none-any.whl

Download URL mne_mcp-0.4.0-py3-none-any.whl
Size 181.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba66dba9a7ae6b0ce9585ef75b08559db807e6701654727c20f77b8c8a7fe224
BLAKE2b-256 checksum
How to use checksums
64fbf5e6c4164eeda19a94f6fe0310b8c5f9d9488a7c042bb7ae943c76f2d699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Security for mne-mcp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mne_mcp-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page