Open-Meteo MCP Server
Open-Meteo MCP Server
一个基于 MCP(Model Context Protocol)的小型服务器,通过封装免费的 Open-Meteo API,让 Claude 等 AI 助手能够查询真实的天气数据——当前实况和预报。无需 API 密钥。
这是一个学习项目,用于端到端理解 MCP 服务器的工作原理:定义工具、本地运行,并将其连接到真实的 AI 客户端。
功能
连接到兼容 MCP 的客户端(如 Claude)后,它会暴露三个工具:
工具 | 作用 |
| 将地名(“London”)转换为坐标 |
| 获取某个坐标的当前温度、风速、降水等 |
| 获取某个坐标最长 16 天的预报(按天和/或按小时) |
因此,用户可以问助手“里斯本明天天气怎么样?”,助手会自己调用这些工具来查询并回答——它并没有预先内置天气数据,而是实时获取。
Related MCP server: Weather MCP Server
构建方式
src/server.ts—— 定义这三个工具以及每个工具如何调用 Open-Meteo API。这是服务器真正的“大脑”。src/index.ts—— 通过 stdio(标准输入/输出)运行服务器。这是本地开发工具(如 MCP Inspector)以及将服务器作为子进程启动的桌面应用所使用的传输方式。src/http.ts—— 通过 Streamable HTTP 运行同一个服务器,因此可以通过网络访问——例如部署在某处,或从基于浏览器的客户端访问。这就是无需在本地安装任何东西即可演示的原因。
两个入口点共享 server.ts 中相同的工具定义,因此实际逻辑只存在于一个地方。
运行
npm install
npm run build本地/stdio 模式(适用于将服务器作为子进程启动的工具):
npm startHTTP 模式(用于连接远程客户端,例如通过转发的 Codespaces 端口或托管服务提供商):
node build/http.js这会启动一个普通 HTTP 服务器,监听端口 3000(可通过 PORT 配置),在 POST /mcp 提供单个 MCP 端点,并附带 GET /health 检查。
无需客户端进行测试
MCP Inspector 的 CLI 模式是在终端中直接尝试的最快方式,无需浏览器:
# See what tools are available
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
# Actually call one
npx @modelcontextprotocol/inspector --cli node build/index.js \
--method tools/call --tool-name geocode_location --tool-arg name=London连接到 AI 助手
Claude Desktop / Claude Code:在客户端配置中将
build/index.js指向为 stdio MCP 服务器。Claude.ai 自定义连接器:指向正在运行的 HTTP 实例的
/mcpURL(需要支持自定义连接器的套餐)。Anthropic API 直连:在
/v1/messages请求的mcp_servers参数中传入/mcpURL——这样任何自定义应用或页面都可以使用这些工具,而无需预先构建 MCP 客户端。
扩展说明
Open-Meteo 提供的变量和端点远多于本项目使用的(空气质量、海洋预报、历史/存档数据、集合预报)。若要添加更多,请遵循 src/server.ts 中现有工具的模式——注册一个新的 server.tool(...) 块,带上自己的输入 schema 和 Open-Meteo 请求。
数据 © Open-Meteo.com,CC BY 4.0。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to fetch current weather conditions and forecasts for any city using the Open-Meteo API. Provides temperature, precipitation, and hourly forecast data through natural language queries.
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to retrieve current weather, forecasts, and summaries for any global location using the Open-Meteo API, with no API key required.21Creative Commons Zero v1.0 Universal
- FlicenseNot gradedqualityDmaintenanceEnables AI agents like GitHub Copilot to retrieve real-time weather data for any city using the Open-Meteo API, no API key required.9
- AlicenseNot gradedqualityCmaintenanceProvides live weather data (current conditions, forecasts) and city geocoding through Open-Meteo API, enabling AI assistants to answer weather queries without an API key.MIT
Related MCP Connectors
Real-time weather conditions and multi-day forecasts via Open-Meteo — free, no API key required
Global weather via Open-Meteo: forecast, ERA5 archive, marine, air quality, geocoding, elevation.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/clarehancock/open-meteo-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server