|
| 1 | +<div align="center"> |
| 2 | +<img alt="example output template" src="./assets/weather.svg"> |
| 3 | + |
| 4 | +<h1>Weather API MCP Server</h1> |
| 5 | + |
| 6 | +[](LICENSE) |
| 7 | +[](go.mod) |
| 8 | +[](https://goreportcard.com/report/github.com/TuanKiri/weather-mcp-server) |
| 9 | + |
| 10 | +<strong>[Report Bug](https://github.com/TuanKiri/weather-mcp-server/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml)</strong> | <strong>[Request Feature](https://github.com/TuanKiri/weather-mcp-server/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml)</strong> |
| 11 | + |
| 12 | +</div> |
| 13 | + |
| 14 | +A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. |
| 15 | + |
| 16 | +<div align="center"> |
| 17 | +<img alt="demo example" src="./assets/weather.gif" width="480"> |
| 18 | +</div> |
| 19 | + |
| 20 | +## Installing on Claude Desktop |
| 21 | + |
| 22 | +To use your MCP server with Claude Desktop, add it to your Claude configuration: |
| 23 | + |
| 24 | +```json |
| 25 | +{ |
| 26 | + "mcpServers": { |
| 27 | + "weather-mcp-server": { |
| 28 | + "command": "/path/to/weather-mcp-server", |
| 29 | + "args": [], |
| 30 | + "env": { |
| 31 | + "WEATHER_API_KEY": "your-api-key" |
| 32 | + } |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +You can get your API key in your personal account at [weatherapi](https://www.weatherapi.com/my/). |
| 39 | + |
| 40 | +## Build from source |
| 41 | + |
| 42 | +You can use `go` to build the binary in the `cmd/github-mcp-server` directory. |
| 43 | + |
| 44 | +```shell |
| 45 | +go build -o weather-mcp-server ./cmd/weather-mcp-server |
| 46 | +``` |
| 47 | + |
| 48 | +## Tools |
| 49 | + |
| 50 | +- **current_weather** - Gets the current weather for a city |
| 51 | + |
| 52 | + - `city`: The name of the city (string, required) |
| 53 | + |
| 54 | +## Project Structure |
| 55 | + |
| 56 | +The project is organized into several key directories: |
| 57 | + |
| 58 | +```shell |
| 59 | +├── cmd |
| 60 | +│ └── weather-mcp-server |
| 61 | +├── internal |
| 62 | +│ └── server |
| 63 | +│ ├── handlers # MCP handlers |
| 64 | +│ ├── services # Business logic layer |
| 65 | +│ │ ├── core # Core application logic |
| 66 | +│ │ └── mock # Mock services for testing |
| 67 | +│ ├── tools # MCP tools |
| 68 | +│ └── view # Templates for displaying messages |
| 69 | +└── pkg |
| 70 | +``` |
| 71 | + |
| 72 | +## Contributing |
| 73 | + |
| 74 | +Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help! |
| 75 | + |
| 76 | +Please follow the [contribution guidelines](.github/CONTRIBUTING.md). |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +This MCP server is licensed under the MIT License. |
0 commit comments