jupyter-kernel-mcp

jupyter-kernel-mcp

Enables AI agents to execute Python, TypeScript, and JavaScript code in persistent Jupyter kernels with stateful variables and imports across interactions.

Category
访问服务器

README

Jupyter Kernel MCP

PyPI version Python 3.10+ License: MIT

A Model Context Protocol (MCP) server that provides stateful Jupyter kernel development with multi-language support (Python, TypeScript, JavaScript) for AI agents and assistants.

Table of contents

  1. Project description
  2. Who this project is for
  3. Project dependencies
  4. Instructions for using Jupyter Kernel MCP
  5. Troubleshooting
  6. Contributing guidelines
  7. Additional documentation
  8. How to get help
  9. Terms of use

Project description

With Jupyter Kernel MCP you can execute Python, TypeScript, and JavaScript code in persistent, isolated environments that maintain state between executions—perfect for AI agents performing complex data analysis and development workflows.

Jupyter Kernel MCP helps you build stateful AI agent workflows that can load datasets, perform transformations, and analyze results across multiple interactions without losing variables or computed state.

Unlike traditional stateless code execution, Jupyter Kernel MCP preserves variables, imports, and computed results between AI agent messages, enabling sophisticated multi-step data science workflows.

Key Features

  • 🔄 Persistent State: Variables and imports persist between code executions
  • 🌐 Multi-Language Support: Python, TypeScript, and JavaScript kernels
  • 🚀 Multi-Kernel Support: Create and manage multiple isolated kernel environments
  • 🤖 AI-Agent Ready: Seamless integration with Claude Code and other MCP clients
  • 📊 Data Science Workflows: Perfect for iterative data analysis and exploration
  • ⚡ Fast Communication: Direct socket-based communication with Jupyter kernels
  • 🛠 Easy Management: Simple kernel lifecycle management (start, stop, reset, list)
  • 🔗 Unified API: Single interface for all languages - no separate tools needed

Who this project is for

This project is intended for AI developers, data scientists, and automation engineers who want to build intelligent agents that can perform stateful data analysis and complex computational workflows.

Perfect for:

  • Building AI agents that analyze datasets across multiple interactions
  • Creating persistent computational environments for LLMs
  • Developing stateful data science workflows with AI assistants
  • Prototyping and exploring APIs with maintained context
  • Full-stack development with TypeScript/JavaScript and Python
  • Educational environments teaching multiple programming languages

Project dependencies

Before using Jupyter Kernel MCP, ensure you have:

  • Python 3.10 or higher - Required for MCP SDK compatibility
  • Claude Code, Cline, or another MCP client - To interact with the server
  • Jupyter dependencies - Automatically installed with the package
  • Node.js (for TypeScript/JavaScript) - Required for TSLAB kernels (optional)
  • TSLAB - TypeScript/JavaScript kernel support (optional)

Instructions for using Jupyter Kernel MCP

Get started with Jupyter Kernel MCP by installing the package and adding it to your MCP client.

Install Jupyter Kernel MCP

From PyPI (Recommended)

Install using pip:

pip install jupyter-kernel-mcp

Or using uv:

uv add jupyter-kernel-mcp

From GitHub (Development Version)

To install the latest development version directly from GitHub:

uv tool install git+https://github.com/codewithcheese/jupyter-kernel-mcp.git

Verify Installation

jupyter-kernel-mcp --help

Optional: Install TSLAB for TypeScript/JavaScript Support

To enable TypeScript and JavaScript kernels:

# Install TSLAB globally
npm install -g tslab
# or with pnpm
pnpm install -g tslab

# Install kernel specs
tslab install

# Verify kernels are available
jupyter kernelspec list

You should see tslab and jslab in the kernel list.

Configure with Claude Code

  1. Add the server to Claude Code:

    claude mcp add jupyter-kernel jupyter-kernel-mcp
    
  2. Verify the server is listed:

    claude mcp list
    

Configure with other MCP clients

  1. Add to your MCP client configuration (example for mcp_config.json):

    {
      "servers": {
        "jupyter-kernel": {
          "command": "jupyter-kernel-mcp"
        }
      }
    }
    

Run Jupyter Kernel MCP

  1. The server starts automatically when called by your MCP client

    No manual startup required - the server launches when your MCP client connects.

  2. Start your first kernel:

    In Claude Code or your MCP client:

    Please start a new Jupyter kernel for data analysis
    
  3. Execute stateful code:

    Load this dataset and show me the first few rows:
    
    import pandas as pd
    df = pd.read_csv('data.csv')
    df.head()
    
  4. Continue the analysis in follow-up messages:

    Now group the data by category and calculate the mean values
    

    The df variable persists from the previous execution!

Available Tools

Tool Description
start_kernel Create a new Jupyter kernel for Python, TypeScript, or JavaScript
execute_code Execute code in any language kernel (auto-routes based on kernel type)
list_kernels Show all active kernels with their languages
list_variables Display variables in a kernel's namespace
get_kernel_status Get detailed kernel information
stop_kernel Stop and remove a specific kernel
reset_kernel Reset a kernel (clears all variables)

Troubleshooting

<table> <tr> <td><strong>Issue</strong></td> <td><strong>Solution</strong></td> </tr> <tr> <td>Server won't start - "No module named 'jupyter_client'"</td> <td>Install dependencies: <code>pip install jupyter-client</code></td> </tr> <tr> <td>Kernel creation fails</td> <td>Ensure Python 3.10+ is installed and accessible</td> </tr> <tr> <td>MCP client can't find server</td> <td>Verify installation: <code>which jupyter-kernel-mcp</code></td> </tr> <tr> <td>Variables not persisting between executions</td> <td>Ensure you're using the same kernel_id for related executions</td> </tr> <tr> <td>TypeScript/JavaScript kernel creation fails</td> <td>Install TSLAB: <code>npm install -g tslab && tslab install</code></td> </tr> <tr> <td>"tslab command not found" error</td> <td>Ensure Node.js is installed and TSLAB is in PATH</td> </tr> <tr> <td>TypeScript compilation errors</td> <td>Check TypeScript syntax - TSLAB uses strict type checking</td> </tr> </table>

Other troubleshooting resources:

  • Check server logs for detailed error messages
  • Verify your MCP client supports the required MCP protocol version
  • Ensure no firewall is blocking local kernel connections

Contributing guidelines

We welcome contributions! Please see our Contributing Guide for details on:

  • How to submit bug reports and feature requests
  • Development setup and testing procedures
  • Code style guidelines and review process

Additional documentation

For more information:

How to get help

Need assistance? Here's how to get support:

Terms of use

Jupyter Kernel MCP is licensed under the MIT License.


Built with ❤️ for the AI agent development community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选