era5-mcp-server
Enables natural language access to ERA5 climate data from the Copernicus Climate Data Store. Supports downloading monthly means and inspecting NetCDF files.
README
ERA5 Climate Data MCP Server
This project provides a ready-to-run MCP (Model Context Protocol) server that interfaces with the Copernicus Climate Data Store (CDS). It allows you to use natural language in an AI assistant (like Gemini CLI or Claude Desktop) to fetch and inspect ERA5 climate data.
Features
- Easy Data Download: Fetch monthly-averaged ERA5 data for both single levels (e.g., surface temperature) and pressure levels (e.g., geopotential height at 500hPa).
- Multi-Year Fetching: Download data for the same month across multiple years in a single request.
- Data Inspection: Quickly inspect the contents (dimensions, coordinates, variables) of any downloaded NetCDF file.
1. Setup Copernicus API Key
Before using the server, you must have a Copernicus account and an API key.
- Register: Create an account on the CDS Website.
- Get Key: Log in and find your API key at the bottom of your user profile page (e.g.,
https://cds.climate.copernicus.eu/user/YOUR_USER_ID). - Create
.cdsapircfile: Create a file named.cdsapircin your home directory (~/.cdsapircon Linux/macOS,C:\Users\YourUser\.cdsapircon Windows). - Add Credentials: Add your API key to the file in the following format, replacing
YOUR_UIDandYOUR_API_KEYwith your actual values:url: https://cds.climate.copernicus.eu/api/v2 key: YOUR_UID:YOUR_API_KEY - Accept Terms: For each dataset you want to access (
reanalysis-era5-single-levels-monthly-meansandreanalysis-era5-pressure-levels-monthly-means), you must visit its page on the CDS website and accept the terms of use manually. The server cannot do this for you.
2. Installation
A requirements.txt file is provided to install all necessary dependencies.
# Create and activate a Python virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On macOS/Linux
# .\venv\Scripts\activate # On Windows
# Install the required packages
pip install -r requirements.txt
3. Available Tools
This server exposes the following tools to your AI assistant:
fetch_era5_single_levels
Downloads ERA5 monthly mean surface data.
- Parameters:
variable(str): The surface variable to download (e.g.,'2m_temperature').year(str): The year for the data (e.g.,'2023').month(str): The month for the data (e.g.,'01','12').output_filename(str): The local path to save the file (e.g.,'data/2m_temp_2023_01.nc').
fetch_era5_pressure_levels
Downloads ERA5 monthly mean data on specific pressure levels.
- Parameters:
variable(str): The variable to download (e.g.,'geopotential','temperature').pressure_level(int): The pressure level in hPa (e.g.,500,850).year(str or list[str]): The year(s) for the data. Can be a single year ('2023') or a list of years for multi-year downloads (['2020', '2021', '2022']).month(str): The month for the data (e.g.,'03').output_filename(str): The local path to save the file.
inspect_netcdf
Inspects a NetCDF file and returns a summary of its contents.
- Parameters:
filepath(str): The absolute path to the.ncfile to inspect.
4. Running the Server
Once installed, you can run the MCP server directly from your terminal. This will make the tools available to your connected AI assistant.
python era5_server.py
To add the server to your assistant permanently:
- Gemini CLI:
gemini tools add era5_server.py - Claude: Add a new tool and point it to the server's OpenAPI specification. By default, the server runs on
localhost:8000, and the specification is available athttp://localhost:8000/openapi.json. - Other MCP-compatible clients: Follow their instructions for adding a local tool server.
5. Testing the Server
A Jupyter notebook, test_server.ipynb, is provided to test the server's functionality directly from a Python environment.
-
Install Jupyter: If you don't have it, install Jupyter Lab:
pip install jupyterlab -
Run the Notebook: Start Jupyter Lab and open
test_server.ipynb:jupyter lab -
Execute Cells: Follow the instructions in the notebook to run the cells. They will guide you through installing dependencies, setting a cache directory, and testing single-year, multi-year, and inspection tools.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。