地理空间分析服务器

Jupyter Earth MCP Server 是一个基于模型上下文协议(MCP)的服务器实现,为Jupyter笔记本提供地理空间分析工具集。

  • by datalayer
  • Python
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 datalayer/jupyter-earth-mcp-server

使用说明

此存储库已存档-使用https://github.com/datalayer/earthdata-mcp-server相反。

🌎 ✨ Jupyter Earth MCP服务器

🌍 Jupyter Earth MCP服务器是一个 模型上下文协议 (MCP)服务器实现,为🗺️ 地理空间分析📓 Jupyter笔记本。

以下演示使用 地球数据MCP服务器 为了在NASA Earthdata上搜索数据集和数据颗粒,此MCP服务器可以在Jupyter和 jupyter mcp服务器 进行进一步分析。

Analyzing Sea Level Rise with AI-Powered Geospatial Tools and Jupyter - Watch Video

启动JupyterLab

确保安装了以下内容。需要协作包,因为可以看到笔记本上的修改,这要归功于 Jupyter实时协作.

pip install jupyterlab==4.4.1 jupyter-collaboration==4.0.2 ipykernel
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt==0.12.17

然后,使用以下命令启动JupyterLab。

jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN --ip 0.0.0.0

你也可以跑步 make jupyterlab.

[!注意]

这 --ip 设置为 0.0.0.0 允许在Docker容器中运行的MCP服务器访问您本地的JupyterLab。

与Claude Desktop一起使用

克劳德桌面可以下载 从这个页面 适用于macOS和Windows。

对于Linux,我们成功地使用了这个 基于nix的非官方构建脚本

# ⚠️ UNOFFICIAL
# You can also run `make claude-linux`
NIXPKGS_ALLOW_UNFREE=1 nix run github:k3d3/claude-desktop-linux-flake \
  --impure \
  --extra-experimental-features flakes \
  --extra-experimental-features nix-command

要在Claude Desktop中使用此功能,请将以下内容添加到您的 claude_desktop_config.json (阅读更多关于 MCP文档网站).

[!重要]

确保端口 SERVER_URL和 TOKEN 匹配那些在 jupyter lab 命令。

这 NOTEBOOK_PATH 应该相对于JupyterLab启动的目录。

macOS和Windows上的Claude配置

{
  "mcpServers": {
    "jupyter-earth": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SERVER_URL",
        "-e",
        "TOKEN",
        "-e",
        "NOTEBOOK_PATH",
        "datalayer/jupyter-earth-mcp-server:latest"
      ],
      "env": {
        "SERVER_URL": "http://host.docker.internal:8888",
        "TOKEN": "MY_TOKEN",
        "NOTEBOOK_PATH": "notebook.ipynb"
      }
    }
  }
}

Linux上的Claude配置

CLAUDE_CONFIG=${HOME}/.config/Claude/claude_desktop_config.json
cat <<EOF > $CLAUDE_CONFIG
{
  "mcpServers": {
    "jupyter-earth": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SERVER_URL",
        "-e",
        "TOKEN",
        "-e",
        "NOTEBOOK_PATH",
        "--network=host",
        "datalayer/jupyter-earth-mcp-server:latest"
      ],
      "env": {
        "SERVER_URL": "http://localhost:8888",
        "TOKEN": "MY_TOKEN",
        "NOTEBOOK_PATH": "notebook.ipynb"
      }
    }
  }
}
EOF
cat $CLAUDE_CONFIG

组件

工具

服务器目前提供1个工具:

  1. download_earth_data_granules
  • 在Jupyter笔记本中添加一个代码单元格,从NASA地球数据下载地球数据颗粒。
  • 输入:
    • folder_name(string):保存数据的本地文件夹名称。
    • short_name(string):要下载的地球数据集的简称。
    • count(int):要下载的数据颗粒数。
    • temporal (tuple):(可选)时间范围,格式为(date_from,date_to)。
    • bounding_box (tuple):(可选)格式为(lower_lift_lon、lower_light_lat、upper_right_lon、upper_right_lat)的边界框。
  • 返回:单元格输出。

提示

  1. download_analyze_global_sea_level
    • 请求在Jupyter中下载和分析全球海平面数据。
    • 返回:提示格式正确。

建筑

你可以从源代码构建Docker镜像。

make build-docker