Skip to main content
Glama

cellpy-mcp

An MCP server for cellpy. It lets an agent — or a chat window — load battery cells, collect them into frames, render figures, export data, look up how any cellpy call works, and set up a batch project. Without writing any Python.

pip install cellpy-mcp
cellpy mcp install        # register it with your chat client

Then restart the client and ask it to plot something.

Who it is for

  • People building on cellpy — a GUI, a script that automates cell handling. The tools are the useful API, and describe_api gives real signatures from the version you have installed.

  • People who just want to ask. Open a chat window, point it at a file, ask for capacity versus cycle. The prompts below are pickable starting points, so you do not have to know what to ask for.

  • People who would rather not use a terminal. new_project is cellpy new without the command line.

Nothing is hosted. Under stdio your chat client starts the server itself, on your machine, reading your files — there is no service to sign up for and nothing leaves the machine except what you paste into the chat.

Related MCP server: python-session-mcp

What it can do

Cells and figures:

Tool

What it gives you

list_instruments

loaders, and whether each can actually run on this machine

find_cells

files by project + number range; empty cellpy → offer_raw; kind=raw lists raw (incl. configured remote URIs) and sets needs_metadata

load_cell

a handle, cycle count, mass, optional nominal_capacity, summary column names

list_cells

what is loaded

describe_plot_families

the 20 summary families, marked available or missing-columns

collect

a handle, row count, columns, is_grouped, direction counts

preview_collection

a few rows, capped at 20

render

writes .json, .html, or a one-cell .cfz bundle; returns trace types, or format_version and row count

export_collection

writes csv/parquet/json; returns rows and bytes

The cellpy API — "how does this call work, and what are its arguments":

Tool

What it gives you

search_api

calls matching a name or a docstring line

describe_api

signature, argument types and defaults, docstring, undocumented_parameters, optionally source

Batch templating:

Tool

What it gives you

list_templates

registered and local templates, and which is the default

new_project

a project from a template; returns the notebooks it made

Prompts: analyse_cell, start_batch_project, explain_call.

Registering with your client

cellpy mcp install writes the block for you. Pass --client for anything other than Claude Desktop:

cellpy mcp install                     # Claude Desktop (default)
cellpy mcp install --client cursor
cellpy mcp install --client vscode
cellpy mcp install --list-clients      # where each one keeps its config

Add --dry-run to see the target first. Restart the client afterwards — none of them re-read the file while running.

Client

File it writes

Key

Claude Desktop

%APPDATA%/Claude/claude_desktop_config.json · ~/Library/Application Support/Claude/… · ~/.config/Claude/…

mcpServers

Cursor

~/.cursor/mcp.json — global; a project's .cursor/mcp.json wins over it

mcpServers

VS Code

%APPDATA%/Code/User/mcp.json · ~/Library/Application Support/Code/User/mcp.json · ~/.config/Code/User/mcp.json

servers

VS Code names the key servers, not mcpServers. If you edit that file by hand, this is the mistake to avoid: the wrong key parses, saves, and does nothing at all.

Claude Code

Claude Code is not registered by editing a file — its servers live in ~/.claude.json alongside your sign-in session and per-project trust decisions, or in a project-scoped .mcp.json. It has a command that handles scopes properly, so use that:

claude mcp add cellpy --env CELLPY_MCP_ROOT=/path/to/cells -- python -m cellpy_mcp

cellpy mcp install --list-clients prints that line filled in with the interpreter and the roots for your machine.

By hand

Any client that speaks stdio can run this; it is an ordinary MCP server. The block is the same everywhere except the top-level key:

{
  "mcpServers": {
    "cellpy": {
      "command": "/path/to/python",
      "args": ["-m", "cellpy_mcp"],
      "env": { "CELLPY_MCP_ROOT": "/path/to/cells" }
    }
  }
}

Use the full path to the interpreter that has cellpy-mcp installed, not a bare python: a desktop client activates no virtualenv and inherits no shell PATH, which is the most common reason a server shows up as failed.

cellpy mcp status says which clients it can see cellpy registered with.

Where it may read and write

Everything is confined to a set of roots, and both reads and writes are checked — an unchecked write would make the read check decoration.

By default the roots are the directories cellpy already knows about (rawdatadir, cellpydatadir, outdatadir, notebookdir), because you told cellpy where your data is when you set it up. Override with CELLPY_MCP_ROOT, which takes several directories separated the way PATH separates them:

CELLPY_MCP_ROOT=/data/cells:/data/out cellpy mcp serve

Roots that are not plain local directories are dropped: rawdatadir is often scp://host/…, and containment here is pathlib-based and cannot express "inside that remote share". If cellpy has no configured paths at all, the single root is ~/cellpy_mcp — never your whole filesystem.

Four things it does on purpose

Handles, not data. Only preview_collection returns rows. A tool result goes into a model's context window, and one collected summary is ~29 kB of CSV while a raw figure can be several MB.

Results carry the traps. render returns trace_types alongside points_plotted and rows_collected, so an agent that asked for a density film can see it got histogram2d rather than lines, and one that forgot direction="both" can see it plotted 891 of 2328 rows. A .cfz path is the handover file instead: one cell, through cellpy's save_bundle, with format_version and the row count. A density film is refused, and so is a summary collected without family=. describe_api returns undocumented_parameters for the same reason: cellpy documents about half its arguments, and a model should know when the package never said.

It follows the docstring's own cross-references. CellpyCell.get_cap takes 23 arguments, documents none, and points at cellpy.readers.capacity_curves.get_cap — which documents 22 of 24. Following that takes argument coverage across the documented API from 51% to 72%. Only a docs site resolves those markers; nobody reading a docstring does.

One client per process. State is process-wide, deliberately: the MCP SDK does not give a tool a stable session identity, and under stdio each client spawns its own process anyway. Do not put this behind a shared HTTP endpoint as written.

Limits worth knowing

  • load_cell blocks, with no progress and no cancellation, so a slow load can look like a hang to a client. This is the gap most worth closing.

  • No quota and no eviction: an agent can fill the sandbox with figures, and cells stay in memory until the process exits.

  • new_project has to create the project directory itself, because cellpy new prompts even with no_input=True (cellpy#990). It also downloads a cookiecutter from GitHub on first use.

Running it without cellpy's shim

cellpy mcp arrived in cellpy 2.1.3.post3, which this package requires. The same things are reachable without it:

python -m cellpy_mcp serve
python -m cellpy_mcp install --dry-run
python -m cellpy_mcp status

Background

The design, the measurements behind it, and a two-round prototype log are in cellpy#840.

MIT licensed.

Available Tools

12 tools
collectA

Build a collection. kind is one of: summary, cycles, ica, dva.

Returns a handle and the frame's shape — never the frame. Use preview_collection for rows, export_collection for the numbers.

For summary, give either columns or family (a name from describe_plot_families; the family supplies its own collect options). For cycles / ica / dva, give cycles.

Inputs: kind (required), cells, cycles, family, +3 more.

describe_apiA

What a cellpy call takes and what it does, from the installed package.

name is a dotted path (cellpy.get, cellpy.collect.collect_summary) or a bare name (get_cap) looked up in the index.

Read undocumented_parameters before answering a question about one of them. cellpy documents roughly half its arguments, so an argument missing from doc means the package never said what it does — not that it does not matter. Ask again with include_source=True rather than guessing.

When delegates_to is set, the docstring pointed at another call with a Sphinx reference and delegate_doc is where the arguments are actually described — read it, it is usually the real documentation.

Inputs: name (required), include_source.

describe_plot_familiesA

Summary plot families cellpy offers, and whether the loaded cells support them.

Availability is judged on what a family asks the summary for (summary_options().columns), not on the columns it draws — the drawn list includes columns the collector manufactures, and checking those reports "missing columns" for families that work perfectly well.

Inputs: no named parameters.

export_collectionB

Write the collected frame to path (.csv, .parquet or .json).

Inputs: path (required), handle (required).

list_cellsA

The cells loaded in this session.

Inputs: no named parameters.

list_instrumentsA

Which cellpy loaders exist, and which can actually run on this machine.

Inputs: no named parameters.

list_templatesA

Batch templates available for new_project, registered and local.

cellpy new --list prints this and returns nothing, so this reads the registry directly (jepegit/cellpy#991 asks for a library form).

Inputs: no named parameters.

load_cellA

Load one cell file and return a handle plus what the data can support.

mass_mg is the active-material mass. Without it every *_gravimetric column is computed against a default of 1.0 mg — the numbers still appear, they are simply wrong, so supply it when you know it.

Inputs: path (required), mass_mg, instrument.

new_projectA

Create a batch project from a template — the cellpy new workflow.

project is the folder, experiment the lookup value; the template dates the experiment folder itself, so experiment="exp001" becomes something like 2026_09_05_exp001. Writes inside the data directories only.

Downloads the cookiecutter from GitHub on first use.

Inputs: project (required), experiment (required), template, directory.

preview_collectionB

A few rows, capped. This is the only tool that returns data, on purpose.

Inputs: handle (required), rows.

renderB

Draw a collection and write the figure to path (.json or .html).

kind="film" gives a 2-D density rendering. Note it is a kind, not a layout: on cellpy 2.1.2 layout="film" silently drew lines instead (fixed in 2.1.3). The returned trace_types is how you check what you actually got.

Inputs: path (required), handle (required), kind, layout, +2 more.

search_apiA

Find cellpy calls by name, or by what their first docstring line says.

Use this when you know the task but not the call — "average cycles", "loading", "mass". describe_api then gives the arguments.

Inputs: query (required), limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: listing loaders, cells, and templates; loading; collecting; previewing; exporting; rendering; and API lookup. The list_* and describe_* tools are differentiated by their object type, and the collect/preview/export trio is clearly separated by what it returns or writes.

    Naming Consistency4/5

    Most tools follow a clear verb_noun snake_case pattern (list_cells, load_cell, export_collection, search_api). Minor deviations like 'collect', 'render', and 'new_project' are still readable and predictable, so consistency is high but not perfect.

    Tool Count5/5

    Twelve tools is well-scoped for a domain-specific analysis server. Each tool covers a meaningful part of the cellpy workflow without redundancy or bloat.

    Completeness5/5

    The set covers the full workflow: inspecting environment support, loading cells, building collections, previewing and exporting data, rendering figures, discovering API calls, and creating batch projects. The self-documentation tools fill gaps that would otherwise require external knowledge of cellpy.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables data analysis and visualization operations such as loading CSV/Excel/JSON files, computing summary statistics, generating charts, and exploring datasets via SSE/HTTP.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM clients to run Python code in a persistent, user-selected interpreter via MCP, with tools for data loading, summaries, regressions, diagnostics, and plotting, while keeping sessions alive between calls and isolating crashes.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM clients to load, clean, visualize, and analyze tabular datasets, and to generate multi-format analytic reports through natural language instructions.
      -