MCP Weather Server
Exposes weather forecast APIs as MCP tools, allowing LLMs to retrieve current weather conditions and multi-day forecasts for any location using latitude and longitude coordinates.
README
MCP Weather Server
A lightweight, self‑hosted Model Context Protocol (MCP) server that exposes your weather‑forecast API as MCP tools.
This allows LLMs and agent frameworks to call your weather data directly through a standardized interface.
Clients run this server inside their own environment and connect it to their preferred MCP‑compatible LLM (e.g., Claude Desktop, Cursor, etc.).
🚀 Features
- MCP‑compatible WebSocket server
- Tools for:
- Current weather by latitude/longitude
- Multi‑day forecast
- JSON Schema–validated tool inputs
- Simple configuration via environment variables
- No external dependencies required to run the server (beyond Node.js)
- Ready for Docker, CI, and cloud deployment
📦 Project Structure
``` mcp-weather-server/ ├── src/ │ ├── api/ # Weather API client wrapper │ ├── tools/ # MCP tool implementations │ ├── schemas/ # JSON Schemas for tool inputs │ ├── types/ # MCP type definitions │ ├── server.ts # MCP WebSocket server │ ├── config.ts # Environment config loader │ └── index.ts # Entrypoint ├── test/ # Jest test placeholders ├── sdk-js/ # Optional JS SDK (client helper) ├── package.json ├── tsconfig.json ├── .env.example └── README.md ```
🛠️ Requirements
- Node.js 20+
- A valid API key for your weather service
- Access to your weather API base URL
⚙️ Configuration
Copy the example environment file:
```bash cp .env.example .env ```
Then edit `.env`:
``` WEATHER_API_KEY=your_api_key_here WEATHER_API_URL=https://api.yourweather.com PORT=3001 LOG_LEVEL=info ```
▶️ Running the Server
Development mode
```bash npm run dev ```
Build & run
```bash npm run build npm start ```
The server will start on:
``` ws://localhost:3001 ```
🌤️ Available MCP Tools
`getCurrentWeather`
Retrieve current weather conditions for a specific latitude/longitude.
Input:
```json { "lat": 38.9, "lon": -77.0 } ```
Output (example):
```json { "summary": "Current weather at (38.9, -77)", "data": { ... } } ```
`getForecast`
Retrieve a multi‑day forecast for a location.
Input:
```json { "lat": 38.9, "lon": -77.0, "days": 5 } ```
Output (example):
```json { "summary": "5‑day forecast for (38.9, -77)", "data": { ... } } ```
🧪 Testing
```bash npm test ```
🐳 Docker (Optional)
A Dockerfile is included.
Build:
```bash docker build -t mcp-weather-server . ```
Run:
```bash docker run -p 3001:3001 \ -e WEATHER_API_KEY=your_api_key \ -e WEATHER_API_URL=https://api.yourweather.com \ mcp-weather-server ```
🔒 Security Notes
- Host this server inside your network or VPC
- Protect access with firewall rules or mTLS if exposing externally
- Rotate API keys regularly
- Avoid exposing your weather API key in logs or client‑side code
📄 License
MIT License.
Feel free to fork, modify, and integrate into your own systems.
🤝 Contributing
Pull requests and issues are welcome.
If you extend the toolset or add new weather endpoints, feel free to contribute back.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.