Jupyter Notebook MCP server

Integrates Jupyter notebooks with MCP to enable code execution, content manipulation, and interactive data exploration within notebook environments.
Back to servers
Setup instructions
Provider
Datalayer
Release date
Feb 14, 2025
Language
Python
Package
Stats
439 stars

Jupyter MCP Server provides a Model Context Protocol (MCP) implementation that enables real-time interaction with Jupyter notebooks running in JupyterLab or Notebook 7+. It allows AI assistants and other MCP clients to directly interact with your notebooks, whether they're running on remote servers or on your local machine.

Installation and Setup

Prerequisites

Before installing Jupyter MCP Server, ensure you have the required dependencies:

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

Starting JupyterLab

Launch JupyterLab with the following command:

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

Replace MY_TOKEN with your preferred authentication token.

Configuring MCP Clients

MacOS and Windows Configuration

Configure your MCP client (like Claude Desktop, Cursor, etc.) with these settings:

{
  "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"
      }
    }
  }
}

Linux Configuration

For Linux systems, use this configuration:

{
  "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"
      }
    }
  }
}

Make sure to adjust SERVER_URL, TOKEN, and NOTEBOOK_PATH according to your setup.

Key Features

  • Real-time control: View notebook changes as they happen
  • Smart execution: Automatically adjusts when cell execution fails
  • MCP-Compatible: Works with any MCP client including Claude Desktop, Cursor, Windsurf, and more

Available Tools

Jupyter MCP Server offers several tools for interacting with notebooks:

  • insert_execute_code_cell: Insert and execute code cells
  • append_markdown_cell: Add markdown content to notebooks
  • get_notebook_info: Retrieve notebook metadata
  • read_cell: Extract content from specific cells

For a complete list of available tools, visit the documentation.

Advanced Configuration

For more detailed setup instructions, including using the Streamable HTTP transport and advanced configuration options, refer to the Setup Guide.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "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"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "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"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "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"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later