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 henry@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
await
support) - 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-weather
calls Open-Meteo APIs to obtain geographic and weather data for a city. - Communication: Utilizes
StdioServerTransport
for 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.