ipython-kernel-mcp
Provides integration with Jupyter/IPython kernels, allowing MCP clients to connect to a running kernel and execute Python code persistently with shared state, check kernel status, and interrupt running executions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ipython-kernel-mcp Run this Python code and keep the variable for later: total = sum(range(100))"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ipython-kernel-mcp
An MCP (Model Context Protocol) server that connects to an existing IPython kernel, providing persistent code execution with shared state across calls.
Based on ipython-mcp by
gabiteodoru, rewritten for the MCP Python SDK 2.x
(MCPServer instead of the removed FastMCP).
How it works
The server connects to a running IPython kernel via a Jupyter connection file (ZMQ). Variables, imports, and computed results persist between tool calls. Multiple clients can share the same kernel — for example, VS Code's variable explorer and an AI agent connected via MCP.
Related MCP server: notebook-agent-mcp
Installation
pip install git+https://github.com/asanchezleache/ipython-kernel-mcp.gitRequires mcp>=2 and jupyter-client>=8 (installed automatically).
Usage
1. Start an IPython kernel
ipython kernel --ConnectionFileMixin.connection_file=~/ipython-mcp-connection.json2. Register with your MCP client
For Vibe CLI:
vibe mcp add ipython-kernel --transport stdio \
--command ipython-kernel-mcp \
--env IPYTHON_MCP_CONNECTION=~/ipython-mcp-connection.jsonFor other MCP clients (Claude Desktop, etc.), add to your config:
{
"mcpServers": {
"ipython-kernel": {
"command": "ipython-kernel-mcp",
"env": {
"IPYTHON_MCP_CONNECTION": "~/ipython-mcp-connection.json"
}
}
}
}3. Connect VS Code (optional)
Cmd+Shift+P → "Jupyter: Connect to Existing Kernel" → select the connection
file. VS Code's variable explorer, inline plots, and tqdm bars share the same
kernel.
Tools
Tool | Description |
| Connect to a running IPython kernel via connection file |
| Execute Python code in the persistent kernel |
| Check connection status |
| Interrupt a running execution |
Notes
The kernel must be started separately. This server connects to an existing kernel; it does not start one.
stdout/stderr is collected and returned when execution completes. There is no real-time streaming to the MCP client. For live output (tqdm bars, print statements), use VS Code or a terminal connected to the same kernel.
The connection file path is resolved from the
connection_fileparameter, then theIPYTHON_MCP_CONNECTIONenvironment variable.
License
MIT. See LICENSE.
Available Tools
4 toolsconnect_to_kernelA
Connect to an existing IPython kernel using its connection file.
Args: connection_file: Path to the kernel connection JSON file. If not provided, uses the IPYTHON_MCP_CONNECTION environment variable.
Returns: Connection status message.
Inputs: connection_file. Returns: result
execute_codeA
Execute Python code on the connected IPython kernel.
Variables persist between calls. Output (stdout, results, errors) is collected and returned as a single string when execution completes.
Args: code: Python code to execute.
Returns: Execution output (stdout, expression results, or error messages).
Inputs: code (required). Returns: result
interrupt_kernelA
Interrupt the current kernel execution by sending SIGINT.
Useful for stopping long-running code or infinite loops.
Returns: Interrupt status message.
Inputs: no named parameters. Returns: result
kernel_statusA
Check the current kernel connection status.
Returns: Status message indicating whether a kernel is connected.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool performs a clearly distinct function: connecting, executing, checking status, and interrupting. There is no meaningful overlap or ambiguity between tool purposes.
Most tools follow a verb-first naming pattern (connect_to_kernel, execute_code, interrupt_kernel), but kernel_status is noun-first and breaks the pattern slightly. Overall the naming remains predictable and readable.
Four tools is a well-scoped count for a focused IPython kernel integration. Each tool fills a necessary role without unnecessary bloat.
The core lifecycle of connect, execute, check status, and interrupt is covered. Missing disconnect or restart operations are minor gaps that agents can work around, but the main workflows are supported.
Related MCP Connectors
Connect AI agents to the Totem network for communication and work coordination.
Connect AI agents to shared Spaces for context, sourced work, tasks, and runs.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Connect AI agents to Replynodes over the Model Context Protocol.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to execute Python, TypeScript, and JavaScript code in persistent Jupyter kernels with stateful variables and imports across interactions.779 PyPI4MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to execute Jupyter notebook cells with persistent kernel state, output persistence, and structured JSON control surface.2-
- AlicenseAqualityBmaintenanceEnables interactive Python execution with a persistent IPython kernel through MCP, retaining namespace state and providing structured output logs for agent and tool integrations.8Apache 2.0
- AlicenseNot gradedqualityDmaintenanceConnects Claude Code to local Jupyter kernels for code execution, kernel management, and notebook execution, with security gating and output capture.PolyForm Noncommercial 1.0.0