MCP cover image
天气麦克风服务器 logo
Public

天气麦克风服务器

See in Github
2025-04-01

FastMCP构建的天气查询MCP服务器

1

Github Watches

0

Github Forks

0

Github Stars

天气 MCP 服务器

这是一个基于 FastMCP 构建的天气查询服务器,提供城市天气信息查询服务。

功能特点

  • 支持全球城市天气查询
  • 提供温度、湿度和天气描述信息
  • 支持摄氏度和华氏度温度单位切换
  • 基于 Model Context Protocol (MCP) 实现
  • 完整的日志记录

安装要求

  • Python 3.8+
  • OpenWeatherMap API 密钥
  • uv (Python 包管理工具)

快速开始

  1. 克隆仓库:
git clone <repository-url>
cd weather-mcp-server
  1. 安装依赖:
make install
  1. 设置环境变量: 创建 .env 文件并添加以下内容:
OPENWEATHER_API_KEY=你的OpenWeatherMap_API密钥
  1. 运行服务器:
make run

安装和使用

选项 1:使用 uvx(推荐)

使用 uvx 将自动从 PyPI 安装包,无需克隆仓库。将以下配置添加到 Claude Desktop 的配置文件 claude_desktop_config.json 中:

{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "uvx",
      "args": [
        "weather-mcp-server"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "你的OpenWeatherMap_API密钥"
      }
    }
  }
}

选项 2:本地开发模式

  1. 克隆仓库并安装依赖:
git clone <repository-url>
cd weather-mcp-server
make install
  1. 设置环境变量: 创建 .env 文件并添加以下内容:
OPENWEATHER_API_KEY=你的OpenWeatherMap_API密钥
  1. 在 Claude Desktop 配置文件中添加:
{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "path/to/src/weather_mcp_server",
        "run",
        "weather-mcp-server"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "你的OpenWeatherMap_API密钥"
      }
    }
  }
}

配置文件位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

重启 Claude Desktop 以加载新的 MCP 服务器。

开发

本项目使用 Makefile 来简化常用命令。

可用命令

make install  # 安装依赖
make format   # 格式化代码
make lint     # 运行代码检查
make clean    # 清理临时文件
make run      # 运行服务器

发布新版本

make release version=v0.1.0

MCP 工具

服务器提供以下 MCP 工具:

get_weather

获取指定城市的天气信息。

参数:

  • city: 城市名称(必填)
  • units: 温度单位(可选,默认为 "metric")
    • "metric": 摄氏度
    • "imperial": 华氏度

示例请求:

{
    "name": "get_weather",
    "kwargs": {
        "city": "Beijing",
        "units": "metric"
    }
}

示例响应:

{
    "temperature": 20.5,
    "humidity": 65,
    "description": "晴",
    "city": "Beijing"
}

现在您可以通过 Claude 使用自然语言命令与天气服务进行交互,例如:

  • "查看北京的天气"
  • "东京现在的温度是多少"
  • "伦敦的天气情况如何"

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • modelcontextprotocol
  • 模型上下文协议服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • open-webui
  • 用户友好的AI接口(支持Ollama,OpenAi API,...)

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

    Reviews

    1 (1)
    Avatar
    user_HeAXZDj5
    2025-04-16

    I have been a dedicated user of weather-mcp-server by qianyan for a while now, and it has been an invaluable tool for my projects. The server is robust and well-maintained, seamlessly delivering accurate weather data which is crucial for my applications. The documentation is clear, and the setup was straightforward, making it easy to integrate. Highly recommend to anyone needing reliable weather information. Check it out at: https://github.com/qianyan/weather-mcp-server