jupyter_mcp
Provides tools for creating, editing, and executing Jupyter notebooks via an MCP interface, including cell management, dependency tracking, and output condensation.
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., "@jupyter_mcp run stale cells in data_analysis.ipynb"
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.
jupyter-mcp
Kernel-attached MCP server for Jupyter EDA workflows. Built for coding agents that iterate on notebooks: named cells, a dependency DAG, minimal re-execution, condensed outputs, and cheap LLM summaries for navigation.
Why
Editing notebooks through generic file tools is painful for agents:
cells have no stable, human-meaningful addresses
every change means re-executing the whole notebook from scratch
raw outputs (box-drawn tables, base64 charts, ANSI noise) flood context
nothing tells you which cells a change invalidates
This server fixes each of those with an opinionated data model.
Related MCP server: Jupyter MCP Server
Concepts
Concept | What it means |
Cell names | Every cell has a unique kebab-case name stored in |
Revisions | Each cell has a short content hash ( |
Dependency DAG | A static AST pass (not runtime tracing) extracts per-cell defines/uses/mutations and builds last-writer-wins edges. Works on unexecuted cells, which is the whole point: edit first, then |
Staleness | A cell is fresh only if its current source ran on the currently live kernel (freshness is stamped with a per-kernel epoch). Source edits make a cell and its dependents stale; a new or restarted kernel makes everything stale — persisted metadata can never claim freshness against empty kernel state. |
Background execution | Every run goes through a per-notebook executor thread. |
Condensed outputs | Streams merged, ANSI stripped, long text truncated head+tail with explicit markers. Duplicate table reprs collapse to one: uniform → CSV, ragged → JSON. Charts return as real MCP images (downscaled), so the agent sees them. |
Summaries | Lazy, batched |
Snapshots / undo | Every mutation snapshots the file first (under |
Tools
Tool | Purpose |
| New empty notebook |
| Index: names, revs, staleness, tldrs, edges, lint |
| Full cells (code + condensed outputs + images), by names/slice |
| Mutations; all take |
| Default: all stale cells (minimal recompute). With |
| Stop the running cell (KeyboardInterrupt), cancel the queue |
| Fresh kernel; marks everything stale |
| Type/shape/schema of a live variable plus its richest repr: dataframes as CSV, figures as images, else pretty repr |
| Restore pre-mutation snapshot |
| Detailed LLM summaries incl. outputs |
| Search source + names + summaries |
Setup
uv syncRegister with Claude Code (.mcp.json in any project, or globally):
{
"mcpServers": {
"jupyter": {
"command": "uv",
"args": ["run", "--project", "/path/to/jupyter_mcp", "jupyter-mcp"]
}
}
}The server is multi-notebook: every tool takes a notebook path, one kernel
per notebook, started lazily in the notebook's directory (so relative data
paths behave like in your editor). Kernelspec comes from the notebook's
metadata, falling back to python3. Kernels idle longer than 30 minutes are
shut down lazily (JUPYTER_MCP_KERNEL_TTL_SECONDS overrides); the next
execution restarts them, and epoch-scoped staleness handles the rest. On
POSIX, kernels connect over IPC sockets (no open TCP ports).
Summaries & credentials
Summaries use the plain anthropic SDK: credentials resolve from
ANTHROPIC_API_KEY or an ant auth login profile automatically. Cost is
negligible (Haiku, batched, hash-cached). To disable entirely set
JUPYTER_MCP_DISABLE_SUMMARIES=1 — everything else works unchanged.
Development
uv run pytest # full suite
uv run pytest -m "not kernel" # skip real-kernel integration testsLayout: src/jupyter_mcp/ is a plain library (model, dag, condense, kernel,
summaries, session) with the MCP surface isolated in server.py; everything
below the server is unit-testable without MCP.
Known limitations (v1)
The DAG is static: dynamic patterns (
globals()[name] = ...,exec, attribute mutation through aliases) are invisible. Method calls only count as mutations for a known allowlist (append,fit, ...) — pure-functional chains (polars) intentionally create no false forward edges.%%bash/%%sqlstyle cells are treated as opaque (no dependencies).Concurrent edits from a live Jupyter editor are detected (the server reloads and rejects the mutation) but not merged.
See docs/ROADMAP.md for what's deliberately deferred — including the phase-2 OKF knowledge base.
Available Tools
14 toolsadd_cellA
Add a cell. name must be unique kebab-case. Placement: after (an
existing cell name; '' prepends), index, or omit both to append.
run="stale" immediately executes every stale cell (the add→run loop in
one call) and returns the execution results.
Inputs: name (required), path (required), source (required), run, +3 more.
create_notebookA
Create a new empty notebook at path (must not exist yet).
Inputs: path (required), kernel_name. Returns: result
inspect_variableA
Inspect a live kernel variable without adding a cell: type, shape, schema/columns, length, plus its richest Jupyter repr — dataframes condense to a CSV table, figures come back as images, everything else falls back to a (pretty) repr.
Inputs: path (required), variable (required), timeout_seconds.
interruptA
Interrupt the currently running cell (KeyboardInterrupt in the kernel) and cancel queued cells. Kernel state (variables) survives; interrupted cells read as stale until a successful re-run.
Inputs: path (required), clear_queue. Returns: result
move_cellB
Move a cell: after an existing cell ('' moves to top) or to index.
Inputs: name (required), path (required), expected_rev (required), after, +1 more. Returns: result
notebook_overviewA
Index of the notebook: one line per cell (index, name, revision, staleness, one-line summary) plus dependency edges and lint findings. Start here when opening a notebook. Summaries marked with * are deterministic fallbacks, not LLM-generated.
Inputs: path (required), refresh_summaries. Returns: result
read_cellsA
Read cells with code and condensed outputs (charts attached as images).
Select by names (list of cell names), indices (python slice string
like '0:5'), or neither for the whole notebook. view: full | code |
outputs.
Inputs: path (required), view, names, indices.
remove_cellA
Delete a cell (requires its current rev; undo with undo_last).
Inputs: name (required), path (required), expected_rev (required). Returns: result
restart_kernelA
Restart the notebook's kernel (all in-memory state is lost; every code cell becomes stale).
Inputs: path (required). Returns: result
runA
Execute cells on the notebook's persistent kernel.
Default (no `cells`): every stale cell in document order — minimal
recompute after edits. With `cells`: exactly those cells, even if fresh
(API calls, randomness), preceded by their stale ancestors so inputs are
trustworthy (`fresh_deps=false` skips the ancestor pass). Outputs are
persisted and returned condensed; charts come back as images; `quiet`
collapses ok cells to status lines. If everything finishes within
`wait_seconds` you get full results; otherwise execution continues in the
background — watch it via notebook_overview / read_cells (live output),
stop it via interrupt.Inputs: path (required), cells, quiet, fresh_deps, +2 more.
search_cellsB
Search cell sources, names, summaries, and condensed outputs. Returns matching cells with the matching lines.
Inputs: path (required), query (required), regex. Returns: result
summarize_cellsC
Detailed summaries (LLM): per-cell description plus, optionally, a summary of each cell's current output. Cheaper than reading full cells when orienting in a large notebook.
Inputs: path (required), names, include_outputs. Returns: result
undo_lastB
Restore the notebook to its state before the most recent mutation.
Inputs: path (required). Returns: result
update_cellA
Replace a cell's source and/or rename it. expected_rev must be the
rev from your latest read of this cell (optimistic locking). Updating
source clears the cell's outputs and marks it (and dependents) stale.
run="stale" immediately executes every stale cell (the edit→run loop in
one call) and returns the execution results.
Inputs: name (required), path (required), expected_rev (required), run, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool has a clear, distinct purpose with minimal overlap. The only potential ambiguity is between add_cell's run option and the run tool, but their primary functions are sufficiently different.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., add_cell, create_notebook, inspect_variable). The only minor deviation is undo_last (verb_adverb), but it remains consistent with the overall style.
With 14 tools, the set is well-scoped for a Jupyter notebook server. It covers creation, editing, execution, inspection, and undo operations without being excessive or insufficient.
The tool surface covers the core notebook lifecycle (CRUD, execution, inspection, undo). However, there is no explicit save or export tool, which is a minor gap assuming automatic persistence.
Maintenance
Related MCP Connectors
System-of-record notebook for AI coding agents: pages, datastores, tasks, skills over MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Control Protocol (MCP) server that enables remote programmatic control of Jupyter notebooks, allowing AI assistants and applications to create, edit, and execute notebook cells via SSE protocol.-
- AlicenseAqualityDmaintenanceAI-powered MCP server for connecting and managing Jupyter Notebooks. Enables interactive code execution, multi-notebook management, and multimodal output for data analysis, visualization, and machine learning.1278 PyPI9MIT
- FlicenseNot gradedqualityCmaintenanceA local MCP server for reading, writing, and executing Jupyter notebooks using jupyter_client for direct kernel communication.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to execute Jupyter notebook cells with persistent kernel state, output persistence, and structured JSON control surface.2-