Skip to main content

ephys-mcp

An MCP server that lets an LLM analyse intracortical (spike-level) brain-computer-interface recordings: signal quality, spike detection, firing rates, and cursor-velocity decoding.

Existing BCI MCP servers target scalp EEG. This one targets the kind of data a high-channel-count implant produces, and defines a read-only adapter contract so a live device backend can be added when a vendor publishes an API.

Research and education software. Not a medical device. Not for clinical use. Not affiliated with or endorsed by Neuralink Corp. or any other implant manufacturer.

Status

v0.1, early. Working today: local NWB files, local broadband WAV recordings, streaming from the DANDI Archive, a synthetic motor-cortex source with ground truth, spike detection, quality metrics, ridge and Kalman decoders, trial-aligned PSTHs, and figures. Planned: PyPI release and registry listings.

Install and run

Needs uv. No install step: uvx ephys-mcp fetches the package and starts the server on stdio.

Claude Code:

claude mcp add ephys -- uvx ephys-mcp

Claude Desktop (claude_desktop_config.json):

{ "mcpServers": { "ephys": { "command": "uvx", "args": ["ephys-mcp"] } } }

From a checkout, use uv run ephys-mcp instead, or uv --directory /path/to/ephys-mcp run ephys-mcp in the configs above.

Then ask, for real data: "Find a small motor cortex dataset on DANDI, open it, and tell me how well hand velocity can be decoded." Or offline: "Open a synthetic session, check signal quality, fit a Kalman decoder and show me a decoded window."

Data sources

Source What it opens
synthetic Simulated units tuned to cursor velocity, with broadband signal and ground truth
nwb A local .nwb file (params.path)
wav_dir Local broadband WAV (params.path): a folder of mono clips, one channel each, or one multi-channel file
dandi An NWB file streamed from the DANDI Archive by HTTP range requests; nothing is mirrored
n1_stub Not implemented. Documents the contract for a live implant adapter

Dataset licence and citation come from the archive and are returned by open_session, so the model can attribute the data. Many datasets record only during trials; the server tracks those spans (recorded_fraction) and leaves the gaps out of rates and decoding instead of reading them as silence.

WAV samples carry no physical unit, so amplitudes are reported as ADC counts unless you pass uv_per_count; every amplitude result names its unit. Clips in a folder are separate recordings, so the server says that timing across those channels is not meaningful. Spike times from WAV are threshold crossings, not sorted units.

Reference result on MC_Maze_Small (DANDI 000140, 142 units, last 20% held out, 50 ms bins): ridge R² 0.50, Kalman R² 0.34 for hand velocity. These are simple causal linear baselines, not state of the art.

Tools

Tool Purpose
list_sources Source types and their parameters
search_datasets Search DANDI, or list curated intracortical datasets
list_dataset_files Licence, citation and NWB files of a DANDI dataset
open_session / close_session Session lifecycle
get_session_info Channels, rates, behaviour signals, licence, citation
get_signal_quality Noise, SNR, dead/noisy channels
detect_spikes Threshold crossings; precision/recall when truth exists
get_firing_rates Population rate summary
fit_decoder Ridge or Kalman, scored on held-out data; hyperparameters chosen inside the training split
decode_window Decoded-vs-true preview for a window
get_psth Firing aligned to a trial event, optionally grouped by a trial column or limited to some units
plot_psth Figure: PSTH per group with SEM, above a unit-by-time heatmap of change from baseline
plot_raster Figure: spike raster, unrecorded spans shaded
plot_decoding Figure: decoded against actual behaviour, one panel per dimension

Resource: ephys://sessions. Prompt: analyze_session.

Tools return summaries, never raw arrays, so results fit in a model's context.

Plot tools return the PNG inline, so a vision-capable model can read the figure, and also save it under ~/.cache/ephys-mcp/plots (override with EPHYS_MCP_OUTPUT_DIR). Figures use a categorical palette checked for colour-blind separation, with direct labels so identity never rests on colour alone.

Design rules

  • Read-only. The NeuralSource contract has no write, stimulate or configure method. None will be added without a separate safety design.
  • Local by default. stdio transport, no telemetry. Neural data is sensitive.
  • No bundled third-party data. See DATA_LICENSES.md.

Writing a source adapter

Subclass ephys_mcp.sources.base.NeuralSource (info, read_raw, spike_times, behavior) and register it in ephys_mcp/sources/__init__.py. sources/n1_stub.py documents what a live implant adapter would need.

Development

uv run pytest              # offline
uv run pytest -m network   # also streams a real file from DANDI
uv run ruff check .

Licence

CC0 1.0 Universal. The authors waive all copyright and related rights to the extent the law allows. Use it for anything, no attribution required. CC0 does not grant patent or trademark rights.

Release files for ephys-mcp 0.1.1

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

Source distribution (sdist)

Source distribution for ephys-mcp 0.1.1
File Size Uploaded
ephys_mcp-0.1.1.tar.gz 26.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ephys-mcp 0.1.1
File Interpreter ABI Platform
ephys_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.8 kB

Release files / ephys_mcp-0.1.1.tar.gz

Download URL ephys_mcp-0.1.1.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e701756b7f42340d7f47dce02a351d0b1e399bcd41017cf3a67315360b320d7f
BLAKE2b-256 checksum
How to use checksums
7b012056a71380144a3462f18d7f80376b84a54649315db8fab4b46a4bf89a51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ephys_mcp-0.1.1-py3-none-any.whl

Download URL ephys_mcp-0.1.1-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8c12ed779c96b5d91b5ada83cae28f87704debfee8be365662e0b12aeb6a689
BLAKE2b-256 checksum
How to use checksums
11408f3ef0839d52ced7aedcd8b12e123983eac8c94e4b28c18a9a6301d94a4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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