MCP Catalogs
首页

python-notebook-mcp

by UsamaK98·45·综合分 42

一个Python MCP服务器,让AI助手能够创建、编辑和查看Jupyter笔记本。

developer-toolsai-llmproductivity
15
Forks
2
活跃 Issue
11 个月前
最近提交
2 天前
收录于

概述

Python Notebook MCP是一个轻量级服务器,通过模型上下文协议(MCP)使Cursor和Claude Desktop等AI助手能够与Jupyter笔记本交互。它允许初始化工作区,然后对笔记本文件执行各种操作,包括创建、读取、编辑单元格以及访问单元格输出。该服务器文档完善,为不同操作系统提供了清晰的设置说明和多种安装方法。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:AI辅助Jupyter笔记本中的数据分析
:为重复性任务自动创建笔记本
:教育笔记本中的内容生成和编辑
:连接到服务器后,我需要做的第一步是什么?
:我可以对笔记本文件使用相对路径吗?

什么时候选它

当需要在 AI 环境中处理 Jupyter 笔记本,且需要对笔记本文件进行编程访问但不需要完整执行功能时,选择此服务器。

什么时候不要选它

如果您需要在笔记本内执行实际代码或使用非 Jupyter 笔记本格式,请不要选择此服务器。

此 server 暴露的工具

从 README 抽取出 9 个工具
  • initialize_workspaceinitialize_workspace(directory: str)

    Sets the absolute path for the workspace directory.

  • list_notebookslist_notebooks()

    Lists all .ipynb files found within the workspace directory.

  • create_notebookcreate_notebook(filepath: str, title: str)

    Creates a new, empty Jupyter notebook if it doesn't exist.

  • read_notebookread_notebook(filepath: str)

    Reads the entire structure and content of a notebook.

  • read_cellread_cell(filepath: str, cell_index: int)

    Reads the content and metadata of a specific cell by index.

  • edit_celledit_cell(filepath: str, cell_index: int, content: str)

    Modifies the source content of an existing cell by index.

  • add_celladd_cell(filepath: str, content: str, cell_type: str, index: int = null)

    Adds a new code or markdown cell at a specific index or at the end.

  • read_notebook_outputsread_notebook_outputs(filepath: str)

    Reads all outputs from all code cells in a notebook.

  • read_cell_outputread_cell_output(filepath: str, cell_index: int)

    Reads the output(s) of a specific code cell by index.

可对比工具

jupyterlab-mcpnotebooklm-mcpfile-system

安装

安装

  1. 克隆仓库:
git clone https://github.com/UsamaK98/python-notebook-mcp.git
cd python-notebook-mcp
  1. 创建并激活虚拟环境:
uv venv
source .venv/bin/activate  # 或Windows上的 .venv\Scripts\activate.bat
  1. 安装依赖:
uv pip install -r requirements.txt

Claude Desktop配置

添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "jupyter": {
      "command": "/full/path/to/.venv/bin/python",
      "args": ["/full/path/to/server.py"]
    }
  }
}

使用fastmcp替代方法

fastmcp install server.py --name "Jupyter Notebook MCP"

FAQ

连接到服务器后,我需要做的第一步是什么?
您必须使用initialize_workspace工具初始化工作区,并提供包含笔记本的项目目录的绝对路径。
我可以对笔记本文件使用相对路径吗?
不可以,服务器要求所有笔记本操作都使用绝对路径。不接受'.'这样的相对路径。

python-notebook-mcp 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。