Jupyter MCP 服务器

Jupyter MCP 服务器

为 Jupyter 提供模型上下文协议(MCP)支持的服务器。

快速入门

  1. 安装依赖:
    pip install jupyterlab jupyter-collaboration ipykernel
    pip uninstall -y pycrdt datalayer_pycrdt
    pip install datalayer_pycrdt
    
  2. 启动 JupyterLab:
    jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN --ip 0.0.0.0
    
  3. 配置 Claude Desktop:
    • macOS 和 Windows 用户更新 claude_desktop_config.json 文件。
    • Linux 用户运行以下命令:
      CLAUDE_CONFIG=${HOME}/.config/Claude/claude_desktop_config.json
      cat <<EOF > $CLAUDE_CONFIG
      {
        "mcpServers": {
          "jupyter": {
            "command": "docker",
            "args": [
              "run",
              "-i",
              "--rm",
              "-e",
              "SERVER_URL",
              "-e",
              "TOKEN",
              "-e",
              "NOTEBOOK_PATH",
              "--network=host",
              "datalayer/jupyter-mcp-server:latest"
            ],
            "env": {
              "SERVER_URL": "http://localhost:8888",
              "TOKEN": "MY_TOKEN",
              "NOTEBOOK_PATH": "notebook.ipynb"
            }
          }
        }
      }
      EOF
      
  4. 使用 Smithery 自动安装:
    npx -y @smithery/cli install @datalayer/jupyter-mcp-server --client claude