Token导航 LogoToken导航TokenDH.com
Weather Py logo
AI代理stdio官方级别未说明来源级核验

Weather Py

MCP Server

一个基于MCP协议的生产级天气数据服务器,提供来自国家气象局API的天气数据,具有缓存、监控、健壮的错误处理和全面的测试功能。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
位置天气PythonClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

srjv11

提供方

srjv11

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run weather-mcp

详细介绍

气象MCP服务器

![Build Status](https://github.com/srjv11/mcp-server-weather-py/actions) ![Coverage](https://github.com/srjv11/mcp-server-weather-py) ![Python 3.13](https://www.python.org/downloads/) ](https://hub.docker.com/) ![MCP](https://modelcontextprotocol.io/)

一个全面的、可用于生产的MCP(模型上下文协议)服务器,提供来自美国国家气象局API的天气数据,包括缓存、监控、强大的错误处理和全面的测试。

🚀 快速开始

# Install dependencies
uv sync --group dev

# Run the weather MCP server
uv run weather-mcp
# or
uv run -m src.main

# Run tests
uv run pytest tests/ -v

# Run code quality checks
ruff check --fix && ruff format

📁 项目结构

mcp-server-weather-py/
├── 📄 Core Application
│   └── src/
│       ├── main.py              # Main entry point
│       ├── client.py            # HTTP client with caching
│       ├── config.py            # Configuration management
│       ├── exceptions.py        # Custom exception classes
│       ├── formatters.py        # Data formatting utilities
│       ├── models.py            # Data models and types
│       ├── tools.py             # MCP tools implementation
│       ├── validators.py        # Input validation
│       └── weather.py           # Alternative entry point
│
├── 🧪 Testing & Quality
│   └── tests/
│       ├── test_client.py       # HTTP client tests
│       ├── test_config.py       # Configuration tests
│       ├── test_exceptions.py   # Exception handling tests
│       ├── test_formatters.py   # Data formatting tests
│       ├── test_models.py       # Data model tests
│       ├── test_tools.py        # MCP tools tests
│       ├── test_validators.py   # Validation tests
│       └── test_weather.py      # Main module tests
│
├── 🐳 Deployment
│   ├── Dockerfile               # Container configuration
│   ├── docker-compose.yml       # Multi-service orchestration
│   └── .dockerignore            # Container build optimization
│
├── 📚 Configuration & Documentation
│   ├── pyproject.toml           # Package configuration & dependencies
│   ├── CLAUDE.md                # Development guide
│   ├── MCP_SETUP.md             # MCP integration guide
│   └── docs/README_ENHANCED.md  # Detailed enhancement documentation
│
└── 📄 Examples & Utilities
    ├── examples.py              # Usage examples & demos
    ├── example_state_machine.py # Educational state machine example
    └── setup_script.py          # Setup automation script

✨ 特性

  • 🛡️ 稳健的错误处理:具有重试逻辑的自定义异常层次结构
  • ⚡ 演出:具有TTL和速率限制的内存缓存
  • 📊 监控:健康检查和结构化日志记录
  • 🧪 综合测试:8个模块的测试覆盖率超过95%
  • 🐳 生产就绪:Docker支持和部署配置
  • 🔧 可配置的:基于环境的配置
  • 🌐 MCP集成:已准备好集成Claude Code

🛠️ api参考

核心MCP工具

  • get_alerts(state, severity_filter=None):通过可选的严重性过滤获取天气警报
  • get_forecast(latitude, longitude):获取特定坐标的天气预报
  • get_location_forecast(city, state):按城市和州获取天气预报
  • health_check():检查服务器运行状况和性能指标

🧪 测试

# Run all tests with coverage
uv run pytest tests/ -v --cov=. --cov-report=html

# Run specific test modules
uv run pytest tests/test_validators.py -v
uv run pytest tests/test_tools.py -v

测试覆盖率:8个模块的46个测试,涵盖验证、数据模型、HTTP客户端、MCP工具、格式化、异常和配置。

🐳 部署

地方发展

uv sync --group dev
uv run weather-mcp

Docker部署

docker build -t weather-mcp .
docker run -it weather-mcp

使用Docker Compose进行生产

docker-compose up -d

🔗 MCP集成

连接到Claude Code进行交互式天气查询。看 MCP_SETUP.md 有关完整的设置说明。

📚 文档

快速参考

  • CLAUDE.md:包含命令和架构细节的开发指南
  • MCP_SETUP.md:Claude Code集成说明
  • examples.py:交互式使用演示

综合文档

- 安装指南 - api参考 - 配置 - - 故障排除

______________________________________________________________________

气象MCP服务器 -大型语言模型的生产就绪天气数据🌤️

目录标签

目录标签

位置天气PythonClaude天气数据本地部署MCP协议数据缓存API服务气象服务

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP