MCP Weather Server

MCP 天气服务器

一个简单的模型上下文协议 (MCP) 服务器,可提供任何位置的天气信息。

什么是 MCP?

模型上下文协议 (MCP) 是 AI 应用程序和代理与数据源和工具连接的标准化方式。它允许像 Claude 这样的 AI 模型通过标准化接口与您的本地系统、外部服务和自定义工具进行交互。

特征

  • 获取任何地点的当前天气信息
  • 与 Claude Desktop 和其他 MCP 客户端兼容
  • 使用免费的 wttr.in 天气 API(无需 API 密钥)

安装

# Clone the repository git clone <your-repo-url> cd mcp-weather-server # Install dependencies npm install

用法

运行服务器

node index.js

连接到 Claude Desktop

  1. 打开 Claude 桌面
  2. 前往“设置”>“MCP 服务器”
  3. 添加新服务器
  4. 选择“自定义”并输入服务器可执行文件的路径
  5. 将命令设置为: node /Users/le-yo/CascadeProjects/mcp-weather-server/index.js
  6. 保存并重新启动 Claude Desktop

克劳德的示例提示

连接后,您可以要求 Claude 使用天气工具:

  • “纽约现在的天气怎么样?”
  • “告诉我现在伦敦的气温。”
  • “东京下雨了吗?”

工作原理

该服务器实现了模型上下文协议 (MCP),提供了一个从 wttr.in API 获取天气数据的工具。当 Claude 或其他 MCP 客户端连接到该服务器时,他们可以使用get_weather工具检索任意位置的当前天气状况。

扩展服务器

您可以通过以下方式扩展此服务器:

  1. 添加更多与天气相关的工具(预报、历史数据等)
  2. 实现其他 MCP 功能,例如资源或提示
  3. 使用具有更多功能的不同天气 API

执照

麻省理工学院

-
security - not tested
-
license - not tested
-
quality - not tested

一个实现模型上下文协议的简单服务器,允许像 Claude 这样的 AI 模型使用 wttr.in API 获取任何位置的实时天气信息。

  1. What is MCP?
    1. Features
      1. Installation
        1. Usage
          1. Running the server
          2. Connecting to Claude Desktop
          3. Example prompts for Claude
        2. How it works
          1. Extending the server
            1. License
              ID: ib1cgxocu1