ephys-mcp
This server lets an LLM explore and analyze intracortical BCI/spike-level neural recordings through read-only MCP tools, including opening sessions, checking signal quality, detecting and sorting spikes, computing firing rates, fitting decoders, and generating figures.
Data sources: open synthetic recordings, local NWB files, broadband WAV folders, live LSL streams, and DANDI Archive datasets.
Session management: open/close sessions, view metadata (channels, rates, behaviour signals, licence, citation).
Signal quality: measure noise, SNR, and identify dead/noisy channels.
Spike analysis: detect threshold-crossing spikes with precision/recall, spike-sort broadband windows, and set or inspect probe geometry.
Firing statistics: get population firing-rate summaries and trial-aligned PSTHs.
Decoding: fit ridge or Kalman decoders from spikes to behaviour, decode windows, and evaluate cross-session decoder survival.
Latent dynamics: fit GPFA or PCA to trial-aligned activity and plot latent trajectories.
Visualization: plot probe maps, PSTHs, rasters, latent factors, and decoding results as inline PNGs.
Live/DANDI support: list LSL streams, check live stream status, search DANDI datasets, and list dataset files.
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., "@ephys-mcp Open a synthetic session and check signal quality."
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.
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.
Example output
Figures from the built-in synthetic source (32 units, 300 s, seed 2), produced by the server's own plot tools.
|
|
|
|
Related MCP server: nimbus-mcp
Status
v0.5. The planned feature set is complete: local NWB files, local broadband WAV recordings, live Lab Streaming Layer streams, streaming from the DANDI Archive, a synthetic motor-cortex source with ground truth, spike detection, quality metrics, ridge and Kalman decoders, trial-aligned PSTHs, spike sorting, cross-session (FALCON-style) evaluation, latent-factor models (GPFA, PCA), probe geometry, and figures. 24 tools. Bug reports and feature requests go to GitHub Issues.
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-mcpClaude 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.
HTTP transport
For remote clients or hosted agents, serve streamable HTTP instead of stdio:
EPHYS_MCP_TOKEN='a-long-random-secret' uvx ephys-mcp --http --host 0.0.0.0 --port 8000Every request must then carry Authorization: Bearer <token>. The server refuses to bind to a non-loopback address without a token, and tokens must be at least 16 characters. Put TLS in front of it (a reverse proxy) before exposing it beyond a private network: the token travels in clear text otherwise. On loopback the token is optional, so ephys-mcp --http alone serves http://127.0.0.1:8000/mcp for local testing.
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 |
| Simulated units tuned to cursor velocity, with broadband signal and ground truth |
| A local |
| Local broadband WAV ( |
| A live Lab Streaming Layer broadband stream on the local network; keeps the most recent |
| An NWB file streamed from the DANDI Archive by HTTP range requests; nothing is mirrored |
| Not implemented. Documents how a live implant adapter would be written on the same base as |
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 results, all simple causal linear baselines rather than state of the art:
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.
FALCON H1 (DANDI 000954, human 7-DoF velocity, 176 channels, 20 ms bins,
eval_mask): ridge trained on the first held-in day scores R² 0.43 on that day's minival, 0.07 one week later and below zero on the held-out days. That decay is the point of the benchmark; the Kalman filter is unsuitable for this scripted calibration data. FALCON's official test labels are private, so these are not leaderboard scores.
Decoder hyperparameters (ridge strength, the neural lead for Kalman) are chosen by blocked cross-validation inside the training split. Ridge history is 0.5 s of spike counts whatever the bin size.
GPFA is implemented from the paper's equations in numpy and scipy (EM over loadings, offsets, noise and per-factor timescales; no deep-learning dependency), and runs in seconds on a hundred trials. On the simulator, whose true latent is 2-D cursor velocity, it finds two dominant factors that explain velocity with R² 0.95 (PCA: 0.68). On MC_Maze_Small it shows the rotating population trajectory around movement onset that motor cortex is known for. LFADS-class models are out of scope: they need a training run of minutes and a deep-learning stack.
Tools
Tool | Purpose |
| Source types and their parameters |
| Search DANDI, or list curated intracortical datasets |
| Licence, citation and NWB files of a DANDI dataset |
| LSL streams visible on the network |
| For a live session: buffered span, whether data is arriving, drops |
| Session lifecycle |
| Channels, rates, behaviour signals, licence, citation |
| Noise, SNR, dead/noisy channels |
| Threshold crossings; precision/recall when truth exists |
| Spike-sort a broadband window with spikeinterface ( |
| Supply contact positions for a session whose file has none: Utah, grid, linear, tetrode layouts or explicit coordinates |
| Contact positions and brain-area labels per channel |
| Figure: array map, contacts coloured by firing rate, sorted units per contact |
| Population rate summary |
| Ridge or Kalman, scored on held-out data; hyperparameters chosen inside the training split |
| Decoded-vs-true preview for a window |
| Fit on one session, score unchanged on others: does a decoder survive to a later day? Honours FALCON's |
| Firing aligned to a trial event, optionally grouped by a trial column or limited to some units |
| GPFA (Yu et al. 2009) or PCA on trial-aligned activity: single-trial latent trajectories, variance per factor, timescales, and how well the top factors explain a velocity signal |
| Figure: top three factors over time, the factor-1/factor-2 state space, and variance per factor |
| Figure: PSTH per group with SEM, above a unit-by-time heatmap of change from baseline |
| Figure: spike raster, unrecorded spans shaded |
| Figure: decoded against actual behaviour, one panel per dimension |
Resource: ephys://sessions. Prompts: analyze_session, falcon_evaluate.
Tools return summaries, never raw arrays, so results fit in a model's context.
Optional extras
Extra | Adds | Install |
| the |
|
|
|
|
Sorting uses the session's probe geometry, from the file's electrode table or from set_probe_geometry, so contacts under 100 µm apart are sorted jointly. This matters on dense probes: on a simulated 20 µm laminar probe, sorting with the true geometry finds the 12 real units, while treating contacts as independent reports 15, counting the same unit again on neighbouring contacts. Without geometry, channels are placed far apart and treated as isolated electrodes. On the simulator, spykingcircus2 recovers every unit with recall above 0.95.
Brain-area labels come from the NWB electrodes table when present (MC_Maze reports PMd and M1); get_probe lists them per channel so an analysis can be restricted to one area with the units argument. Note that none of the DANDI datasets tried so far stores contact coordinates, so for those set_probe_geometry is the way to supply an array layout.
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
NeuralSourcecontract has no write, stimulate or configure method. None will be added without a separate safety design.Local by default. stdio transport, no telemetry. HTTP is opt-in and token-gated. Neural data is sensitive.
No bundled third-party data. See DATA_LICENSES.md.
Writing a source adapter
For recordings, subclass ephys_mcp.sources.base.NeuralSource (info, read_raw, spike_times, behavior). For a live device, subclass ephys_mcp.sources.live.RingBufferSource and call push(samples) from a reader thread; sources/lsl.py is a complete example in about 60 lines, and sources/n1_stub.py lists what an implant adapter would additionally need. Register the class in ephys_mcp/sources/__init__.py.
Live sessions report time as seconds since open, and only the most recent buffer is readable, so t_start_s and duration_s move forward.
Development
uv run pytest # offline
uv run pytest -m network # also streams a real file from DANDI
uv run ruff check .Citing
See CITATION.cff; GitHub's "Cite this repository" button uses it. Cite the datasets you analyse separately: get_session_info returns each one's citation.
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.
Available Tools
24 toolsclose_sessionC
Close a session and drop any decoder fitted on it.
Inputs: session_id (required).
decode_windowC
Decode a window with the fitted decoder; returns a downsampled decoded-vs-true preview.
Inputs: t0 (required), session_id (required), duration_s, max_points.
detect_spikesC
Threshold-crossing spike detection on a broadband snippet (max 10 s).
Where the session has ground-truth spikes, precision and recall are reported.
Inputs: session_id (required), t0, duration_s, threshold_sigma.
evaluate_cross_sessionA
Fit a decoder on one session and score it, unchanged, on other sessions: the question benchmarks such as FALCON ask (does a decoder survive to a later day?).
All sessions must be open and share the same units/channels. `mask` names a boolean
behaviour signal restricting which bins are scored (FALCON files carry `eval_mask`; pass
null when the sessions have none). Also reports same-session held-out R² for comparison.
Inputs: test_session_ids (required), train_session_id (required), kind, mask, +2 more.
fit_decoderA
Fit a decoder from spike counts to a behaviour signal and score it on held-out data.
The first `train_fraction` of the session trains; the remainder tests. With no
`target`, the first velocity-like behaviour signal is used. Unrecorded gaps are skipped.
`mask` names a boolean behaviour signal (such as FALCON's eval_mask); only bins where it
is true are used for fitting and scoring.
Inputs: session_id (required), kind, mask, bin_s, +2 more.
fit_latent_factorsA
Fit low-dimensional latent factors to trial-aligned population activity.
GPFA (Yu et al. 2009) gives denoised single-trial trajectories and a timescale per factor;
PCA is the fast, noisier baseline. Look for an elbow in variance_explained_per_factor to
judge dimensionality. If the session has a velocity-like signal, reports how well the top
factors explain it. Then plot_latent_factors draws the trajectories.
Inputs: session_id (required), bin_s, event, units, +5 more.
get_firing_ratesC
Population firing-rate summary over a time range (defaults to the whole session).
Inputs: session_id (required), t0, t1.
get_probeB
Contact geometry and brain-area labels per channel, where known. Use the channel
indices with the units argument of get_psth / fit_latent_factors to analyse one area.
Inputs: session_id (required), max_rows.
get_psthA
Peri-stimulus time histogram: firing aligned to a trial event and averaged over trials.
`event` is one of the session's event_columns (default: movement onset if present).
`group_by` splits trials by one of its group_columns, e.g. reach direction.
`units` restricts the analysis to some units; tuning that cancels in the population
average (such as direction preference) only shows up per unit. Unit numbers in the
result index into `units` when it is given.
Returns the population time course, its peak, and the units that change most.
Inputs: session_id (required), bin_s, event, units, +3 more.
get_session_infoB
Metadata for a session: duration, channels, sampling rates, behaviour signals, licence, citation.
Inputs: session_id (required).
get_signal_qualityB
Noise level, SNR and dead/noisy channels from a broadband snippet (max 10 s).
Inputs: session_id (required), t0, duration_s.
get_stream_statusB
For a live session: how much signal is buffered, whether data is still arriving, and drops.
Inputs: session_id (required).
list_dataset_filesC
Licence, citation and NWB files of a DANDI dataset. Pass a file's path to open_session(source='dandi').
Inputs: dandiset_id (required), limit, version.
list_lsl_streamsB
Lab Streaming Layer streams visible on the local network (needs the lsl extra).
Inputs: wait_s.
list_sourcesA
List the data source types this server can open, with their parameters and status.
Inputs: no named parameters.
open_sessionB
Open a recording session and return its session_id and metadata.
`params` overrides the source's default_params (see list_sources).
Inputs: params, source.
plot_decodingA
Figure: decoded against actual behaviour for a window (max 60 s), one panel per dimension. Requires fit_decoder first. Pick a window in the test split for an honest picture.
Inputs: t0 (required), session_id (required), duration_s.
plot_latent_factorsA
Figure: the top three latent factors over time (single trials thin, group means bold), the trajectory in the plane of the first two factors, and variance explained per factor. Requires fit_latent_factors first.
Inputs: session_id (required), max_trials_drawn.
plot_probeB
Figure: the array map, each contact coloured by its firing rate over a window, with area labels and sorted units marked when a sort has been run. Needs geometry from the file or set_probe_geometry.
Inputs: session_id (required), t0, duration_s.
plot_psthB
Figure: population PSTH per group (mean ± SEM over trials) above a unit-by-time heatmap of change from baseline. Same arguments as get_psth. Returns the PNG path and the image.
Inputs: session_id (required), bin_s, event, units, +3 more.
plot_rasterC
Figure: spike raster for a time window (max 60 s), with unrecorded spans shaded.
Inputs: session_id (required), t0, max_units, duration_s.
search_datasetsA
Search the DANDI Archive for datasets. An empty query returns a short curated list of intracortical datasets that work well with this server.
Inputs: limit, query.
set_probe_geometryA
Tell the server where the recording's contacts are, for sessions whose file does not say.
Named layouts: 'utah' (square grid, e.g. 96 contacts at 400 um), 'grid' with n_columns,
'linear' (one column at pitch_um, e.g. a laminar probe), 'tetrode_linear' (groups of four).
'explicit' takes positions_um as [[x, y], ...] in channel order. Geometry is used by
sort_spikes and plot_probe. Contacts under 100 um apart are sorted jointly.
Inputs: session_id (required), layout, pitch_um, n_columns, +1 more.
sort_spikesA
Spike-sort a broadband window (needs the sort extra). Afterwards the session's spike times are the sorted units, restricted to that window, so rates, PSTHs, rasters and decoders use them.
Uses the session's probe geometry (from the file or set_probe_geometry) so nearby contacts
are sorted jointly; without geometry each channel is treated as an independent electrode.
Sorting takes seconds to a few minutes depending on duration and channel count.
Inputs: session_id (required), t0, sorter, channels, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools have clearly distinct purposes, and the descriptions separate similar operations well. Minor overlap exists between open_session/get_session_info (both return metadata) and detect_spikes/sort_spikes (both derive spike times from broadband data), but the descriptions clarify the different workflows.
Tool names follow a consistent snake_case verb_noun pattern: open_session, close_session, get_session_info, set_probe_geometry, list_sources, fit_decoder, sort_spikes, plot_raster. The naming convention is uniform and predictable across all 24 tools.
At 24 tools, the server is on the heavy end of the borderline range and covers a broad electrophysiology workflow. While each tool seems to have a legitimate role, the sheer number may make tool selection more difficult than necessary.
The tool set covers the main ephys lifecycle: dataset discovery, session open/close, metadata, signal quality, spike detection/sorting, decoding, latent factor analysis, and plotting. Minor gaps exist, such as no explicit list of currently open sessions or raw signal extraction, but these are workable around and do not block the core workflow.
Maintenance
Related MCP Connectors
Read-only U.S. mortgage market, lender, GSE performance, and servicing analytics.
Experiment tracking for coding agents: read your team's ML runs, metrics and lineage. Read-only.
Read-only Bitcoin blockchain, mempool, mining, market, and on-chain analytics; no API key.
Read Physical AI datasets, projects, fleet and quality data. Requires authorized Avala access.
Related MCP Servers
- AlicenseBqualityBmaintenanceAn MCP server that gives AI assistants conversational access to MNE-Python for analyzing neurophysiology data (EEG, MEG, sEEG, ECoG, fNIRS). Enables plain-language analysis pipelines, from loading recordings to generating figures and explanations.41108 PyPI13MIT

nimbus-mcpofficial
AlicenseBqualityBmaintenanceEnables AI agents to build, validate, run, and analyze EEG/BCI pipelines, including uploading EEG data, inspecting datasets and files, running experiment campaigns, and managing live EEG streaming sessions.32142 PyPI3Apache 2.0- AlicenseNot gradedqualityNot gradedmaintenanceEnables deterministic, zero-dependency audiological analysis of distortion-product emissions, SNR/clinical pass criteria, and outer hair cell fatigue scoring so agents can assess cochlear health and headphone noise overexposure.MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables LLMs and autonomous agents to compute phase-locking value, signal-to-noise ratio, and subcortical temporal envelope encoding fidelity through JSON-RPC tool integration.MIT

