notebook-edit
Provides tools for editing Jupyter notebooks, including listing cells, reading cell contents with outputs, inserting cells, editing cell source, patching cells with partial replacement, deleting cells, and moving cells.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@notebook-editread cell 2 in my_notebook.ipynb"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
notebook-edit
Jupyter notebook (.ipynb) の構造編集に特化した MCP サーバー兼 CLI。
カーネル実行は行わない(実行は Copilot / Azure Codex 側の既存機能に任せる)。
コアロジック (core.py) を CLI (cli.py) と MCP サーバー (mcp_server.py) が
薄くラップする構成。ロジックは一箇所だけ。
notebook_edit/
├── core.py # nbformat 操作の実体
├── cli.py # argparse ラッパー
└── mcp_server.py # FastMCP (stdio) ラッパー安全性
書き込み前に
nbformat.validate()を通す(不正なら書かない)一時ファイル →
os.replaceによる atomic write書き込み前に
.ipynb.bakを1世代だけ残すoutputs(実行結果)は読み取り専用。コードセルの source を変更すると、 古い outputs と execution_count はクリアされる(stale な実行結果の混入を防止)
Related MCP server: MCP Jupyter Complete
セットアップ
uv syncCLI
uv run nb-edit list-cells foo.ipynb
uv run nb-edit read-cell foo.ipynb 2
uv run nb-edit insert-cell foo.ipynb 1 code "print('hi')" # index の前に挿入
uv run nb-edit edit-cell foo.ipynb 2 "x = 42" # 全文置換
uv run nb-edit patch-cell foo.ipynb 2 "x = 42" "x = 99" # 部分置換(推奨)
uv run nb-edit delete-cell foo.ipynb 2
uv run nb-edit move-cell foo.ipynb 0 3インデックスは 0 始まり。負値は不可。
結果は JSON で stdout に出力。エラーは stderr + 終了コード 1。
MCP サーバー (GitHub Copilot / VS Code)
.vscode/mcp.json:
{
"servers": {
"notebook-edit": {
"command": "uvx",
"args": ["--from", "/path/to/lw-nbedit-mcp", "nb-edit-mcp"]
}
}
}社内 Git 配布時は --from を Git URL に差し替える:
"args": ["--from", "git+https://<your-git>/lw-nbedit-mcp", "nb-edit-mcp"]パスはサーバーの CWD(VS Code ワークスペース)基準で解決される。
公開ツール
ツール | 引数 | 説明 |
|
| 全セルの概要(プレビュー付き) |
|
| セルの全文(コードセルは outputs も) |
|
| index の前に挿入 |
|
| 全文置換 |
|
| 一意な部分文字列を置換(推奨) |
|
| 削除 |
|
| 移動 |
cell_type は code / markdown / raw。
patch_cell の old はセル内でちょうど1回一致する必要がある
(0回・複数回はエラー → 文脈を足して一意にする)。
テスト
uv run pytest -qMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tmlksu/nbedit-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server