Weather MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather MCP Serverget the weather forecast for New York City"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather MCP Server
A Node.js Model Context Protocol (MCP) server that provides weather information tools using Streamable HTTP Transport.
Features
get-alerts: Get weather alerts for a US state
get-forecast: Get weather forecast for a location using latitude/longitude coordinates
HTTP Transport: Uses streamable HTTP instead of stdio for better scalability
Session Management: Supports multiple concurrent client sessions
Health Check: Built-in health monitoring endpoint
Related MCP server: Weather MCP Server
Setup
Install dependencies:
npm installBuild the TypeScript code:
npm run buildStart the HTTP server:
npm startThe server will start on port 3000 by default.
Usage
This server implements the Model Context Protocol using HTTP transport. It provides:
MCP Endpoint:
http://localhost:3000/mcpHealth Check:
http://localhost:3000/health
get-alerts
Get weather alerts for a US state.
Parameters:
state(string): Two-letter state code (e.g., "CA", "NY")
HTTP Example:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "mcp-session-id: your-session-id" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get-alerts",
"arguments": {
"state": "CA"
}
}
}'get-forecast
Get weather forecast for a location using coordinates.
Parameters:
latitude(number): Latitude (-90 to 90)longitude(number): Longitude (-180 to 180)
HTTP Example:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "mcp-session-id: your-session-id" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get-forecast",
"arguments": {
"latitude": 40.7128,
"longitude": -74.0060
}
}
}'MCP Client Configuration
Use this configuration in your MCP client:
{
"mcpServers": {
"weather": {
"transport": {
"type": "http",
"url": "http://localhost:3000/mcp"
}
}
}
}Development
Run in development mode:
npm run devTest the server:
npm testHealth check:
curl http://localhost:3000/healthTransport Features
Session Management: Each client gets a unique session ID
Concurrent Connections: Multiple clients can connect simultaneously
Server-Sent Events: Real-time notifications via GET requests
Session Termination: Clean session cleanup via DELETE requests
DNS Rebinding Protection: Disabled for local development (enable in production)
Security Note
For production deployments, enable DNS rebinding protection:
// In src/index.ts
enableDnsRebindingProtection: true,
allowedHosts: ['your-domain.com'],
allowedOrigins: ['https://your-domain.com'],Environment Variables
PORT: Server port (default: 3000)
API Endpoints
POST /mcp: Main MCP communication endpointGET /mcp: Server-to-client notifications (SSE)DELETE /mcp: Session terminationGET /health: Health check endpoint
Requirements
Node.js 18 or higher
TypeScript 5.5 or higher
Internet connection for weather API access
Directory Structure
weather-server/
├── src/
│ └── index.ts # Main HTTP server implementation
├── dist/ # Compiled JavaScript output
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── test.js # HTTP client test script
├── mcp-config.json # MCP client configuration
└── README.md # This fileRequirements
Node.js 18 or higher
TypeScript 5.5 or higher
Internet connection for weather API access
This server cannot be deployed
Maintenance
Related MCP Connectors
Get US weather forecasts, active alerts, and current observations.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides tools to fetch real-time weather data from the National Weather Service API, allowing users to retrieve weather alerts by state and detailed forecasts by coordinates.295 npmGPL 3.0
- AlicenseBqualityDmaintenanceProvides access to US National Weather Service data including active alerts by state and short-term forecasts for specific coordinates.2MIT
- FlicenseNot gradedqualityDmaintenanceProvides US weather alerts by state and forecasts by coordinates using the National Weather Service API.1-
- AlicenseNot gradedqualityDmaintenanceProvides US weather alerts and forecasts via the National Weather Service API.95 npmGPL 3.0