Learn how to set up and use Jupyter MCP Server for seamless JupyterLab and Claude Desktop integration
Jupyter MCP Server is a Model Context Protocol (MCP) server implementation designed to enable seamless interaction between AI applications, specifically focusing on Jupyter notebooks running in any JupyterLab environment—whether it's your local machine or remotely accessible through JupyterLab. This server enhances the utility of Jupyter notebooks by providing integration capabilities that allow external AI tools and services to interact dynamically with notebook content. By leveraging Model Context Protocol, we bridge the gap between various AI applications and data sources, creating a unified and standardized development environment.
Jupyter MCP Server offers two core tools:
add_execute_code_cell
- This tool enables adding and executing code cells within Jupyter notebooks. It accepts user-defined cell_content
, executes it in the context of the notebook, and returns the resulting cell output. This is particularly useful for automating tasks or dynamically modifying notebook content based on user input.
add_markdown_cell
- Another useful utility, this tool adds markdown cells to Jupyter notebooks. Users can provide cell_content
, which could be any text in Markdown format, and the tool will insert it into the notebook at a specified location. This feature supports rich content presentation in notebooks, making collaboration more intuitive and visually appealing.
These tools are part of larger MCP capabilities that ensure seamless data interaction between AI applications and Jupyter notebooks. By implementing these functionalities, Jupyter MCP Server becomes an invaluable asset for developers looking to integrate AI models and workflows within a familiar notebook environment.
The architecture of Jupyter MCP Server is built on the Model Context Protocol (MCP), which defines a set of standards for interaction between software tools. The protocol allows external services to connect with and modify notebook content in real-time, thereby creating a dynamic and collaborative environment.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
This diagram illustrates the flow of data and commands between an AI application (MCP client), through the MCP protocol, to the Jupyter MCP Server where notebook modifications are made. The server then interacts with other data sources or tools as needed.
To get started with Jupyter MCP Server, you need a few prerequisites installed: jupyterlab
, jupyter-collaboration
, and ipykernel
. Additionally, we recommend un安装过程,我们可以通过以下步骤实现:
确保已安装必要的Python包:
pip install jupyterlab jupyter-collaboration ipykernel
卸载并重新安装pycrdt datalayer_pycrdt
:
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt
启动JupyterLab:
jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN --ip 0.0.0.0
或者使用make
命令:
make jupyterlab
确保将--ip
设置为0.0.0.0
,以便允许Docker容器内的MCP服务器访问本地JupyterLab。
Imagine a scenario where data scientists are using Jupyter notebooks to develop machine learning models. With Jupyter MCP Server, they can easily integrate real-time data analysis tools directly into their notebooks. For example, an AI application like Claude Desktop could modify or add code cells dynamically, enabling them to experiment with different model configurations without having to manually edit the code. This enhances productivity and accelerates the development process.
In a multi-disciplinary team environment, Jupyter notebooks are often used for collaborative project reviews. Using Jupyter MCP Server, team members can remotely access and contribute to a shared notebook from anywhere in the world. The add_markdown_cell
tool allows developers to insert rich text comments or explanations, while add_execute_code_cell
enables them to run code snippets directly within the notebook. This fosters better communication and ensures that everyone is on the same page.
Jupyter MCP Server is compatible with several Model Context Protocol (MCP) clients, including Claude Desktop, Continue, and Cursor. The following sections provide detailed configuration instructions for each client:
{
"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"
}
}
}
}
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
cat $CLAUDE_CONFIG
Below is a compatibility matrix detailing which MCP clients are supported and their current status:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
For advanced users, Jupyter MCP Server provides extensive configuration options to tailor the server's behavior and security settings. You can fine-tune the environment by setting custom environment variables for SERVER_URL
, TOKEN
, and other parameters as needed.
Ensure that access to your JupyterLab is secure by using strong tokens (MY_TOKEN
in this example). Additionally, configure your Docker setup appropriately by ensuring network bindings are set correctly:
0.0.0.0
for the IP address to allow external processes to communicate with the server.Q: Can I use Jupyter MCP Server with any JupyterLab version? A: Yes, it is compatible with all versions of JupyterLab.
Q: How do I ensure data privacy and security while using this server? A: Use strong tokens and secure networks. Additionally, regularly update the MCP server to patch any known vulnerabilities.
Q: Can multiple clients connect simultaneously to a single instance of the Jupyter MCP Server? A: Yes, multiple clients can connect and interact with the same notebook context provided by the server.
Q: What tools are currently supported through this server implementation?
A: Currently supports add_execute_code_cell
for code execution and add_markdown_cell
for markdown content insertion.
Q: Can I customize the MCP protocol flow to suit my specific needs?
A: Yes, the environment variables such as SERVER_URL
, TOKEN
, and others can be customized to fit specific workflows and security requirements.
Contributions are welcome! If you wish to contribute enhancements or fixes, please follow these guidelines:
git checkout -b my-feature-branch
git commit -m "Add feature XYZ"
Jupyter MCP Server stands out as an essential tool for developers integrating AI applications into Jupyter notebooks. By streamlining collaboration and enabling dynamic interaction, it significantly enhances productivity and innovation in research and development environments. Whether you're working on real-time data analysis or collaborative project reviews, the power of model context protocol makes a substantial difference.
通过以上详细文档,我们可以看到 Jupyter MCP Server 是一个强大且灵活的工具,可以帮助开发者和数据科学家在 Jupyter 笔记本环境中轻松集成 AI 应用程序。它不仅支持实时数据分析与建模,还能促进不同角色之间的协作,提高开发效率。
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods