nebula-notebook-mcp
v0.4.118MCP server for Nebula Notebook — lets agents (Claude Code, Codex, etc.) read, edit, and execute notebooks on a running Nebula server
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
read_notebook
Read all cells from a notebook. Formats: "content" (full code, no outputs), "detailed" (full code + inline images, default), "placeholder" (full code + text placeholders for images, recommended for Gemini). Outputs are truncated (100 lines regular, 200 lines errors). MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file (.ipynb, or text formats: jupytext percent .py / Quarto .qmd) |
format | string | Output format: content (full code), detailed (code + inline images, default), placeholder (code + image placeholders, recommended for Gemini) |
include_outputs | boolean | Override output inclusion (default: true for detailed/placeholder, false for others) |
max_chars | number | Max chars per regular output (default: 10000) |
max_chars_error | number | Max chars per error output (default: 20000) |
max_lines | number | Max lines per regular output (default: 100) |
max_lines_error | number | Max lines per error output (default: 200) |
read_cell
Read a specific cell content and metadata (not outputs). Use read_output to get outputs. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
cell_id | string | Stable cell ID. Use this OR cell_index. |
cell_index | number | Cell index (0-based). Use this OR cell_id. |
read_output
Read cell outputs. By default waits for completion or max_wait timeout (returns once). Set wait_for_completion=false to return as soon as new output appears. Regular outputs truncated to 100 lines, errors get 200 lines. Use save_to_file=true for complete output. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
cell_id | string | Stable cell ID. Use this OR cell_index. |
cell_index | number | Cell index (0-based). Use this OR cell_id. |
line_offset | number | Skip first N lines for pagination (default: 0). Use with truncation metadata to paginate through large outputs. |
max_chars | number | Max chars per regular output (default: 10000) |
max_chars_error | number | Max chars per error output (default: 20000) |
max_lines | number | Max lines per regular output (default: 100) |
max_lines_error | number | Max lines per error output (default: 200) |
max_wait | number | Wait up to N seconds for completion or timeout (default: 60). Set 0 for immediate read. |
output_offset | number | Skip first N outputs (default: 0) |
save_to_file | boolean | Save full output to temp file for analysis (default: false). |
wait_for_completion | boolean | Wait for completion or timeout (default: true). If false, return on new output. |
insert_cell
Insert a new cell into the notebook. Use position=-1 or omit to append at end. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cell_id * | string | Unique ID for the new cell |
content * | string | Cell content |
path * | string | Path to the notebook file |
cell_type | string | Cell type (default: code) |
position | number | Position to insert at (0-based). Use -1 or omit to append. |
update_cell
Update an existing cell by its stable ID. Can update content and/or type. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cell_id * | string | Cell ID to update |
path * | string | Path to the notebook file |
cell_type | string | New cell type (optional) |
content | string | New cell content (optional) |
delete_cell
Delete a cell from a notebook MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
cell_id | string | Cell ID to delete |
cell_index | number | Cell index to delete (0-based) |
clear_notebook
Clear all cells from a notebook. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
create_notebook
Create a new empty notebook. If the notebook is open in the browser UI, it will attempt to open the new notebook in a new tab. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path for the new notebook file (.ipynb, or text formats: .py percent / .qmd — these never store outputs) |
kernel_display_name | string | Display name for kernel (default: Python 3) |
kernel_name | string | Kernel name (default: python3) |
overwrite | boolean | Allow overwriting existing file (default: false) |
move_cell
Move a cell from one position to another. Supports two modes: by index (from_index, to_index) or by ID (cell_id with after_cell_id or to_index=-1 for start). MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
after_cell_id | string | Move after this cell ID. Alternative to to_index. |
cell_id | string | ID of cell to move. Use this OR from_index. |
from_index | number | Current cell index (0-based). Use this OR cell_id. |
to_index | number | Target cell index (0-based). Use -1 to move to start. |
duplicate_cell
Duplicate a cell, inserting the copy immediately after the original MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cell_index * | number | Cell index to duplicate (0-based) |
path * | string | Path to the notebook file |
search_cells
Search notebook cells by keyword. Can search in cell source code and optionally in outputs. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
query * | string | Search query (keywords) |
include_outputs | boolean | Also search in cell outputs (default: false) |
limit | number | Maximum results (default: 10) |
update_metadata
Update cell metadata (id, type, scrolled, scrolledHeight). Validates against schema. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cell_id * | string | Current cell ID to update |
changes * | object | Metadata changes: id, type, scrolled, scrolledHeight |
path * | string | Path to the notebook file |
connect_server
Connect to a Nebula server. REQUIRED: call this once at the start of every MCP session before any other tool call. base_url is required; the server does not assume a default. All subsequent operations will use this connection. RECOMMENDED WORKFLOW: 1. connect_server (required at session start) 2. For each response: start_agent_session → operations → end_agent_session start_agent_session is required for notebook mutations; read-only operations do not require it.
| Parameter | Type | Description |
|---|---|---|
base_url * | string | Nebula server URL (e.g., http://localhost:3000). |
start_agent_session
Start an agent session for notebook write operations. Always call end_agent_session when done. Sessions are COLLABORATIVE by default: the user can keep editing while you work. Your destructive writes (update_cell, delete_cell, …) are protected by per-cell optimistic concurrency — if the user changed a cell after you last read it, the write is rejected with the current content so you can re-apply your intent. Address cells by id (indices shift when the user edits), and re-read cells you haven't read recently. Pass exclusive=true only for large multi-cell refactors that need atomicity: it…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
agent_id | string | Optional identifier for this agent session |
exclusive | boolean | Lock the notebook read-only for the user (legacy behavior). Use only for large refactors needing atomicity. Default: false (collaborative). |
force | boolean | DANGEROUS: Force steal the lock even if another session is active. Use ONLY with explicit user permission to avoid disrupting another agent. Default: false |
last_session_timestamp | number | Optional timestamp (ms since epoch) to fetch updates since last agent session |
end_agent_session
End an agent session, unlocking the notebook for user edits. Always call this at the END of each response after completing all notebook operations. IMPORTANT: Always call this before finishing your response, even if operations failed. This ensures the notebook is unlocked for the user. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
delete_cells
Delete multiple cells by ID in a single operation. More efficient than multiple single deletes. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cell_ids * | array | Array of cell IDs to delete |
path * | string | Path to the notebook file |
insert_cells
Insert multiple cells at a position in a single operation. More efficient than multiple single inserts. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
cells * | array | Array of cells to insert. Each cell: {id?: string, type?: "code"|"markdown", content: string} |
path * | string | Path to the notebook file |
position | number | Position to insert at (0-based). Use -1 or omit to append at end. |
clear_outputs
Clear outputs from cells without re-executing. If no cell_ids provided, clears all cell outputs. Useful for cleanup before sharing notebooks. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
cell_ids | array | Optional array of cell IDs to clear. If omitted, clears all cells. |
list_kernels
List available kernel specifications with display names (includes version info) MCP: call connect_server first (see connect_server for workflow).
kernel_start
Start a new kernel session for the active notebook (requires start_agent_session) MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
kernel_name | string | Kernel name (e.g., python3, ir). Default: resolved from the notebook's kernelspec metadata. |
kernel_stop
Stop and shutdown the active notebook kernel (requires start_agent_session) MCP: call connect_server first (see connect_server for workflow).
kernel_restart
Restart the active notebook kernel (clears all variables, requires start_agent_session) MCP: call connect_server first (see connect_server for workflow).
kernel_interrupt
Interrupt execution in the active notebook kernel (requires start_agent_session) MCP: call connect_server first (see connect_server for workflow).
execute_cell
Execute a notebook cell and return its output. Outputs are truncated by default (100 lines, 10000 chars). Outputs are saved incrementally during execution. Requires an active kernel session. For long-running cells: If execution exceeds max_wait, returns with status="busy" and partial output. Use read_output with max_wait to poll for more output. Set max_wait=0 for immediate "background" execution (returns right away, poll with read_output). MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the notebook file |
cell_id | string | Stable cell ID. Use this OR cell_index. |
cell_index | number | Cell index to execute (0-based). Use this OR cell_id. |
max_chars | number | Max chars per output (default: 10000) |
max_lines | number | Max lines per output (default: 100) |
max_wait | number | Max seconds to wait for completion (default: 10). Use 0 for background execution. |
save_outputs | boolean | Save outputs back to the notebook (default: true) |
session_id | string | Kernel session ID. If not provided, will try to get/create one. |
read_file
Read the contents of a text file from the server. Returns file content as string. For .ipynb notebooks, returns JSON string; .py/.qmd notebooks are plain text. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the file on the server |
write_file
Write content to a file on the server. Creates the file and parent directories if they do not exist. Overwrites existing file. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
content * | string | Content to write to the file |
path * | string | Path to the file on the server |
list_directory
List contents of a directory on the server. Returns file and directory names with types. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path | string | Path to the directory (defaults to home directory) |
delete_file
Delete a file or directory from the server. Directories are deleted recursively. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the file or directory to delete |
rename_file
Rename or move a file or directory on the server. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
new_path * | string | New path for the file or directory |
old_path * | string | Current path of the file or directory |
download_file
Download a file from the server to a local path. Supports both text and binary files. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
local_path * | string | Local path to save the file |
server_path * | string | Path to the file on the server |
upload_file
Upload a local file to the server. Supports both text and binary files. Fails if the destination file already exists unless on_conflict says otherwise. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
local_path * | string | Local path of the file to upload |
server_path * | string | Destination path on the server |
on_conflict | string | If the file already exists: 'fail' (default) refuses, 'overwrite' replaces it, 'rename' keeps both (server stores name_1.ext — check the reported path) |
compute_status
Check whether scheduler-backed cluster compute (allocations) is available on this Nebula server. Returns enabled + scheduler name. Call this before any other compute tool — the feature is absent on servers without a scheduler (e.g. laptops). MCP: call connect_server first (see connect_server for workflow).
list_compute_queues
List cluster partitions and QoS with live load: idle/total CPUs, idle GPUs by type, queue backlog (pending/running jobs), and which partitions/QoS the user may submit to. Use it to pick a partition before request_allocation. MCP: call connect_server first (see connect_server for workflow).
request_allocation
Request a compute allocation from the cluster scheduler. Allocations consume REAL cluster resources — only request one when the user's task actually needs it, request modest sizes, and cancel_allocation when done. Set wait_for_active=true to block until the allocation is usable (state=active), then bind a notebook with use_allocation. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
partition * | string | Partition (queue) to submit to — see list_compute_queues |
cpus | number | CPU cores (default 1) |
gpu_type | string | Specific GPU model (only with gpus > 0) |
gpus | number | Number of GPUs (default 0) |
idle_timeout_minutes | number | Auto-end the allocation after this many minutes with no kernel/terminal activity (recommended: 60) — a safety net against forgotten allocations |
max_wait | number | Max seconds to wait when wait_for_active=true (default 300); returns the current state on expiry |
mem_gb | number | Memory in GB (default 4) |
name | string | Job name (default nebula-<partition>) |
qos | string | QoS to submit under (some partitions require one) |
wait_for_active | boolean | Block until the allocation is active or fails (default false) |
walltime_minutes | number | Walltime in minutes (default 120) |
list_allocations
List compute allocations on the server with state (pending/running/active/ended/failed/cancelled), resources, and the serverId/node once active. MCP: call connect_server first (see connect_server for workflow).
cancel_allocation
Cancel a compute allocation and free its cluster nodes. Cancel allocations you created once the task completes; never cancel allocations you did not create. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
allocation_id * | string | Allocation id (from request_allocation / list_allocations) |
use_allocation
Bind a notebook's kernels to an active compute allocation: starts (or reuses) the notebook's kernel on the allocation's server and saves it as the notebook's kernel preference. After this, execute_cell on that notebook runs on the allocation. Requires the allocation to be state=active. MCP: call connect_server first (see connect_server for workflow).
| Parameter | Type | Description |
|---|---|---|
allocation_id * | string | Allocation id or job name (must be active) |
path * | string | Notebook path on the server |
kernel_name | string | Kernel name (default python3) |