jupyter-kernel

Start, connect to, and execute code in Jupyter kernels via a stdio MCP server.

1|Updated Oct 25, 2020
One-click install
npx skills add https://github.com/bfairkun/dotfiles --skill jupyter-kernel-bfairkun
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jupyter-kernel
Source: https://github.com/bfairkun/dotfiles/tree/main/agents/.agents/skills/jupyter-kernel
Command: npx skills add https://github.com/bfairkun/dotfiles --skill jupyter-kernel-bfairkun

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jupyter_client.

What problem does it solve? Setting up and maintaining a persistent Jupyter kernel connection for an AI agent is error-prone: kernels die after laptop sleep, symlinks break across machines, and stale connection files crash MCP servers silently. This Skill documents the installation, registration, and recovery procedures for a lightweight stdio MCP server that speaks the Jupyter wire protocol over ZMQ with no HTTP or open ports. ## Core Features & Use Cases - Kernel lifecycle tools: start_kernel, connect_to_kernel, list_kernels, restart_kernel, and run_python let an agent execute code in persistent Python or R kernels. - Attach to existing kernels: Connect to whichever kernel VS Code or JupyterLab is already running by passing a connection file path or grabbing the newest one. - Sleep/drop recovery: Reconnect to a surviving kernel process after lid-close sleep instead of losing in-memory state by relaunching. - Use Case: On a new Linux machine, stow the agents dotfiles package, symlink the script onto $PATH, register the MCP server, then have the agent start a py_general kernel and verify it with run_python. ## Quick Start Ask the agent to start a py_general Jupyter kernel and verify the connection by running a quick Python snippet that prints the interpreter path.

Frequently Asked Questions about jupyter-kernel

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect an AI agent to a running Jupyter kernel?▼

Use the connect_to_kernel tool with the kernel's connection file path, or omit the path to attach to the most recently modified kernel. Call list_kernels first to discover available kernel-*.json connection files in the Jupyter runtime directories.

How do I execute Python code in a persistent Jupyter kernel from an MCP client?▼

Register jupyter-kernel as a user-scope stdio MCP server running jupyter_kernel_mcp.py, then call the run_python tool with your code. It returns stdout, stderr, and results as text truncated at 8000 characters.

Why do the Jupyter kernel MCP tools fail to load after setup?▼

The server failed to start, usually because the symlink to jupyter_kernel_mcp.py is broken or points to an absolute macOS path on a Linux machine. Inspect the symlink chain in ~/bin and dotfiles/bin/bin, then recreate it as a relative symlink and restart the client.

Why does run_python fail with NoSuchKernel after my laptop sleeps?▼

Sleep tears down the MCP connection while the kernel process usually survives. Call connect_to_kernel with the explicit connection file path to reattach and preserve in-memory state, and only relaunch the kernel if reconnecting fails.

Should I register the MCP server with the --latest argument?▼

No. With --latest the server auto-connects to the newest kernel-*.json at startup, and if that file belongs to a dead kernel the server crashes before any tool is usable. Leave the args bare and connect explicitly via connect_to_kernel instead.

Can I use R or other non-Python kernels with this MCP server?▼

Yes, any registered kernelspec works. Run jupyter kernelspec list to see available names, then pass one such as ir to start_kernel; register a new spec once per machine with python -m ipykernel install --user.