Skip to main content

clikernel

clikernel gives an LLM agent a persistent Python workbench built from two processes. A gateway (rustygate) runs all the time and hosts real Jupyter kernels (ipymini by default); kernels live there and persist until explicitly stopped. clikernel itself starts and stops with each conversation: a small translator the MCP host launches, speaking MCP to the model and the Jupyter kernels API to the gateway. Outputs come back as concise text — a bare 42 for a single result, tagged sections for several, tracebacks ANSI-stripped and capped.

Because kernels outlive conversations, an agent can connect back to yesterday’s kernel (or the user’s live solveit kernel) and find its state intact. Kernels created or attached explicitly are never stopped implicitly: only stop_kernel ends them. The one exception is the auto kernel: an execute with nothing connected creates a kernel scoped to the conversation, stopped again when the conversation ends or the agent connects elsewhere. Creating a kernel runs the user’s startup.py and installs their inspectors.py cell-checking rules, delivered as source so remote kernels get the same setup as local ones.

Install

pip install clikernel

Plus the resident side: rustygate and a kernel (ipymini by default). Start the gateway (and keep it running, e.g. via launchd/systemd):

rustygate --port 8787

Use with an MCP host

Register the stdio server with your MCP host, e.g. for Claude Code:

claude mcp add clikernel -- clikernel-mcp

The tools mirror the gateway’s kernel API: connect, execute, list_kernels, stop_kernel, restart, and interrupt. When executed code requests input, the MCP client shows an elicitation dialog while the same execute call remains active. Repeated prompts repeat that callback. Password-marked prompts are refused.

An execute with no kernel connected auto-creates one, scoped to the conversation: it stops at conversation end, or when connect moves elsewhere. Kernels made or attached with an explicit connect are stopped only by stop_kernel — a later conversation reattaches by id and continues where the last one stopped. $CLIKERNEL_HOST overrides the default gateway (http://127.0.0.1:8787).

Pass --quiet (clikernel-mcp --quiet) for a host whose sessions should not see banner noise: startup still runs, but its output stays out of every reply, and an auto-connecting execute returns just the result.

Configuration

Three optional files in $XDG_CONFIG_HOME/clikernel/ (usually ~/.config/clikernel/):

  • startup.py — run in every kernel clikernel creates, with __file__ bound to its path; its output returns as part of the connect reply.
  • inspectors.py — cell inspectors installed after startup. The file may define inspect and/or a list inspectors; each is called once per cell before it runs (1-arg: the cell’s AST; 2-arg: AST and raw source). Return a string to print a note before the cell’s output, raise RuleBlock (provided in the namespace) to block the cell; any other exception warns and the cell runs. See examples/inspectors.py.
  • gateways.toml — named remote gateways, so tokens never appear in tool arguments:
[gateways.solveit]
url = "https://solveit.example.com/gate"
token_env = "SOLVEIT_TOKEN"
verify = false   # optional: accept a self-signed certificate

The stream protocol

Run clikernel as a plain CLI process and the same client speaks a delimiter-framed stdin/stdout protocol for token-reading clients: no echo, a cheap . acknowledgement per request, responses ended by a per-process random delimiter, multiline cells framed by -- and the delimiter. The full recipe is announced in the process’s own startup banner. Run bare it creates a kernel and stops it on exit; --kernel <id> attaches to an existing kernel and leaves it as found.

Release files for clikernel 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clikernel 0.2.8
File Size Uploaded
clikernel-0.2.8.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clikernel 0.2.8
File Interpreter ABI Platform
clikernel-0.2.8-py3-none-any.whl Python 3 none any Details

Total release size: 49.2 kB

Release files / clikernel-0.2.8.tar.gz

Download URL clikernel-0.2.8.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
73737a24a616ee9ab5e8a43018ff2a72713aa423aa35cc2c2a7fc9b9e13f2ea0
BLAKE2b-256 checksum
How to use checksums
345f6ebbfae1f9ab8856ed18da4006ac8036fd54f52ca82900adb82e189a958f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / clikernel-0.2.8-py3-none-any.whl

Download URL clikernel-0.2.8-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3e397a3d96aea6e60c1d41f59aafd7171acc09e9593f207f6d31fe9ad049fd0
BLAKE2b-256 checksum
How to use checksums
f3f66f0cbb40c8d2342e8cfd8b9c8085d0a0f8128f4cf468b9160acbc664ca0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.9

2 release files

This release

0.2.8 This release

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page