Content
# Weather Briefing MCP Server
A MCP server for obtaining weather briefing information from China Meteorological Administration.
## Features
- Get current typhoon warning information (only returns if there are warnings within 3 days)
- Get current daily weather briefing
- Get current important weather bulletins
- Automatically convert webpage content to Markdown format
- File management (saved in project temp directory, cleaned before each execution)
- Automatically download and save images locally
- Intelligent content cleaning (remove meaningless characters, HTML entities, etc.)

## Data Source
- **National Meteorological Center of China nmc.cn**
## Quick Start
### One-Click Installation (Recommended)
```bash
./setup.sh
```
The script will automatically create a virtual environment and install dependencies, and display configuration information after completion.
### Cherry Studio Configuration
**Recommended method (using startup script):**
- Command: `/full/path/weather-briefing/start-mcp.sh`
- Parameters: Leave blank
**Or use venv Python directly:**
- Command: `/full/path/weather-briefing/venv/bin/python`
- Parameters: `["/full/path/weather-briefing/wb_mcpserver.py"]`
### Claude Desktop Configuration
**Recommended method (using startup script):**
```json
{
"mcpServers": {
"weather-briefing": {
"command": "/full/path/weather-briefing/start-mcp.sh"
}
}
}
```
**Or use venv Python directly:**
```json
{
"mcpServers": {
"weather-briefing": {
"command": "/full/path/weather-briefing/venv/bin/python",
"args": ["/full/path/weather-briefing/wb_mcpserver.py"]
}
}
}
```
## Usage
After configuration, in Cherry Studio or Claude Desktop, you can:
- Ask: "Please get typhoon warning information" - Call `get_typhoon_warning` tool
- Ask: "Please get daily weather briefing" - Call `get_daily_weather_briefing` tool
- Ask: "Please get important weather bulletins" - Call `get_important_bulletin` tool
Each tool will return independent Markdown format content, including text and local images.
## Testing
```bash
# Test core functionality
python3 test_server.py
# Test full process
python3 run_server.py
```
## Troubleshooting
### Connection closed error
Indicates that dependencies are not installed or scripts cannot be executed. Solution:
- Run `./setup.sh` to create a virtual environment and install dependencies
- Or manually install: `pip3 install -r requirements.txt`
### Why use a virtual environment?
- macOS system protects system Python, does not allow direct package installation
- Virtual environment is a best practice for Python development, avoids package conflicts
- Using `start-mcp.sh` script simplifies configuration
### Command not found
- Check if the path is correct (use absolute path)
- Ensure the script has execution permissions: `chmod +x start-mcp.sh`
### Network issues
- Ensure access to China Meteorological Administration website
- Check firewall settings
## Technical Details
### Available Tools
- `get_typhoon_warning`: Get typhoon warning information (only returns information within 3 days)
- `get_daily_weather_briefing`: Get daily weather briefing
- `get_important_bulletin`: Get important weather bulletins
### Special Handling Logic
- Typhoon information only returns if published within 3 days, avoiding outdated information
- Files saved in project temp directory, images saved in temp/attachments/{typhoon|daily|bulletin} directory
- Images use MD5 naming to prevent conflicts
- Clean temp directory before each execution, retaining latest data
- Automatically extract webpage content, filter navigation, ads, and other irrelevant information
- Intelligent cleaning of Markdown content:
- Replace HTML entities (` ` etc.)
- Remove extra asterisks and blank lines
- Automatically add title format
### File Structure
```
weather-briefing/
├── wb_mcpserver.py # MCP server main program
├── start-mcp.sh # Startup script (recommended)
├── setup.sh # One-click installation script
├── requirements.txt # Python dependencies
├── venv/ # Virtual environment directory
└── temp/ # Temporary file directory
├── typhoon.md # Typhoon warning Markdown
├── daily.md # Daily weather briefing Markdown
├── bulletin.md # Important weather bulletins Markdown
└── attachments/ # Image directory
├── typhoon/ # Typhoon images
├── daily/ # Daily weather images
└── bulletin/ # Important weather images
```
### Dependencies
- mcp: MCP protocol support
- httpx: HTTP client
- beautifulsoup4: HTML parsing
- markitdown: HTML to Markdown conversion
## Development Notes
If you need to modify or extend functionality:
1. Modify `WEATHER_SOURCES` dictionary to add new data sources
2. Adjust `extract_main_content` method to improve content extraction
3. Modify `is_typhoon_recent` method to adjust typhoon information timeliness judgment
4. Adjust `clean_markdown` method to customize content cleaning rules