Jupythunder

Jupythunder

🚀 项目说明

本项目主要实现了Jupyter与MCP服务器的连接,处理Jupyter内核与MCP客户端之间的通信,同时提供API接口用于交互式计算和数据可视化,帮助用户更便捷地进行相关操作。

🚀 快速开始

MCP服务器启动

conda activate jupythunder
cd jupythunder
python jupythunder_server.py --port 8000

Jupyter连接测试

conda activate jupythunder
cd jupythunder
python jupythunder_client.py --connect http://localhost:8000

📦 安装指南

MCP服务器配置

conda create -n jupythunder python>=3.7
conda activate jupythunder
pip install mcp[cli] requests websocket-client python-dotenv urllib3
git clone https://github.com/yourusername/jupythunder.git
cd jupythunder
python jupythunder_server.py --port 8000

Jupyter连接配置

conda create -n jupythunder python>=3.7
conda activate jupythunder
pip install requests websocket-client python-dotenv urllib3
git clone https://github.com/yourusername/jupythunder.git
cd jupythunder
python jupythunder_client.py --connect http://localhost:8000

📚 详细文档

使用说明

MCP服务器功能

  1. 处理Jupyter内核与MCP客户端之间的通信。
  2. 提供API接口用于交互式计算和数据可视化。

Jupyter连接步骤

  1. 启动Jupyter服务器并获取token。
  2. 配置jupythunder_client.py中的连接参数。
  3. 运行客户端以建立连接。

项目结构

jupythunder/
├── jupythunder_server.py          # MCP服务器实现
├── jupythunder_client.py          # Jupyter API客户端
├── tools.py                       # MCP工具实现
├── utils.py                       # 工具函数
└── requirements.txt               # 项目依赖

详细配置

环境变量设置

export JUPYTHUNDER_PORT=8000
export JUPYTHUNDER_LOG_LEVEL=DEBUG

配置文件示例

# jupythunder_config.py
JUPYTHUNDER_HOST = "localhost"
JUPYTHUNDER_PORT = 8000
LOG_LEVEL = "INFO"

常见问题

无法连接到MCP服务器jupythunder: spawn pythonENOENT

此错误表示找不到Python可执行文件。请检查以下配置:

  1. 使用绝对路径指定Python:

    {
    "mcpServers": {
    "jupythunder": {
    "command": "/absolute/path/python",
    "args": ["/absolute/path/jupythunder_server.py"]
    }
    }
    }
    

    确认Python安装位置:

    which python  # macOS/Linux
    where python  # Windows
    
  2. 使用python3命令:

    {
    "mcpServers": {
    "jupythunder": {
    "command": "python3",
    "args": ["/absolute/path/jupythunder_server.py"]
    }
    }
    }
    

问题排查

Jupyter连接失败

  • 确认Jupyter服务器正在运行
  • 检查提供的URL和token是否正确
  • 查看防火墙设置

创建或打开笔记本失败

  • 确认在Jupyter服务器上有写入权限
  • 检查笔记本名称中不含特殊字符
  • 确认没有同名的笔记本已存在

项目组件

  1. FastMCP服务器:实现高效的计算任务处理。
  2. Jupyter客户端:提供用户交互界面和API调用。
  3. 工具集:包含数据处理、日志记录等功能。

依赖管理

安装要求

  • Python >=3.7
  • conda环境管理器

第三方库

  • mcp[cli]
  • requests
  • websocket-client
  • python-dotenv
  • urllib3

日志系统

conda activate jupythunder
cd jupythunder
python logging_server.py --port 8001

扩展模块

自定义内核支持

conda install -n jupythunder custom-kernel

额外功能包

pip install extra_features

附录

命令行参数

  • --port:指定服务器端口,默认8000。
  • --log-level:设置日志级别,可选DEBUG/INFO/ERROR。

错误代码

错误代码 描述
101 连接超时
102 认证失败
103 服务内部错误

补充说明

  • 所有代码示例均为Python语法。
  • 配置文件需放置在项目根目录下。

以上内容涵盖了项目的安装、配置、使用及维护等各个方面,确保用户能够顺利完成环境搭建和问题解决。

  • 0 关注
  • 0 收藏,28 浏览
  • system 提出于 2025-10-02 10:24

相似服务问题

相关AI产品