API Reference

kernel

Python kernel server.

Runs as a standalone Unix socket server. Must be started explicitly before Claude Code can use it. Persists across Claude Code sessions.

Usage:

python kernel.py <name> # start a named kernel python kernel.py # start with default name “default”

Socket path: /tmp/python-kernel-<name>.sock

kernel.handle(conn, name)[source]
kernel.kernel_exec(code: str) → None[source]
kernel.run_script(code: str)[source]
kernel.serve(name: str)[source]
kernel.socket_path(name: str) → str[source]

main

MCP server exposing a Python kernel to Claude Code. The kernel must be started separately with: python kernel.py <name>

main.connect_kernel(name: str) → tuple[str, bool][source]
main.error(id, code, message)[source]
main.handle(req)[source]
main.kernel_call(name: str, cmd: str, code: str = '') → tuple[str, bool][source]
main.kernel_vars_text(name: str) → str[source]
main.list_kernels() → tuple[str, bool][source]
main.main()[source]
main.respond(id, result)[source]
main.socket_path(name: str) → str[source]
main.spawn_kernel(name: str, python: str) → tuple[str, bool][source]

tui

TUI for inspecting running Python kernels.

python tui.py

Navigation:

j/k or arrow keys move selection enter select / drill in q / esc go back / quit r refresh

tui.draw_hint_bar(win, text: str)[source]
tui.draw_list(win, items: list[str], sel: int, title: str)[source]
tui.draw_vars(win, name: str, variables: dict[str, str] | str, sel: int)[source]
tui.fill_bg(win)[source]
tui.init_colors()[source]
tui.kernel_vars(name: str) → dict[str, str] | str[source]
tui.list_kernels() → list[str][source]
tui.main()[source]
tui.run(stdscr)[source]
tui.socket_path(name: str) → str[source]