Skip to main content

Jupyter MCP Server

⚠️ API Compatibility Notice: This project is currently focused on MCP (Model Context Protocol) usage. There are no API compatibility guarantees between versions as the interface is actively evolving. Breaking changes may occur in any release.

Jupyter MCP Server allows you to use tools like Goose or Cursor to pair with you in a JupyterLab notebook where the state of your variables is preserved by the JupyterLab Kernel. This enables seamless collaboration where agents can install packages, fix errors, and hand off to you for data exploration at any time.

Architecture: Uses Jupyter's REST API for reliable agent operations while maintaining real-time user synchronization through RTC. See Architecture Documentation for detailed technical information.

Key Features

  • 4 Consolidated MCP Tools (reduced from 11):
    • query_notebook - All read-only operations (view source, check server, etc.)
    • modify_notebook_cells - All cell modifications (add, edit, delete cells)
    • execute_notebook_code - All execution operations (run cells, install packages)
    • setup_notebook - Notebook initialization and kernel connection
  • Workflow-oriented design optimized for AI agent collaboration
  • State preservation across notebook sessions
  • Automatic parameter validation with float-to-int conversion

This works with any client that supports MCP but will focus on using Goose for the examples.

Requirements

You will need UV is required to be installed.

Installation

This MCP server supports multiple transport modes and can be added to client with the command uvx mcp-jupyter.

Transport Modes

The server supports two transport protocols:

  • stdio (default) - Standard input/output communication, ideal for local IDE integrations
  • http - Streamable HTTP transport with session management, enabling serverless deployments and remote access

Use Cases for HTTP Transport

  • Serverless deployments: Host the MCP server in cloud environments (AWS Lambda, Google Cloud Functions, etc.)
  • Remote access: Connect to the server from different machines or networks
  • Web integrations: Build web-based AI assistants that connect to the MCP server
  • Stateless operations: Use --stateless-http for environments where session persistence isn't needed

To use a specific transport:

# Default stdio transport
uvx mcp-jupyter

# HTTP transport on custom port (stateful - maintains session)
uvx mcp-jupyter --transport http --port 8080

# HTTP transport in stateless mode (no session persistence)
uvx mcp-jupyter --transport http --port 8080 --stateless-http

Using HTTP Transport with Cursor

To connect Cursor to an HTTP MCP server:

  1. Start the server separately:
uvx mcp-jupyter --transport http --port 8090
  1. Configure Cursor's .cursor/mcp.json:
{
  "mcpServers": {
    "notebook-http": {
      "url": "http://localhost:8090/mcp/"  // ⚠️ Trailing slash is REQUIRED
    }
  }
}

Important: The trailing slash (/mcp/) is required for Cursor to connect properly to the HTTP endpoint.

Usage

Start Jupyter

The server expects that a server is already running on a port that is available to the client. If the environmental variable TOKEN is not set, it will default to "BLOCK". The server requires that jupyter-collaboration and ipykernel are installed.

Option 1: Using uv venv

# Create virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install Jupyter dependencies
uv pip install jupyterlab jupyter-collaboration ipykernel

# Start Jupyter
jupyter lab --port 8888 --IdentityProvider.token BLOCK --ip 0.0.0.0

Option 2: Using uv project

# Initialize project (if you don't have one)
uv init jupyter-workspace && cd jupyter-workspace

# Install Jupyter dependencies
uv add jupyterlab jupyter-collaboration ipykernel

# Start Jupyter
uv run jupyter lab --port 8888 --IdentityProvider.token BLOCK --ip 0.0.0.0

Goose Usage

Here's a demonstration of the tool in action:

MCP Jupyter Demo

You can view the Generated notebook here: View Demo Notebook

Development

Steps remain similar except you will need to clone this mcp-jupyter repository and use that for the server instead of the precompiled version.

MCP Server

  1. Clone and setup the repository:
mkdir ~/Development
cd ~/Development
git clone https://github.com/block/mcp-jupyter.git
cd mcp-jupyter

# Sync all dependencies
uv sync

Using editable mode allows you to make changes to the server and only have you need to restart Goose, etc. goose session --with-extension "uv run --directory $(pwd) mcp-jupyter"

LLM Evaluation

This project includes a comprehensive testing infrastructure for validating how well different LLMs can generate MCP tool calls from natural language prompts.

Test Architecture

The LLM testing system uses a pluggable provider architecture:

  • LLMProvider: Abstract base class that all providers implement
  • LLMResponse: Standardized response format with success metrics and metadata
  • Parameterized tests: Same test runs against all available providers

Current Providers

  • ClaudeCodeProvider: Uses the Claude Code SDK (no API key required)

Running LLM Tests

# Run LLM tool call generation tests
uv run pytest -m llm -v

# See LLM working in real-time (shows detailed progress)
uv run pytest -m llm -v -s

# Run all tests except LLM tests (default behavior)
uv run pytest -v

What the Tests Validate

Each LLM provider is tested on its ability to:

  1. Understand natural language prompts about Jupyter notebook tasks
  2. Generate correct MCP tool calls (query_notebook, setup_notebook, modify_notebook_cells)
  3. Successfully execute the calls to create notebooks with expected content
  4. Handle errors gracefully when operations fail

Adding New Providers

To add a new LLM provider:

  1. Implement the interface:
# tests/llm_providers/my_llm.py
from .base import LLMProvider, LLMResponse

class MyLLMProvider(LLMProvider):
    @property
    def name(self) -> str:
        return "my-llm"

    async def send_task(self, prompt: str, server_url: str, verbose: bool = False):
        # Implement LLM interaction
        pass

    async def get_final_response(self) -> LLMResponse:
        # Return standardized response
        pass

    async def cleanup(self):
        # Clean up resources
        pass
  1. Update configuration:
# tests/llm_providers/config.py - add to get_available_providers()
if os.getenv("MY_LLM_API_KEY"):
    from .my_llm import MyLLMProvider
    providers.append(MyLLMProvider())
  1. Test automatically: Your provider will be included in parameterized tests when its environment variables are set.

This infrastructure makes it easy to validate and compare how different LLMs perform at generating MCP tool calls for Jupyter notebook automation.

Metadata

Release files for mcp-jupyter 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-jupyter 2.0.2
File Size Uploaded Provenance
mcp_jupyter-2.0.2.tar.gz 985.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-jupyter 2.0.2
File Interpreter ABI Platform
mcp_jupyter-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.0 MB

Release files / mcp_jupyter-2.0.2.tar.gz

Download URL mcp_jupyter-2.0.2.tar.gz
Size 985.9 kB
Tags Source
SHA-256 checksum
How to use checksums
27b9c084273197cb24d8085f2aae87973132612f412656acc17ec0497b0c11a2
BLAKE2b-256 checksum
How to use checksums
dd3c7ac70014490b6f11dd6e824249e30b194276c5c710128fa70a6109f55c73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.

Transparency log

Release files / mcp_jupyter-2.0.2-py3-none-any.whl

Download URL mcp_jupyter-2.0.2-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77401017d78aaec183218ca865bdb13787889d1d520b88f5177642f6251554e9
BLAKE2b-256 checksum
How to use checksums
b34a7bdb3ad1b7c1829c0646a0c7068338fcf520d0b0389287b26bdab964f2d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.

Transparency log

Security for mcp-jupyter 2.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_jupyter-2.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page