Interactive notebook server for learning computer science
Project description
grokbook
Interactive notebook server for learning computer science. Works like Jupyter — code cells, markdown, persistent IPython kernels — with a built-in MCP server so AI tutors can create and manage notebooks for you.
Hey, can you create a new project in Grokbook about LLMs and transformer architecture, and a first notebook to teach me about the attention mechanism in PyTorch? Go step by step, introduce the different components of attention, and use both markdown and code to give me a comprehensive intro.
Install
Requires Python 3.14+ and uv. uv will auto-install Python 3.14 if you don't have it.
Run instantly (recommended)
uvx grokbook
That's it. Opens the notebook UI on localhost:8080 and the MCP server on port 8081. A welcome notebook is created on first run.
If you cd into a project directory with a .venv first, grokbook auto-picks that .venv as the kernel so your project's libraries are available. Otherwise, you pick a kernel from the kernel: dropdown in the header (or paste any Python path).
Install permanently
uv tool install grokbook
grokbook # now on your PATH
From source (dev)
git clone https://github.com/marco-jeffrey/grokbook.git
cd grokbook
uv sync
uv run grokbook
Usage
uvx grokbook # or just `grokbook` after uv tool install
Flags:
uvx grokbook --port 3000 # different port
uvx grokbook --python /path/to/python # explicit kernel interpreter
uvx grokbook --allow-code-execution # enable execute tools for MCP
Kernel auto-detection
Grokbook picks a Python interpreter on startup in this order:
--pythonCLI flag (explicit override)$VIRTUAL_ENV(if an env is active in your shell)./.venv/bin/pythonor./venv/bin/pythonin the current directory- First
uv-managed Python found viauv python list - Fallback to the Python grokbook is running under
If the chosen interpreter is missing ipykernel, grokbook installs it automatically via uv pip install --python <env> ipykernel.
You can also switch kernels per-notebook from the UI: click the kernel: dropdown in the header → pick any discovered env, or paste a custom path at the bottom. Custom paths persist in ~/.grokbook/custom_envs.json.
Remote access (Tailscale / LAN)
By default, grokbook binds to 127.0.0.1 (localhost only). To access from other machines:
grokbook serve --host 0.0.0.0
Both the notebook server and MCP server bind to all interfaces. Access from another machine at http://<ip>:8080.
Warning: Grokbook executes arbitrary Python code. Do not expose it to untrusted networks.
CLI reference
grokbook [OPTIONS] # Start notebook + MCP servers (= grokbook serve)
grokbook serve [OPTIONS] # (explicit form)
--host TEXT # Bind address (default: 127.0.0.1)
--port, -p INT # Notebook server port (default: 8080)
--mcp-port INT # MCP server port (default: 8081)
--python PATH # Python interpreter for kernels
--db PATH # Database file (default: ~/.grokbook/grokbook.db)
--allow-code-execution # Enable execute/kernel tools in MCP
grokbook mcp [OPTIONS] # MCP server standalone (stdio, for Claude Desktop)
--allow-code-execution # Enable execute/kernel tools
MCP Integration
On startup, grokbook prints an MCP config block you can paste directly into Claude Desktop or LM Studio:
{
"mcpServers": {
"grokbook": {
"command": "uvx",
"args": ["grokbook", "mcp", "--allow-code-execution"],
"env": {
"GROKBOOK_API_URL": "http://localhost:8080/api"
}
}
}
}
Omit --allow-code-execution to restrict the MCP server to read/write operations only (no code execution).
The grokbook mcp command runs in stdio mode for Claude Desktop. For HTTP-based MCP clients (LM Studio, remote agents), the built-in MCP server on port 8081 is already running when you start grokbook serve.
Always available: list_notebooks, get_notebook, create_notebook, rename_notebook, duplicate_notebook, list_projects, create_project, rename_project, move_notebook, create_cell, insert_cell, read_cell, write_cell, delete_cell, move_cell, duplicate_cell, change_cell_type, clear_output, clear_all_outputs
With --allow-code-execution: execute_cell, run_all_cells, kernel_status, restart_kernel, get_variables, interrupt_kernel
To enable code execution via MCP:
grokbook serve --allow-code-execution
Features
- Code cells with streaming execution, rich output (images, HTML, SVG, pandas tables)
- Markdown cells with GitHub-flavored rendering
- Persistent IPython kernels — one per notebook, variables carry over between cells
- Per-notebook kernel picker — auto-discovers
uv,.venv, and jupyter kernelspecs; installipykernelinto any env with one click - Keyboard-driven — Vim-like command/edit modes (j/k, a/b, dd, Shift+Enter)
- Import/export Jupyter
.ipynbfiles - Variables inspector panel
- Dark/light theme, wide mode, autocomplete, signature tooltips
- Live sync across browser tabs via SSE
Keyboard Shortcuts
Grokbook uses two modes, inspired by Vim:
Command mode (press Escape to enter):
| Key | Action |
|---|---|
j / k |
Navigate between cells |
Enter |
Edit selected cell |
a / b |
Insert cell above / below |
m |
Convert to markdown |
y |
Convert to code |
dd |
Delete cell |
Cmd+Shift+Up/Down |
Move cell up / down |
Edit mode (press Enter or click a cell):
| Key | Action |
|---|---|
Shift+Enter |
Execute cell, move to next |
Cmd+Enter / Ctrl+Enter |
Execute cell, stay in place |
Escape |
Back to command mode |
Tab / Shift+Tab |
Indent / dedent |
Vim mode
Enable Vim keybindings from the editor settings panel (gear icon). When active:
- Full Vim motions in code cells (normal, insert, visual modes)
jkis mapped toEscapein insert mode for quick mode switching- Block cursor in normal mode, line cursor in insert mode
Architecture
Browser ──SSE──▶ Stario server (:8080) ──ZMQ──▶ IPython kernel
│ │
│ Datastar │ SQLite (~/.grokbook/grokbook.db)
│ (reactive │
│ signals) ├── REST API (/api)
│ │
▼ ▼
DOM patches MCP server (:8081)
via SSE (FastMCP, for LLM agents)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grokbook-0.1.4.tar.gz.
File metadata
- Download URL: grokbook-0.1.4.tar.gz
- Upload date:
- Size: 245.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aea28bb8ee0cdf42374abc1f7b724c0299376780a567c6ed29aab4d9f0e1bab
|
|
| MD5 |
967e72816c99d8f8b18c3a1be9c55c84
|
|
| BLAKE2b-256 |
c55d3c69a0ed11b77b277df2243779ddd5b9ee409fdedb8716848b6157951b77
|
Provenance
The following attestation bundles were made for grokbook-0.1.4.tar.gz:
Publisher:
publish.yml on marco-jeffrey/grokbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grokbook-0.1.4.tar.gz -
Subject digest:
0aea28bb8ee0cdf42374abc1f7b724c0299376780a567c6ed29aab4d9f0e1bab - Sigstore transparency entry: 1246183055
- Sigstore integration time:
-
Permalink:
marco-jeffrey/grokbook@002de4c41830f16a040cd1c895d0b9e8bbffbf9c -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/marco-jeffrey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@002de4c41830f16a040cd1c895d0b9e8bbffbf9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file grokbook-0.1.4-py3-none-any.whl.
File metadata
- Download URL: grokbook-0.1.4-py3-none-any.whl
- Upload date:
- Size: 248.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce89420bebd3aaf44aaef8f586f6a1af097f272c79c5bcd3ff32c58ec5f2bc9b
|
|
| MD5 |
532cea24e055145ef2cde70f24b25e20
|
|
| BLAKE2b-256 |
21c06bf3045bed52bc6d743df88d6e1d02c3ba15c51aeab12fd398e500307dd1
|
Provenance
The following attestation bundles were made for grokbook-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on marco-jeffrey/grokbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grokbook-0.1.4-py3-none-any.whl -
Subject digest:
ce89420bebd3aaf44aaef8f586f6a1af097f272c79c5bcd3ff32c58ec5f2bc9b - Sigstore transparency entry: 1246183062
- Sigstore integration time:
-
Permalink:
marco-jeffrey/grokbook@002de4c41830f16a040cd1c895d0b9e8bbffbf9c -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/marco-jeffrey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@002de4c41830f16a040cd1c895d0b9e8bbffbf9c -
Trigger Event:
push
-
Statement type: