The Jupyter MCP Server enables AI assistants to interact with Jupyter notebooks through the Model Context Protocol (MCP). It allows tools like Claude to read from and make changes to notebooks running in any JupyterLab environment, including your local installation.
Before using the MCP server, you need to ensure JupyterLab is properly configured:
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
Start JupyterLab with:
jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN --ip 0.0.0.0
The --ip 0.0.0.0
parameter is crucial as it allows the Docker-based MCP server to access your local JupyterLab instance.
NIXPKGS_ALLOW_UNFREE=1 nix run github:k3d3/claude-desktop-linux-flake \
--impure \
--extra-experimental-features flakes \
--extra-experimental-features nix-command
Create or modify your claude_desktop_config.json
with:
{
"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"
}
}
}
}
Use this command to create the configuration file:
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
When setting up your configuration:
SERVER_URL
and TOKEN
match your JupyterLab settingsNOTEBOOK_PATH
to be relative to the directory where JupyterLab was startedThe MCP server provides two primary tools that AI assistants can use:
This tool adds and executes a code cell in the Jupyter notebook.
Input parameters:
cell_content
(string): The code to be executedReturns: The output from cell execution
This tool adds a markdown cell to the Jupyter notebook.
Input parameters:
cell_content
(string): The markdown contentReturns: A success message
If you prefer to build the Docker image yourself:
make build-docker
For automatic installation with Smithery:
npx -y @smithery/cli install @datalayer/jupyter-mcp-server --client claude
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.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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.
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.