STDIO Transport
1. Start JupyterLab
Environment setup
Make sure you have the following packages installed in your environment. 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.17
JupyterLab start
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
if you cloned the repository.
The --ip
is set to 0.0.0.0
to allow the MCP Server running in a Docker container to access your local JupyterLab.
2. Setup Jupyter MCP Server
Use the following configuration file to set up the Jupyter MCP Server for your preferred MCP client. Note that the configuration is dependent on the operating system you are using.
-
Ensure the
port
of theDOCUMENT_URL
andRUNTIME_URL
match those used in thejupyter lab
command. -
The
DOCUMENT_ID
which is the path to the notebook you want to connect to, should be relative to the directory where JupyterLab was started. -
In a basic setup,
DOCUMENT_URL
andRUNTIME_URL
are the same.DOCUMENT_TOKEN
, andRUNTIME_TOKEN
are also the same and are actually the Jupyter Token. -
More environment variables can be set, refer to the server configuration for more details. If not specified, the server will use the default values.
For MacOS and Windows
{
"mcpServers": {
"jupyter": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"DOCUMENT_URL",
"-e",
"DOCUMENT_TOKEN",
"-e",
"DOCUMENT_ID",
"-e",
"RUNTIME_URL",
"-e",
"RUNTIME_TOKEN",
"datalayer/jupyter-mcp-server:latest"
],
"env": {
"DOCUMENT_URL": "http://host.docker.internal:8888",
"DOCUMENT_TOKEN": "MY_TOKEN",
"DOCUMENT_ID": "notebook.ipynb",
"RUNTIME_URL": "http://host.docker.internal:8888",
"RUNTIME_TOKEN": "MY_TOKEN"
}
}
}
}
For Linux
{
"mcpServers": {
"jupyter": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"DOCUMENT_URL",
"-e",
"DOCUMENT_TOKEN",
"-e",
"DOCUMENT_ID",
"-e",
"RUNTIME_URL",
"-e",
"RUNTIME_TOKEN",
"--network=host",
"datalayer/jupyter-mcp-server:latest"
],
"env": {
"DOCUMENT_URL": "http://localhost:8888",
"DOCUMENT_TOKEN": "MY_TOKEN",
"DOCUMENT_ID": "notebook.ipynb",
"RUNTIME_URL": "http://localhost:8888",
"RUNTIME_TOKEN": "MY_TOKEN"
}
}
}
}