universal-notebook-mcp
universal-notebook-mcp
Run Jupyter notebooks from any AI editor. Gives your AI assistant full access to read, edit, and execute .ipynb files with live kernel output — without needing to open JupyterLab.
Works in Antigravity, Cursor, Windsurf, Claude Desktop, Claude Code, and any MCP-compatible tool. Works on Windows, macOS, and Linux.
Quick start
1. Install Python 3.10+
Skip this step if you already have Python 3.10 or later (python --version to check).
Download from python.org and run the installer. Make sure to check "Add Python to PATH" during setup.
Or with winget:
winget install Python.Python.3.11brew install python@3.11Or download from python.org.
# Debian / Ubuntu
sudo apt install python3.11 python3.11-pip
# Fedora / RHEL
sudo dnf install python3.11
# Arch
sudo pacman -S python2. Install the package
pip install universal-notebook-mcpOn macOS/Linux, if
pipmaps to Python 3.9, usepip3.11instead. On Windows,pipfrom the Python 3.11 installer works directly.
Verify it installed:
nb-mcp --help3. Add to your editor
Pick your editor below and paste the config. Replace the path with the folder that contains your notebooks.
⚠️ Use the real absolute path — MCP clients pass arguments as literal strings and do not expand editor variables like
${workspaceFolder}.Windows paths: use forward slashes or escape backslashes:
C:/Users/you/notebooksorC:\\Users\\you\\notebooks
Create .antigravity/mcp.json in your project folder:
{
"mcpServers": {
"notebook": {
"command": "nb-mcp",
"args": ["--workspace-root", "/absolute/path/to/notebooks"]
}
}
}Or go to Settings → MCP Servers and add the same block.
~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
{
"mcpServers": {
"notebook": {
"command": "nb-mcp",
"args": ["--workspace-root", "/absolute/path/to/notebooks"]
}
}
}~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"notebook": {
"command": "nb-mcp",
"args": ["--workspace-root", "/absolute/path/to/notebooks"]
}
}
}Config file location:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"notebook": {
"command": "nb-mcp",
"args": ["--workspace-root", "/absolute/path/to/notebooks"]
}
}
}claude mcp add notebook -- nb-mcp --workspace-root /absolute/path/to/notebooks4. Reload your editor and go
Your AI can now work with notebooks. Try:
"List the cells in my notebook" "Run cell 3 and show me the output" "Fix the error in cell 5 and re-run it"
What it can do
Tool | What it does | |
📖 |
| See all cells (type, tags, first line) |
📖 |
| Read full source + saved outputs of a cell |
📖 |
| Read just the outputs (stream, result, error) |
📖 |
| Read notebook metadata (kernel, language, etc.) |
📖 |
| List all pipeline stage tags in the notebook |
✏️ |
| Edit a cell's source |
✏️ |
| Insert a new cell at any position |
✏️ |
| Delete a cell |
✏️ |
| Add or update cell tags and metadata |
✏️ |
| Update notebook-level metadata |
▶️ |
| Execute one cell and get its output |
▶️ |
| Execute a range of cells |
▶️ |
| Execute all cells |
▶️ |
| Execute all cells tagged with a stage name |
🔧 |
| Clear kernel state (variables, imports) |
🔧 |
| List all installed kernel environments |
🔧 |
| See which notebooks have a live kernel |
Kernel state persists across calls — variables and imports from one cell are available in the next, just like a normal Jupyter session.
Edits are checkpointed — every edit creates a timestamped backup (.checkpoint_<timestamp>.ipynb) before writing, so you can always roll back.
Troubleshooting
nb-mcp: command not found (or 'nb-mcp' is not recognized on Windows)
The install directory isn't on your PATH. Find where pip installed it:
# macOS / Linux
python3 -m site --user-scripts # or: which nb-mcp after activating your venv
# Windows (PowerShell)
python -c "import sys; print(sys.prefix + r'\Scripts')"Then either use the full path in your MCP config:
"command": "C:\\Users\\you\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\nb-mcp.exe"Or add the Scripts/bin directory to your PATH permanently.
ModuleNotFoundError when running a cell
The kernel doesn't have your packages installed. Register your environment:
pip install ipykernel
python -m ipykernel install --user --name myenv --display-name "My Env"Then restart the kernel via notebook_restart_kernel or ask your AI to switch kernels.
List available kernels:
jupyter kernelspec listWindows: path format in MCP config
Both of these work:
"C:/Users/you/notebooks" ✓ forward slashes
"C:\\Users\\you\\notebooks" ✓ escaped backslashesAvoid raw backslashes — they break JSON:
"C:\Users\you\notebooks" ✗ invalid JSONgit clone https://github.com/your-org/universal-notebook-mcp.git
cd universal-notebook-mcp
# macOS / Linux
pip3.11 install -e ".[dev]"
# Windows (PowerShell)
python -m pip install -e ".[dev]"Run the tests:
python -m pytest # all tests
python -m pytest -m "not integration" # unit tests only (no kernel needed)
python -m pytest -m integration -v # integration tests (needs ipykernel)Or use make targets on macOS/Linux:
make test # unit only
make test-all # unit + integration
make coverage # coverage report
make lint # ruff linterProject layout:
src/universal_notebook_mcp/
server.py ← MCP tool surface (17 tools, FastMCP, stdio)
notebook_adapter.py ← nbformat cell CRUD + checkpoint backups
kernel_session.py ← jupyter_client async kernel lifecycle
notebook_runner.py ← cell execution + output capture
tests/
conftest.py ← shared fixtures (mocked kernel, workspace)
fixtures/ ← simple.ipynb, pipeline.ipynb, error.ipynb
test_*.py ← 125 tests (116 unit + 9 integration)Security
All notebook paths are sandboxed to --workspace-root. Paths that escape it (e.g. ../secret.ipynb) or that aren't .ipynb files are rejected with an error.
License
MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/am-3/jupyter-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server