Cover image
天气麦克风服务器
Public

天气麦克风服务器

Try Now
2025-03-04

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

双源天气 MCP 服务器

这是一个基于 Model Context Protocol (MCP) 的天气服务器,使用和风天气和心知天气API提供天气数据,支持故障转移和优先获取最快响应。

功能

  • 查看当前天气 (作为资源提供)
  • 获取指定城市的当前天气 (工具)
  • 获取指定城市的天气预报 (工具)
  • 同时使用多个API源,自动选择最快响应的结果
  • 支持最低/最高温度、湿度和风速数据

安装

# 克隆仓库
git clone <repository-url>
cd weather-mcp-server

# 安装依赖
npm install

# 配置环境变量
cp .env.example .env
# 编辑 .env 文件,添加你的API密钥

API 密钥获取

和风天气 API

  1. 访问 和风天气开发服务
  2. 注册账号并创建应用
  3. 在控制台获取API Key

心知天气 API

  1. 访问 心知天气开发服务
  2. 注册账号并创建应用
  3. 在控制台获取API Key

开发

# 构建项目
npm run build

# 监视模式 (自动重新构建)
npm run watch

运行

npm start

MCP 模式说明

本服务器仅支持 Model Context Protocol (MCP) 模式运行,不提供HTTP服务器功能。MCP是一种专为大型语言模型设计的协议,允许模型与外部工具和资源进行交互。

MCP 服务器特点

  • 使用标准输入/输出 (stdio) 与客户端通信
  • 提供资源和工具供大型语言模型使用
  • 支持结构化数据交换和错误处理

可用资源

  • weather://{city} - 获取指定城市的当前天气

可用工具

  • getCurrentWeather - 获取指定城市的当前天气
  • getForecast - 获取指定城市的天气预报(支持1-7天)

在 Claude Desktop 中配置

编辑 Claude Desktop 配置文件:

// macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
// Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["你的完整路径/weather-mcp-server/build/index.js"],
      "env": {
        "QWEATHER_API_KEY": "你的和风天气API密钥",
        "SENIVERSE_API_KEY": "你的心知天气API密钥"
      }
    }
  }
}

调试

查看 MCP 的日志:

# macOS
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

使用 MCP Inspector 调试

npx @modelcontextprotocol/inspector node 你的完整路径/weather-mcp-server/build/index.js

然后在浏览器中访问 http://localhost:5173

故障转移机制

此服务器同时使用多个天气API源:

  1. 首先并行向和风天气和心知天气发送请求
  2. 采用最先返回响应的API结果
  3. 如果某个API失败,会自动使用另一个API的结果
  4. 所有API都失败时才会返回错误

技术文档

详细的技术文档可在 docs 目录中找到:

贡献

欢迎提交问题和拉取请求。

效果

alt text

许可

MIT

相关推荐

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

  • 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

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

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

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

  • Khalid kalib
  • Write professional emails

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

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

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

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

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

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

    Reviews

    4 (1)
    Avatar
    user_qyzgQlaj
    2025-04-15

    I've been using the bilibili-api-mcp-server by njhzqj for a while now and it has significantly enhanced my workflow. The server is reliable, easy to integrate, and provides seamless access to Bilibili's API. Whether you are a developer or content creator, this tool is a must-have for efficient and effective data handling. Kudos to njhzqj for creating such a powerful server! Check it out here: https://mcp.so/server/bilibili-api-mcp-server/njhzqj