jupyter-mcp-server

MCP.Pizza Chef: datalayer

Jupyter MCP Server is a Model Context Protocol server that enables large language models to interact with Jupyter notebooks running in any JupyterLab environment. It exposes notebook content and metadata in a structured, real-time manner, allowing LLMs to read, analyze, and manipulate notebook cells and outputs. This facilitates advanced AI-driven workflows within data science and development environments, integrating seamlessly with MCP-compatible clients and tools.

Use This MCP server To

Enable LLMs to read and analyze Jupyter notebook content Allow AI models to modify and execute notebook cells Integrate Jupyter notebooks into AI-enhanced workflows Provide real-time notebook context to MCP clients Automate data science tasks using LLMs within JupyterLab Facilitate multi-step reasoning over notebook data Support collaborative AI-assisted notebook editing

README

Datalayer

Become a Sponsor

🪐 ✨ Jupyter MCP Server

Github Actions Status PyPI - Version smithery badge

Jupyter MCP Server is a Model Context Protocol (MCP) server implementation that provides interaction with 📓 Jupyter notebooks running in any JupyterLab (works also with your 💻 local JupyterLab).

Jupyter MCP Server

Start JupyterLab

Make sure you have the following installed. The collaboration package is needed as the modifications made on the notebook can be seen thanks to Jupyter Real Time Collaboration.

pip install jupyterlab==4.4.1 jupyter-collaboration==4.0.2 ipykernel
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt==0.12.15

Then, start JupyterLab with the following command.

jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN --ip 0.0.0.0

You can also run make jupyterlab.

Note

The --ip is set to 0.0.0.0 to allow the MCP server running in a Docker container to access your local JupyterLab.

Use with Claude Desktop

Claude Desktop can be downloaded from this page for macOS and Windows.

For Linux, we had success using this UNOFFICIAL build script based on nix

# ⚠️ UNOFFICIAL
# You can also run `make claude-linux`
NIXPKGS_ALLOW_UNFREE=1 nix run github:k3d3/claude-desktop-linux-flake \
  --impure \
  --extra-experimental-features flakes \
  --extra-experimental-features nix-command

To use this with Claude Desktop, add the following to your claude_desktop_config.json (read more on the MCP documentation website).

Important

Ensure the port of the SERVER_URLand TOKEN match those used in the jupyter lab command.

The NOTEBOOK_PATH should be relative to the directory where JupyterLab was started.

Claude Configuration on macOS and Windows

{
  "mcpServers": {
    "jupyter": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SERVER_URL",
        "-e",
        "TOKEN",
        "-e",
        "NOTEBOOK_PATH",
        "datalayer/jupyter-mcp-server:latest"
      ],
      "env": {
        "SERVER_URL": "http://host.docker.internal:8888",
        "TOKEN": "MY_TOKEN",
        "NOTEBOOK_PATH": "notebook.ipynb"
      }
    }
  }
}

Claude Configuration on Linux

CLAUDE_CONFIG=${HOME}/.config/Claude/claude_desktop_config.json
cat <<EOF > $CLAUDE_CONFIG
{
  "mcpServers": {
    "jupyter": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SERVER_URL",
        "-e",
        "TOKEN",
        "-e",
        "NOTEBOOK_PATH",
        "--network=host",
        "datalayer/jupyter-mcp-server:latest"
      ],
      "env": {
        "SERVER_URL": "http://localhost:8888",
        "TOKEN": "MY_TOKEN",
        "NOTEBOOK_PATH": "notebook.ipynb"
      }
    }
  }
}
EOF
cat $CLAUDE_CONFIG

Components

Tools

The server currently offers 2 tools:

  1. add_execute_code_cell
  • Add and execute a code cell in a Jupyter notebook.
  • Input:
    • cell_content(string): Code to be executed.
  • Returns: Cell output.
  1. add_markdown_cell
  • Add a markdown cell in a Jupyter notebook.
  • Input:
    • cell_content(string): Markdown content.
  • Returns: Success message.

Building

You can build the Docker image it from source.

make build-docker

Installing via Smithery

To install Jupyter MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @datalayer/jupyter-mcp-server --client claude

jupyter-mcp-server FAQ

How do I install the Jupyter MCP Server?
You can install it via PyPI using 'pip install jupyter-mcp-server' and configure it within your JupyterLab environment.
Can the Jupyter MCP Server work with any JupyterLab version?
It is designed to work with standard JupyterLab setups, but compatibility with very old or heavily customized versions may vary.
How does the server expose notebook data to LLMs?
It provides structured, real-time access to notebook cells, outputs, and metadata through the MCP protocol.
Is the Jupyter MCP Server secure for sensitive data?
It follows MCP principles for secure and scoped model interaction, but you should still manage access controls in your environment.
Can I use the Jupyter MCP Server with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Anthropic Claude, Google Gemini, and others.
Does the server support executing code cells via LLM commands?
Yes, it can facilitate execution and modification of notebook cells as part of AI workflows.
How do I integrate the Jupyter MCP Server with other MCP clients?
The server uses standard MCP interfaces, making integration straightforward with any MCP-compliant client or tool.
Is there active maintenance and community support?
The project is actively maintained by Datalayer, with community contributions welcomed on GitHub.