SkyH34D/weather-mcp
If you are the rightful owner of weather-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
Weather MCP Server is a TypeScript-based implementation of a Model Context Protocol (MCP) server that provides daily weather forecasts for any city using Open-Meteo APIs.
🌤️ Weather MCP Server
Weather MCP Server is a TypeScript-based implementation of a Model Context Protocol (MCP) server. It provides a streamlined interface to retrieve daily weather forecasts for any city using public APIs from Open-Meteo.
This project serves as a clear example of how MCP servers can expose custom tools that integrate with external APIs, providing structured data to MCP clients.
✨ Key Features
| Feature | Description |
|---|---|
| MCP Integration | Uses @modelcontextprotocol/sdk for seamless MCP handling. |
| Zod Validation | Runtime validation of tool parameters. |
| Stdio Transport | Communicates through standard input/output streams. |
| External APIs | Fetches real-time weather data using Open-Meteo APIs. |
📋 Requirements
- Node.js ≥ 18 (ESM & top-level
awaitsupport) - npm, yarn, or pnpm for dependency management
🚀 Quick Start
Installation
git clone https://github.com/yourusername/weather-mcp-server.git
cd weather-mcp-server
# Install dependencies
npm install # or yarn install / pnpm install
Run the Server
npm run start # or use your preferred method (e.g., ts-node main.ts)
The server listens on standard input/output for MCP messages.
Example Tool Call
Request:
{
"tool": "fetch-weather",
"params": { "city": "Madrid" }
}
Response:
{
"content": [
{
"type": "text",
"text": "{\n \"daily\": {\n \"temperature_2m_max\": [26.4],\n \"temperature_2m_min\": [15.1]\n }\n}"
}
]
}
🗂️ Project Structure
weather-mcp-server/
├── main.ts # Entry point for the MCP server
├── package.json
├── pnpm-lock.yaml
└── node_modules/
⚙️ How It Works
The MCP Server operates through the following process:
- Initialization: MCP Server is instantiated with a name and version.
- Tool Definition: Tools are defined with unique identifiers, descriptions, parameter schemas validated by Zod, and asynchronous handlers.
- API Integration: When invoked,
fetch-weathercalls Open-Meteo APIs to obtain geographic and weather data for a city. - Communication: Utilizes
StdioServerTransportfor communication between the server and MCP clients.
🚧 TODO / Future Ideas
- Integrate additional APIs for extended functionalities (e.g., timezone, air quality).
- Expand transport capabilities (e.g., WebSockets, HTTP).
- Implement comprehensive test suites.
📄 License
MIT License. See for more information.