TMD Weather MCP Server

TMD Weather MCP Server

Provides weather data from the Thai Meteorological Department (TMD) with tools for querying stations, weather by province, and summaries, deployable via Docker or remote server.

Category
访问服务器

README

TMD Weather MCP Server

🌤️ Model Context Protocol Server สำหรับข้อมูลสภาพอากาศจากกรมอุตุนิยมวิทยา (TMD)

✨ Features

  • 🔧 5 MCP Tools สำหรับค้นหาข้อมูลสภาพอากาศ
  • 🌐 HTTP API พร้อม FastAPI documentation
  • 🐳 Docker Support พร้อม production-ready setup
  • 📊 Monitoring ด้วย Prometheus และ health checks
  • 🔒 Security พร้อม rate limiting และ SSL support
  • 🚀 Easy Deployment scripts สำหรับทุก platform

🛠️ MCP Tools

  1. get_all_stations - รายชื่อสถานีตรวจวัดอากาศทั้งหมด
  2. get_weather_by_province - ค้นหาข้อมูลตามจังหวัด
  3. get_weather_by_station - ค้นหาตามชื่อสถานี/รหัสสถานี
  4. get_stations_near_location - หาสถานีใกล้เคียงจากพิกัด
  5. get_weather_summary - สรุปสภาพอากาศทั่วประเทศ

🚀 Quick Start

Claude Desktop (Local)

# 1. Clone repository
git clone https://github.com/yourusername/tmd-weather-mcp.git
cd tmd-weather-mcp

# 2. Install dependencies
python quick_setup.py

# 3. Update Claude Desktop config
cp claude_desktop_config_fixed.json "%APPDATA%\Claude\claude_desktop_config.json"

# 4. Restart Claude Desktop

Docker (Local/Remote)

# Development
docker-compose up --build

# Production
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Remote Deployment

# Deploy to remote server
./deploy.sh --host YOUR_SERVER_IP --method files --prod

# Test deployment
./test-remote.sh YOUR_SERVER_IP

📡 API Endpoints

  • Health Check: GET /health
  • API Docs: GET /docs
  • MCP Tools: GET /mcp/tools
  • Weather Summary: POST /api/weather/summary

🌐 Live Demo

หลังจาก deploy แล้ว:

  • API Documentation: http://your-server/docs
  • Health Status: http://your-server/health
  • MCP Tools List: http://your-server/mcp/tools

🔧 Configuration

Environment Variables

MCP_TRANSPORT=http          # http or stdio
HOST=0.0.0.0               # Server host
PORT=8000                  # Server port
CACHE_DURATION=300         # Cache duration (seconds)
LOG_LEVEL=INFO            # Logging level

Claude Desktop HTTP Config

{
  "mcpServers": {
    "tmd-weather-remote": {
      "command": "curl",
      "args": ["-s", "http://YOUR_SERVER/mcp/tools"],
      "description": "Remote TMD Weather MCP Server"
    }
  }
}

📊 Data Source

ข้อมูลสภาพอากาศจาก กรมอุตุนิยมวิทยา (TMD)

  • Real-time weather data
  • 100+ monitoring stations
  • Temperature, humidity, pressure, wind, rainfall
  • Updated every hour

🐳 Docker Deployment

Development

docker-compose up --build

Production

# Full stack with nginx, monitoring
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Management Commands

./docker-manage.sh up      # Start services
./docker-manage.sh down    # Stop services  
./docker-manage.sh logs    # View logs
./docker-manage.sh health  # Health check
./docker-manage.sh status  # Service status

🌍 Remote Deployment

Prerequisites

# Run on target server
curl -fsSL https://raw.githubusercontent.com/yourusername/tmd-weather-mcp/main/setup-target-server.sh | bash

Deploy Methods

1. File Transfer (Recommended)

./deploy.sh --host 192.168.1.100 --method files --prod

2. Docker Registry

./deploy.sh --host my-server.com --method docker --registry docker.io/myuser

3. Git Clone

./deploy.sh --host 10.0.0.50 --method git

📱 Management Scripts

  • deploy.sh / deploy.bat - Automated deployment
  • docker-manage.sh / docker-manage.bat - Container management
  • test-remote.sh - Remote server testing
  • setup-target-server.sh - Target server preparation

🔒 Security Features

  • Rate limiting (10 req/s)
  • CORS protection
  • Security headers
  • SSL/TLS support
  • Container security (non-root user)
  • Network isolation

📊 Monitoring

  • Health Checks: /health endpoint
  • Prometheus Metrics: Port 9090 (production)
  • Log Aggregation: ./logs/ directory
  • Resource Monitoring: Docker stats
  • Alert Scripts: Custom health checks

🚨 Troubleshooting

Common Issues

# Check service status
./docker-manage.sh status

# View logs
./docker-manage.sh logs

# Health check
curl http://localhost/health

# Test API
curl http://localhost/mcp/tools

Debug Commands

# Container logs
docker-compose logs tmd-weather-mcp

# Execute inside container  
docker-compose exec tmd-weather-mcp bash

# Network connectivity
curl -I http://localhost:8000/health

📄 File Structure

tmd-weather-mcp/
├── 🐍 Python Core
│   ├── tmd_weather_server.py      # MCP Server (stdio)
│   ├── tmd_weather_http_server.py # HTTP Server  
│   ├── weather_api.py             # TMD API client
│   ├── weather_models.py          # Data models
│   └── requirements.txt           # Dependencies
├── 🐳 Docker
│   ├── Dockerfile                 # Container definition
│   ├── docker-compose.yml         # Development setup
│   ├── docker-compose.prod.yml    # Production setup
│   ├── nginx.conf                 # Nginx config
│   └── .dockerignore             # Docker ignore
├── 🚀 Deployment  
│   ├── deploy.sh                  # Linux/macOS deploy
│   ├── deploy.bat                 # Windows deploy
│   ├── setup-target-server.sh     # Server setup
│   └── test-remote.sh             # Remote testing
├── 🔧 Management
│   ├── docker-manage.sh           # Container management
│   ├── quick_setup.py             # Local setup
│   └── test_quick.py              # Local testing
└── 📚 Documentation
    ├── README.md                  # This file
    ├── DEPLOYMENT_GUIDE.md        # Deployment guide
    └── DOCKER_README.md           # Docker guide

🤝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • กรมอุตุนิยมวิทยา (TMD) - Weather data provider
  • Anthropic - Model Context Protocol
  • FastAPI - Web framework
  • Docker - Containerization platform

📞 Support


🌤️ Made with ❤️ for the Claude MCP ecosystem

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选