Skip to main content

Streamable HTTP 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.

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.

2. Setup Jupyter MCP Server

Jupyter MCP Server also supports streamable HTTP transport, which allows you to connect to the Jupyter MCP Server using a URL. To start the server, you can either use python or docker. The server will listen on port 4040, you can access it via http://localhost:4040.

1. Run the Jupyter MCP Server

Run with Python

Clone the repository and use pip install -e . or just install the jupyter-mcp-server package from PyPI with pip install jupyter-mcp-server.

Then, you can start JupyterLab and Jupyter MCP Server with the following commands.

make jupyterlab
make start-streamable-http
Run with Docker

You can also run the Jupyter MCP Server using Docker. Use the following command to start the server on MacOS.

docker run \
-e DOCUMENT_URL="http://localhost:8888" \
-p 4040:4040 \
datalayer/jupyter-mcp-server:latest \
--transport streamable-http
note

You can set the DOCUMENT_URL (JupyterLab Server URL), RUNTIME_TOKEN, and DOCUMENT_ID environment variables to configure the server with the -e option in the docker run command. If not set, the defaults will be used. Refer to the server configuration for more details on the available environment variables and their defaults.

Use the following command to start the server on Linux.

docker run \
--network=host \
-e DOCUMENT_URL="http://localhost:8888" \
-p 4040:4040 \
datalayer/jupyter-mcp-server:latest \
--transport streamable-http

2. Configure your MCP Client

Use the following configuration for you MCP client to connect to a running Jupyter MCP Server.

{
"mcpServers": {
"jupyter": {
"command": "npx",
"args": ["mcp-remote", "http://127.0.0.1:4040/mcp"]
}
}
}