kernel-mcp
Provides a persistent Jupyter kernel for executing code, managing variables, and maintaining state across sessions.
Offers a tool to describe pandas DataFrames, returning shape, dtypes, null counts, and numerical statistics.
Enables checking query plans via EXPLAIN QUERY PLAN for read-only SQLite databases to verify index usage.
Click on "Install 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., "@kernel-mcpdescribe the dataframe 'orders'"
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.
kernel-mcp
MCP server that gives an agent a real, persistent Jupyter kernel to work in, instead of the usual "here's a sandboxed exec() with no state" thing most code-tool setups give you. Also throws in two things I was tired of doing by hand while poking at data with an agent:
dumping a dataframe's schema/nulls/stats without writing
df.dtypesfor the hundredth timechecking whether a SQL query is actually going to use an index before letting an agent loose on a real table
Built this over a weekend because I couldn't find an MCP server that did "agent talks to a live kernel" - most of what's out there wraps Slack, Gmail, Notion, that kind of thing. MCP itself is new enough that there's not a ton of prior art for stuff like this yet, so some of the design here is probably non-idiomatic. Feedback welcome.
what it does
Six tools, exposed over stdio via the mcp python SDK:
run_code(code, timeout=30, kernel="default")- executes in a persistent ipykernel process. State sticks around between calls (same kernel), so the agent can build up a session like a human would in a notebook.list_variables(kernel="default")- what's currently in scope, minus the usual ipython noise.describe_dataframe(var_name, kernel="default")- shape, dtypes, null counts, quick numeric stats, head(5). pandas only for now.explain_query_plan(query, db_path=":memory:")- runsEXPLAIN QUERY PLANagainst a sqlite db and hands back the plan rows. Read-only, rejects anything that isn't SELECT/WITH.reset_kernel(kernel="default")- nukes and restarts the kernel if it gets wedged (happens if you time out mid-while Trueor whatever).shutdown_kernel(kernel="default")- stops it, next call to run_code spins a fresh one back up.
Everything runs against a locally spawned kernel process
(jupyter_client.KernelManager) - no remote kernel gateway, no Docker, no
auth. This is meant for local dev / agent sandboxes, not production. Do not
point this at anything you don't trust the agent's code to run on.
Related MCP server: JupyterMCP
install
pip install -e .Needs a python3 jupyter kernelspec available, which ipykernel installs
for you (python -m ipykernel install --user if for some reason it's
missing - check with jupyter kernelspec list).
running it
As a standalone process talking stdio:
python -m kernel_mcp.serverPoint your MCP client (Claude Desktop, whatever) at it. Example config
snippet for Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"kernel-mcp": {
"command": "python",
"args": ["-m", "kernel_mcp.server"],
"cwd": "/path/to/kernel-mcp"
}
}
}quick sanity check without a full MCP client
from kernel_mcp import server
server.run_code("import pandas as pd; df = pd.DataFrame({'a':[1,2,None]})")
print(server.describe_dataframe("df"))
server.shutdown_kernel()how the plumbing works
Talks to the kernel over the raw jupyter zmq protocol via jupyter_client,
not through nbclient or notebook execution - didn't need a notebook doc
model, just wanted request/response against a running kernel. run_code
listens on iopub until it sees status: idle for the matching msg id,
collecting stream output / execute_result / errors along the way.
For the structured tools (list_variables, describe_dataframe) I inject a
small wrapper that builds a __kmcp_val dict/list inside the kernel, dumps
it as JSON wrapped in a marker string, then parse it back out of stdout on
this side. Kind of hacky but it means the profiling logic runs in the
kernel's process against the actual objects, instead of me trying to pull
dataframe internals across the wire some other way. If your df has some
extremely weird custom dtype this JSON round-trip might choke on it - not
handled yet.
known gaps / TODO
only supports one kernel type (python3) right now, no R/Julia even though jupyter_client doesn't care either way
describe_dataframeis pandas-only, polars would probably need its own branch, haven't gotten to ittimeouts call
interrupt_kernel()which works for normal python but won't save you from a genuinely stuck C extensionno tests beyond the manual scripts in
tests/, should probably wire up pytest at some pointconcurrent calls to the same kernel session will race on the zmq channel, there's no lock. fine for a single agent working sequentially, not fine if you're fanning out
license
MIT, do whatever
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceExecute Python code with persistent state across Claude conversations using a background Jupyter kernel. Supports creating notebooks, managing virtual environments, and maintaining variables/imports between code executions.Last updated4
- AlicenseAqualityDmaintenanceEnables AI agents to create, read, edit, and execute Jupyter notebook cells, manage kernels, and connect to remote Jupyter servers.Last updated21MIT
- AlicenseAqualityDmaintenanceEnables AI agents to execute Python, TypeScript, and JavaScript code in persistent Jupyter kernels with stateful variables and imports across interactions.Last updated73MIT
- Flicense-qualityDmaintenanceEnables interactive data analysis using a real IPython kernel with session management, supporting CSV/Excel/JSON loading, code execution, and variable monitoring.Last updated159
Related MCP Connectors
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Create and manage AI agents that collaborate and solve problems through natural language interacti…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Luckylobster8868/kernel-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server