JupyterLab协作MCP
让AI助手完全访问你的Jupyter笔记本——实时阅读、编辑、执行和协作。
Claude Code ←—stdio—→ MCP Server ←—y-websocket—→ JupyterLab为什么?
Claude Code已经可以编辑文件,但笔记本很特别——它们有单元格、内核、输出和实时浏览器UI。此MCP服务器弥合了这一差距:
- 实时同步 --编辑内容通过y-websocket立即出现在JupyterLab中
- 39工具 --读取、编辑、执行、搜索、差异、标记、锁定、快照等
- 小区ID寻址 --插入和删除后仍能存活的稳定引用
- 多代理就绪 --单元锁定、更改跟踪和每个代理的归因
- 上下文高效 --按单元格类型过滤、跳过输出、限制图像
- 无需延期 --使用JupyterLab的内置
jupyter-collaboration
安装
使用npx(推荐)
需要 无需克隆或构建:
claude mcp add -s user jupyter -- npx jupyterlab-collab-mcp就这样 npx 自动下载并缓存包。
使用uvx(不需要Node.js)
如果你没有安装Node.js deno PyPI包捆绑了Deno——一个内置npm兼容性的JavaScript运行时:
claude mcp add -s user jupyter -- uvx deno -A npm:jupyterlab-collab-mcp来源(开发)
git clone https://github.com/ianhi/jupyterlab-collab-mcp.git
cd jupyterlab-collab-mcp
npm install && npm run build
claude mcp add -s user jupyter -- node $PWD/dist/index.js用法
- 使用启动JupyterLab
jlabx(或jupyter lab如果你已经有了jupyter-collaboration已安装) - 在克劳德代码中: _“连接到http://localhost:8888/lab?token=..."_
- 让Claude阅读、编辑或运行单元格
大多数工具也能工作 没有 通过读/写连接JupyterLab .ipynb 直接文件(此模式下没有内核操作)。
jlabx发射器
jlabx 在不修改项目依赖关系的情况下,使用所有正确的扩展(协作、LSP、vim、MyST、git)启动JupyterLab。
uv tool install jlabx
jlabx文档
完整文档:https://ianhi.github.io/jupyterlab-collab-mcp/
文档站点有详细的工具参考页面、参数表、示例和多代理协作指南。
相关项目
发展
设置
git clone https://github.com/ianhi/jupyterlab-collab-mcp.git
cd jupyterlab-collab-mcp
npm install开发工作流程
将MCP服务器指向您的本地构建,并在监视模式下运行TypeScript编译器:
claude mcp add -s user jupyter -- node $PWD/dist/index.js
npm run build # initial build
npm run watch # recompile on file changes (run in a separate terminal)每次重新编译后,运行 /mcp 在Claude Code中重新连接到更新的服务器。无需删除和重新添加MCP配置。
为什么不tsx --watch? MCP服务器是长时间运行的stdio进程。tsx --watch检测到服务器“已完成”并将其终止,从而断开连接。
构建+测试
npm run build # compile TypeScript to dist/
npm run watch # same, but recompile on changes
npm test # run unit tests (vitest)
npm run test:watch # run tests in watch mode集成测试
需要一个正在运行的JupyterLab jupyter-collaboration:
jlabx # start JupyterLab (or jupyter lab)
JUPYTER_TOKEN= npm run test:integration # run src/test.ts against it更改工具模式后
如果添加/删除工具或更改其参数,请运行 /mcp 在Claude Code中重新连接。服务器在启动时缓存工具定义,因此需要重新连接才能使架构更改生效。
许可证
BSD-3条款
