MCP Weather Server
A streamable HTTP MCP (Model Context Protocol) server for getting weather data via the Open-Meteo API.
π Features
Streamable HTTP Transport: Compatible with MCP 2025-03-26 specification
Session Management: Support for persistent sessions with unique IDs
Weather Tools: Three main tools for geolocation and weather data
REST API: Health endpoint for monitoring
π¦ Installation
π§ Configuration
The server uses the following environment variables:
PORT
: Listening port (default: 3000)
Example:
π οΈ Available MCP Tools
1. search_location
Search for GPS coordinates of a city or location by name.
Parameters:
city_name
(string): Name of the city or location to search forcountry
(string, optional): Country name to narrow the searchlimit
(number, optional): Maximum number of results to return (default: 5, max: 10)
Example response:
2. get_weather
Get current weather information for a location.
Parameters:
latitude
(number): Latitude in decimal degrees (-90 to 90)longitude
(number): Longitude in decimal degrees (-180 to 180)location_name
(string, optional): Optional location name for display
Example response:
3. stream_weather
Start streaming weather data with periodic updates.
Parameters:
latitude
(number): Latitude in decimal degrees (-90 to 90)longitude
(number): Longitude in decimal degrees (-180 to 180)location_name
(string, optional): Optional location name for displayinterval_seconds
(number, default: 60): Update interval in seconds
π HTTP Endpoints
Server Health
Returns server status:
MCP Endpoint
Main endpoint for MCP communications. Supports:
POST
: Initialization and request sendingGET
: SSE stream establishment for responsesDELETE
: Session termination
π Usage Example with MCP Client
1. Session Initialization
2. List Available Tools
3. Call Weather Tool
π§ͺ Testing
To test the server:
π Using MCP Inspector
You can use the official MCP Inspector to visually explore and test your weather server tools in a user-friendly interface.
Installation and Setup
Install MCP Inspector (requires Node.js):
npx @modelcontextprotocol/inspectorStart your weather server:
PORT=8080 npm startConfigure MCP Inspector:
Server URL:
http://localhost:8080/mcp
Transport:
HTTP (Streamable)
Protocol Version:
2024-11-05
Visual Interface Features
The MCP Inspector provides:
π οΈ Tools Explorer: Browse all available tools (
search_location
,get_weather
,stream_weather
)π Interactive Forms: Easy-to-use forms for entering tool parameters
π― Real-time Testing: Execute tools and see live responses
π Response Viewer: JSON-formatted results with syntax highlighting
π Session Management: Visual session state and connection status
π Request/Response History: Track all your API interactions
Example Workflow
Connect to your server using the Inspector
Explore the three available weather tools
Test location search:
Tool:
search_location
Parameters:
city_name: "Paris"
Get weather data:
Tool:
get_weather
Parameters: Use coordinates from previous search
Monitor streaming:
Tool:
stream_weather
Watch real-time weather updates
Benefits
No coding required: Test your MCP server without writing client code
Visual debugging: See exactly what data flows between client and server
Tool validation: Verify parameter schemas and response formats
Rapid prototyping: Quickly iterate on your MCP server implementation
The Inspector is particularly useful during development to ensure your weather server works correctly before integrating it into larger applications.
ποΈ Architecture
Express.js: HTTP server
MCP SDK: MCP protocol implementation with StreamableHTTPServerTransport
Open-Meteo API: Weather data source
TypeScript: Development language with compilation to JavaScript
π Specifications
MCP Protocol: Version 2024-11-05 and 2025-03-26
Transport: Streamable HTTP with SSE support
Data Format: JSON-RPC 2.0
Weather API: Open-Meteo
π Useful Links
π License
This project is a demonstration example based on open-meteo-mcp.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables users to search for location coordinates, retrieve current weather data, and stream real-time weather updates using the Open-Meteo API. Supports location search by city name and provides detailed weather information including temperature, wind speed, and weather conditions.