nebula-notebook-mcp

v0.4.118
nebula-notebook-mcp Checked 9 hours ago Published 23 hours ago

MCP 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).

ParameterTypeDescription
path *stringPath to the notebook file (.ipynb, or text formats: jupytext percent .py / Quarto .qmd)
formatstringOutput format: content (full code), detailed (code + inline images, default), placeholder (code + image placeholders, recommended for Gemini)
include_outputsbooleanOverride output inclusion (default: true for detailed/placeholder, false for others)
max_charsnumberMax chars per regular output (default: 10000)
max_chars_errornumberMax chars per error output (default: 20000)
max_linesnumberMax lines per regular output (default: 100)
max_lines_errornumberMax 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).

ParameterTypeDescription
path *stringPath to the notebook file
cell_idstringStable cell ID. Use this OR cell_index.
cell_indexnumberCell 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).

ParameterTypeDescription
path *stringPath to the notebook file
cell_idstringStable cell ID. Use this OR cell_index.
cell_indexnumberCell index (0-based). Use this OR cell_id.
line_offsetnumberSkip first N lines for pagination (default: 0). Use with truncation metadata to paginate through large outputs.
max_charsnumberMax chars per regular output (default: 10000)
max_chars_errornumberMax chars per error output (default: 20000)
max_linesnumberMax lines per regular output (default: 100)
max_lines_errornumberMax lines per error output (default: 200)
max_waitnumberWait up to N seconds for completion or timeout (default: 60). Set 0 for immediate read.
output_offsetnumberSkip first N outputs (default: 0)
save_to_filebooleanSave full output to temp file for analysis (default: false).
wait_for_completionbooleanWait 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).

ParameterTypeDescription
cell_id *stringUnique ID for the new cell
content *stringCell content
path *stringPath to the notebook file
cell_typestringCell type (default: code)
positionnumberPosition 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).

ParameterTypeDescription
cell_id *stringCell ID to update
path *stringPath to the notebook file
cell_typestringNew cell type (optional)
contentstringNew cell content (optional)

delete_cell

Delete a cell from a notebook MCP: call connect_server first (see connect_server for workflow).

ParameterTypeDescription
path *stringPath to the notebook file
cell_idstringCell ID to delete
cell_indexnumberCell index to delete (0-based)

clear_notebook

Clear all cells from a notebook. MCP: call connect_server first (see connect_server for workflow).

ParameterTypeDescription
path *stringPath 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).

ParameterTypeDescription
path *stringPath for the new notebook file (.ipynb, or text formats: .py percent / .qmd — these never store outputs)
kernel_display_namestringDisplay name for kernel (default: Python 3)
kernel_namestringKernel name (default: python3)
overwritebooleanAllow 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).

ParameterTypeDescription
path *stringPath to the notebook file
after_cell_idstringMove after this cell ID. Alternative to to_index.
cell_idstringID of cell to move. Use this OR from_index.
from_indexnumberCurrent cell index (0-based). Use this OR cell_id.
to_indexnumberTarget 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).

ParameterTypeDescription
cell_index *numberCell index to duplicate (0-based)
path *stringPath 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).

ParameterTypeDescription
path *stringPath to the notebook file
query *stringSearch query (keywords)
include_outputsbooleanAlso search in cell outputs (default: false)
limitnumberMaximum 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).

ParameterTypeDescription
cell_id *stringCurrent cell ID to update
changes *objectMetadata changes: id, type, scrolled, scrolledHeight
path *stringPath 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.

ParameterTypeDescription
base_url *stringNebula 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…

ParameterTypeDescription
path *stringPath to the notebook file
agent_idstringOptional identifier for this agent session
exclusivebooleanLock the notebook read-only for the user (legacy behavior). Use only for large refactors needing atomicity. Default: false (collaborative).
forcebooleanDANGEROUS: 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_timestampnumberOptional 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).

ParameterTypeDescription
path *stringPath 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).

ParameterTypeDescription
cell_ids *arrayArray of cell IDs to delete
path *stringPath 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).

ParameterTypeDescription
cells *arrayArray of cells to insert. Each cell: {id?: string, type?: "code"|"markdown", content: string}
path *stringPath to the notebook file
positionnumberPosition 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).

ParameterTypeDescription
path *stringPath to the notebook file
cell_idsarrayOptional 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).

ParameterTypeDescription
kernel_namestringKernel 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).

ParameterTypeDescription
path *stringPath to the notebook file
cell_idstringStable cell ID. Use this OR cell_index.
cell_indexnumberCell index to execute (0-based). Use this OR cell_id.
max_charsnumberMax chars per output (default: 10000)
max_linesnumberMax lines per output (default: 100)
max_waitnumberMax seconds to wait for completion (default: 10). Use 0 for background execution.
save_outputsbooleanSave outputs back to the notebook (default: true)
session_idstringKernel 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).

ParameterTypeDescription
path *stringPath 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).

ParameterTypeDescription
content *stringContent to write to the file
path *stringPath 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).

ParameterTypeDescription
pathstringPath 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).

ParameterTypeDescription
path *stringPath 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).

ParameterTypeDescription
new_path *stringNew path for the file or directory
old_path *stringCurrent 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).

ParameterTypeDescription
local_path *stringLocal path to save the file
server_path *stringPath 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).

ParameterTypeDescription
local_path *stringLocal path of the file to upload
server_path *stringDestination path on the server
on_conflictstringIf 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).

ParameterTypeDescription
partition *stringPartition (queue) to submit to — see list_compute_queues
cpusnumberCPU cores (default 1)
gpu_typestringSpecific GPU model (only with gpus > 0)
gpusnumberNumber of GPUs (default 0)
idle_timeout_minutesnumberAuto-end the allocation after this many minutes with no kernel/terminal activity (recommended: 60) — a safety net against forgotten allocations
max_waitnumberMax seconds to wait when wait_for_active=true (default 300); returns the current state on expiry
mem_gbnumberMemory in GB (default 4)
namestringJob name (default nebula-<partition>)
qosstringQoS to submit under (some partitions require one)
wait_for_activebooleanBlock until the allocation is active or fails (default false)
walltime_minutesnumberWalltime 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).

ParameterTypeDescription
allocation_id *stringAllocation 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).

ParameterTypeDescription
allocation_id *stringAllocation id or job name (must be active)
path *stringNotebook path on the server
kernel_namestringKernel name (default python3)