Multi-User Deployments
Jupyter MCP Server can be deployed in multi-user environments where multiple people access Jupyter notebooks concurrently. This guide explains the architecture patterns, deployment options, and best practices for multi-user scenarios.
Understanding Multi-User Challengesβ
The Concurrency Problemβ
As described in issue #181, when multiple users share a single MCP server instance connected to a shared JupyterLab, they can interfere with each other's work:
Example Scenario:
- User 1's agent activates
user1notebook.ipynb - Simultaneously, User 2's agent activates
user2notebook.ipynb - User 1's agent writes code to the currently active notebook (now
user2notebook.ipynb) - Result: User 1's code appears in User 2's notebook
This happens because:
- MCP server maintains a single "active notebook" state
- Multiple agents share the same MCP server instance
- Notebook operations are context-dependent (operating on "current" notebook)
Deployment Architecturesβ
There are three primary architecture patterns for multi-user deployments:
1. One MCP Server Per User (Recommended)β
Best for: Most multi-user scenarios, especially with JupyterHub
Each user gets their own isolated MCP server instance, preventing any cross-user interference.
βββββββββββββββββββββββββββββββββββββββββββββββ
β JupyterHub / Multi-User β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β User 1 β
β βββββββ ββββββββ βββββββββββββββββββ β
β β MCP Client βββββββΆβ MCP Server β β
β β (Agent) β β (Extension) β β
β βββββββββββββββ β β β β
β β JupyterLab β β
β β Single-User β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β User 2 β
β βββββββββββββββ βββββββββββββββββββ β
β β MCP Client βββββββΆβ MCP Server β β
β β (Agent) β β (Extension) β β
β βββββββββββββββ β β β β
β β JupyterLab β β
β β Single-User β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ
Advantages:
- β Complete isolation between users
- β No state conflicts
- β Scales naturally with JupyterHub
- β Leverages existing JupyterHub authentication
Implementation: See JupyterHub Deployment
2. Stateless Tool Operationsβ
Best for: Shared environments where one-MCP-per-user is not feasible
Make all notebook operations explicitly reference the target notebook by path.
Current Status:
Currently, some MCP tools maintain "active notebook" state. Work is ongoing to make operations fully stateless by requiring explicit notebook paths in all tool calls.
Track progress: Issue #181
Future API (Planned):
{
"tool": "execute_cell",
"arguments": {
"notebook": "user1/analysis.ipynb",
"cell_index": 0
}
}
3. Session-Based Isolationβ
Best for: Advanced scenarios with custom session management
Use unique session identifiers to isolate user contexts within a shared MCP server.
This approach is not yet implemented in Jupyter MCP Server. Follow development discussions in issue #181.
JupyterHub Deploymentβ
JupyterHub is the recommended platform for multi-user Jupyter deployments with MCP.
Architectureβ
JupyterHub naturally provides user isolation:
- Each user gets a dedicated single-user Jupyter server
- MCP server runs as an extension inside each single-user server
- No shared state between users
Setup Stepsβ
1. Install in Single-User Environmentβ
Configure your JupyterHub spawner to install the required packages:
# jupyterhub_config.py
c.Spawner.environment = {
'JUPYTERHUB_ALLOW_TOKEN_IN_URL': '1'
}
# Install packages in the single-user image or environment
# Example for DockerSpawner:
c.DockerSpawner.image = 'your-custom-image:latest'
Single-User Environment Requirements:
# Dockerfile for single-user image
FROM jupyter/minimal-notebook:latest
RUN pip install "jupyter-mcp-server>=0.15.0" \
"jupyterlab==4.4.1" \
"jupyter-collaboration==4.0.2" \
"ipykernel"
RUN pip uninstall -y pycrdt datalayer_pycrdt && \
pip install datalayer_pycrdt==0.12.17
2. Configure MCP Extensionβ
The MCP server extension loads automatically when the single-user server starts.
Verify Installation:
# Inside single-user server
jupyter server extension list
# Should show: jupyter_mcp_server enabled
3. User Access Configurationβ
Each user needs:
- A JupyterHub account
- An API token with
access:serversscope - MCP client configuration pointing to their unique URL
Per-User MCP Client Configuration:
{
"mcpServers": {
"jupyter": {
"command": "npx",
"args": ["mcp-remote", "https://hub.example.com/user/alice/mcp"],
"env": {
"JUPYTERHUB_API_TOKEN": "alice-api-token"
}
}
}
}