🪐 Model Context Protocol (MCP) Server for Jupyter
SaferSkills independently audited Jupyter Mcp Server (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
<div align="center">
<!-- omit in toc -->
<img title="cover" src="https://raw.githubusercontent.com/ChengJiale150/jupyter-mcp-server/main/assets/cover.png" alt="Jupyter MCP Server" data-align="center" width="700">
<strong>专门为AI连接与管理Jupyter Notebook而开发的MCP服务</strong>
由 [ChengJiale150](https://github.com/ChengJiale150) 开发
English | 中文
</div>
Jupyter MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,为目前最先进的的AI IDE(如 Cursor) 与CLI工具(如Gemini CLI)提供连接与管理Jupyter Notebook的能力。使得AI能够操作Notebook,进行数据分析、可视化、机器学习等任务。
Jupyter Notebook 是数据科学家最常用的工具之一,它提供了一个交互式的环境,使其可以方便地进行数据分析、可视化、机器学习等探索性任务。然而,由于Notebook自身的格式限制,使得其难以像纯文本文件(如Markdown、Python文件)一样被AI直接理解。
现有的提供操作Notebook的工具或MCP服务,要么仅能阅读与编辑Notebook,要么仅能操纵单个Notebook,难以满足同时操纵多个Notebook的复杂需求。此外,大多数工具也不支持多模态输出,无法充分利用目前最先进的多模态大模型(如Gemini 2.5)的强大图文理解能力。
Jupyter MCP Server 就是为了解决这个问题而开发的。它通过MCP协议,向AI提供了管理Jupyter Kernel与Notebook的工具,使其能够操纵多个Notebook进行交互式的任务执行,并输出多模态结果,助力数据科学家提高分析效率。
| 名称 | 描述 | 说明 |
|---|---|---|
| connect_notebook | 连接/创建指定路径的Notebook | 因为需要启动Kernel,工具执行时间较长(10s~30s) |
| list_notebook | 列出所有目前连接的Notebook | 用于查看目前已经连接的Notebook,方便多Notebook任务执行 |
| restart_notebook | 重启指定名称的Notebook | 清除所有导入包与变量 |
| read_notebook | 读取指定名称的Notebook的源内容(不包含输出) | 用于查看Notebook的源内容,仅在明确要求时才使用 |
| 名称 | 描述 | 说明 |
|---|---|---|
| list_cell | 列出指定名称的Notebook的所有Cell的基本信息 | 用于定位Cell的索引与作用 |
| read_cell | 读取指定名称的Notebook指定索引的Cell内容 | 支持图像、表格、文本等多种输出 |
| delete_cell | 删除指定名称的Notebook指定索引的Cell | |
| insert_cell | 在指定名称的Notebook指定索引处上方/下方插入Cell | |
| execute_cell | 执行指定名称的Notebook指定索引的Cell | 返回Cell的输出结果 |
| overwrite_cell | 覆盖指定名称的Notebook指定索引的Cell内容 | 用于修改Cell内容 |
| 名称 | 描述 | 说明 |
|---|---|---|
| append_execute_code_cell | 在Notebook末尾添加并执行Code Cell | insert+execute的组合为高频操作,将其组合减少工具的调用次数 |
| execute_temporary_code | 执行临时代码块(不存储到Notebook中) | 用于进行魔法指令执行、代码片段调试、查看中间变量取值等临时操作 |
工具的具体内容详见工具文档
<details>
<summary>uvx 快速安装(推荐)</summary>
在安装uv后,直接配置MCP的JSON格式即可,示例如下:
{
"mcpServers":{
"Jupyter-MCP-Server":{
"command": "uvx",
"args": [
"better-jupyter-mcp-server"
],
"env": {
"ALLOW_IMG": "true"
},
"transport": "stdio"
}
}
}具体客户端集成详见集成文档
</details>
<details>
<summary>源代码</summary>
git clone https://github.com/ChengJiale150/jupyter-mcp-server
cd jupyter-mcp-server
uv sync进入src/config.toml文件,根据需要配置参数(如是否允许返回图片数据)
uv run fastmcp run src/main.py如果成功启动,会输出类似如下信息代表启动成功:
[09/14/25 20:14:59] INFO Starting MCP server 'Jupyter-MCP-Server' with transport 'stdio' {
"mcpServers":{
"Jupyter-MCP-Server":{
"command": "uv",
"args": [
"run",
"--directory",
"your/path/to/jupyter-mcp-server",
"src/main.py"
],
"env": {},
"transport": "stdio"
}
}
}具体客户端集成详见集成文档
</details>
<details>
<summary>本地手动启动Jupyter Server</summary>
在正式使用前,需要连接Jupyter Server,这里介绍如何在本地手动启动Jupyter Server:
打开计算机终端命令行,并激活环境
对于使用conda(Anaconda)的用户,可以使用以下命令激活环境:
conda activate your_environment_name这里为了方便起见,这里可以直接使用base环境(conda activate base)
然后切换到你当前的项目目录,方便后续的文件操作
cd your/path/to/your/projectpip uninstall -y pycrdt datalayer_pycrdt
pip install jupyter nbformat datalayer_pycrdt jupyter-collaboration使用下述命令启动Jupyter Server
jupyter lab成功启动后会弹出浏览器窗口,你可以在此查看根路径是否为工程目录
使用下述命令获取认证Token
jupyter server list运行后会输出类似如下信息:
http://localhost:8888/?token=YOUR_TOKEN :: YOUR_PROJECT_PATH其中YOUR_TOKEN为认证Token
在正式使用前,你必须添加如下提示词于规则文件中以提供Jupyter MCP Server的必要连接信息:
以下是Jupyter服务器连接参数:
URL = http://localhost:8888
Token = YOUR_TOKEN此外,推荐在提示词中添加关键Notebook路径信息,方便AI快速定位目标Notebook提高connect_notebook工具的执行效率,可以在Jupyter Lab网页中右键点击目标Notebook文件,选择Copy Path获取相对路径
在提供上述内容后,你就可以开始使用Jupyter MCP Server了!
</details>
<details>
<summary>使用LLM托管Jupyter Server</summary>
pip uninstall -y pycrdt datalayer_pycrdt
pip install jupyter nbformat datalayer_pycrdt jupyter-collaboration## Jupyter MCP Server 使用指南
在正式使用Jupyter MCP Server前,你**必须**完成如下步骤:
1. **启动Jupyter Server**:
在当前项目目录中以不阻塞当前终端的方式在命令行终端中输入启动Jupyter Server,例如:
- `Window`: `start jupyter lab`
- `MacOS/Linux`: `nohup jupyter lab &`
2. **获取URL与认证Token**:
使用`jupyter server list`获取URL与认证Token
仅当完成上述步骤后,你才可以使用Jupyter MCP Server</details>
我们欢迎社区贡献!如果您想为Jupyter MCP Server项目做出贡献,请:
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目受到以下项目的帮助,在此表示感谢:
此外,本项目还参考了以下已有Jupyter MCP服务的实现,在此也一并表示感谢:
<div align="center">
如果这个项目对您有帮助,请给我们一个 ⭐️
Made with ❤️ by ChengJiale150
</div>
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.