Jupyter Notebook MCP Server
Enables AI agents to read, edit, execute cells, and capture outputs from Jupyter notebooks directly within VS Code or Cursor via the Model Context Protocol.
README
Jupyter Notebook MCP Server

A VS Code / Cursor extension that exposes Jupyter notebook manipulation via MCP (Model Context Protocol): read/edit/run cells and capture outputs. Works with Claude Code, Cursor Agent, Windsurf, and any MCP-compatible AI assistant.
Install: VS Code Marketplace · Open VSX · GitHub
[!IMPORTANT] This project is still pre-alpha so it's very rough on the edge. Working in multiple windows is unstable.
Why connect to VS Code Runtime API?
There are currently two main architectures to give AI agents access to Jupyter notebooks. This project was heavily inspired by both - kudos to these teams for pioneering the space:
Architecture 1: File-based (e.g., cursor-notebook-mcp)
These servers read/write .ipynb files directly using libraries like nbformat.
Pros: No server dependencies, works out-of-the-box
Cons:
- Cannot execute code - agents can only edit cells, user must run them manually
- UI sync issues - VS Code may show stale content until you revert/reopen
- The
.ipynbJSON format is verbose (~3x more tokens than raw code) - Race conditions if you edit while agent writes
Architecture 2: Jupyter Server API (e.g., jupyter-mcp-server)
These servers connect to Jupyter's REST API and can execute code through the kernel.
Pros: Can execute code, best choice for standalone remote JupyterLab/JupyterHub deployments
Cons:
- Requires running JupyterLab separately (
jupyter lab --port 8888) - Auth setup: tokens, URLs, environment variables
- You end up running two UIs: one for notebook and another for AI
- If you open the notebook in VS Code you create another source of truth (Jupyter server state vs your editor)
Architecture 3: VS Code / Cursor Runtime API (this extension)
We're introducing a third architecture - hooking directly into Cursor/VS Code's Notebook API, the same API the editor uses internally.
Pros:
- Zero config - just install, server starts automatically
- Faster reads (direct memory access, no serialization)
- Executes code in your existing kernel (the one VS Code already manages)
- Changes appear instantly in the editor with full undo/redo support
- Single source of truth: what you see is what the agent sees
- Works with remote kernels - if VS Code connects to a remote Jupyter server, so does the agent
Cons:
- Only works inside VS Code / Cursor (won't help if you use JupyterLab web UI)
When to use what
| Use case | Recommended |
|---|---|
| VS Code / Cursor + AI coding | This extension |
| Remote VS Code / Cursor (tunnels, containers, SSH) | This extension |
| Standalone JupyterLab/JupyterHub server | Datalayer |
| Just edit cells, no execution needed | File-based |
Features
- Execute code in the active kernel and retrieve outputs
- Full cell manipulation - insert, edit, delete, move cells
- Read cell contents and outputs including images (base64)
- Search and navigate - find text, get notebook outline
- Bulk operations - add multiple cells, clear all outputs
Tools (15)
Navigation & Reading
| Tool | Description |
|---|---|
notebook_list_open |
List all open notebooks with URIs and cell counts |
notebook_list_cells |
List cells with type, language, preview, execution state |
notebook_get_cell_content |
Get full source code of a cell |
notebook_get_cell_output |
Get cell outputs (text, errors, images as base64) |
notebook_get_outline |
Get notebook structure (headings, functions, classes) |
notebook_search |
Search all cells for a keyword with context |
notebook_get_kernel_info |
Get kernel name, language, and state |
Cell Manipulation
| Tool | Description |
|---|---|
notebook_insert_cell |
Insert a code or markdown cell at any position |
notebook_edit_cell |
Replace the content of an existing cell |
notebook_delete_cell |
Delete a cell by index |
notebook_move_cell |
Move a cell to a different position |
notebook_bulk_add_cells |
Add multiple cells in a single operation |
Execution & Outputs
To execute ad-hoc code, use notebook_insert_cell with execute: true. To execute an existing cell, use notebook_run_cell.
| Tool | Description |
|---|---|
notebook_run_cell |
Execute an existing code cell by index and return outputs |
notebook_clear_outputs |
Clear outputs of a specific cell |
notebook_clear_all_outputs |
Clear outputs from all cells |
<details> <summary><b>Tool Parameters</b></summary>
All tools support response_format parameter ("markdown" or "json").
notebook_insert_cell
{
"content": "print('hello')",
"type": "code",
"index": 0,
"language": "python",
"execute": false
}
notebook_edit_cell
{
"index": 0,
"content": "# New content"
}
notebook_search
{
"query": "import pandas",
"case_sensitive": false,
"context_lines": 1
}
notebook_move_cell
{
"from_index": 5,
"to_index": 0
}
notebook_bulk_add_cells
{
"cells": [
{"content": "# Header", "type": "markdown"},
{"content": "x = 1", "type": "code", "language": "python"}
],
"index": 0
}
notebook_run_cell
{
"index": 0
}
</details>
Setup
- Install the extension in VS Code or Cursor
- Add to your MCP client config:
{
"mcpServers": {
"notebook": {
"url": "http://127.0.0.1:49777/mcp"
}
}
}
[!ATTENTION] The server starts automatically when VS Code / Cursor opens. Look for the
🪐 :49777indicator in the status bar.
Configuration
| Setting | Default | Description |
|---|---|---|
notebook-mcp.port |
49777 |
Port number for the MCP server |
Performance
Tested with a 471-cell notebook (~2.8MB, 1MB outputs):
| Operation | Time |
|---|---|
| List/read cells | <1ms |
| Search all cells | <1ms |
| Generate outline | ~1ms |
| Insert/edit cell | ~7ms |
[!NOTE] Read operations are sub-millisecond because they access in-memory data structures directly. Write operations (~7ms) go through VS Code's edit pipeline for undo/redo support.
Requirements
- VS Code 1.85+ or Cursor 0.43+
- Jupyter extension
Architecture
┌─────────────────────────────────────────────────────────────────────────┐
│ VS Code / Cursor │
│ │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ Jupyter Extension │ │
│ │ │ │
│ │ Notebook Document ◄───► Kernel (Python) ───► Outputs │ │
│ │ ▲ │ │
│ └────────────────────────────────────┼──────────────────────────────┘ │
│ │ │
│ ┌────────────────────────────────────┼──────────────────────────────┐ │
│ │ Notebook MCP Server Extension │ │
│ │ │ │ │
│ │ ┌────────────────────────────────┴───────────────────────────┐ │ │
│ │ │ HTTP Server (:49777) │ │ │
│ │ │ │ │ │
│ │ │ execute_code insert_cell list_cells get_output ... │ │ │
│ │ └────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
│
│ HTTP (MCP Protocol)
▼
┌───────────────────────────────┐
│ AI Agent │
│ (Claude Code, Cursor, etc) │
└───────────────────────────────┘
How It Works
- Extension embeds an HTTP-based MCP server (port 49777)
- AI agent (Claude Code, Cursor Agent, etc.) sends tool calls via MCP protocol
- Server uses VS Code / Cursor APIs to manipulate the active notebook
- Changes appear instantly in the editor
- Outputs are captured and returned to the agent
This enables true interactive notebook sessions with AI agents in VS Code and Cursor.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。