mcp-weather-api
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Weather MCP Server
A Model Context Protocol (MCP) server that provides weather data tools for AI assistants and applications. This server integrates with the National Weather Service (NWS) API to deliver real-time weather forecasts and alerts for locations within the United States.
Features
Weather Forecasts: Get detailed weather forecasts for any US location using latitude/longitude coordinates
Weather Alerts: Retrieve active weather alerts for any US state
NWS Integration: Direct integration with the official National Weather Service API
MCP Protocol: Built using the Model Context Protocol SDK for seamless AI assistant integration
Related MCP server: Weather MCP Server
Installation
Prerequisites
Node.js 18+
npm or yarn
Setup
Clone the repository:
git clone <repository-url>
cd weather-mcpInstall dependencies:
npm installBuild the project:
npm run build:serverUsage
Running the MCP Server
Start the server:
npm run start:serverThe server runs on stdio and is designed to be used with MCP-compatible AI assistants like Claude Desktop.
Available Tools
The server provides two main tools:
1. get-forecast
Retrieve weather forecast for a specific location.
Parameters:
latitude(number): Latitude of the location (-90 to 90)longitude(number): Longitude of the location (-180 to 180)
Example Usage:
// Get forecast for San Francisco
{
"tool": "get-forecast",
"parameters": {
"latitude": 37.7749,
"longitude": -122.4194
}
}2. get-alerts
Retrieve active weather alerts for a US state.
Parameters:
state(string): Two-letter state code (e.g., "CA", "NY", "TX")
Example Usage:
// Get alerts for California
{
"tool": "get-alerts",
"parameters": {
"state": "CA"
}
}Integration with AI Assistants
Claude Desktop Integration
To integrate with Claude Desktop, add the following to your Claude Desktop configuration:
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/path/to/weather-mcp/dist/core/server/index.js"]
}
}
}Other MCP-Compatible Applications
This server follows the Model Context Protocol specification and can be integrated with any MCP-compatible application. The server communicates via stdio using the MCP protocol.
API Data Sources
This server uses the following National Weather Service endpoints:
Forecasts:
https://api.weather.gov/points/{lat},{lon}and associated forecast URLsAlerts:
https://api.weather.gov/alerts?area={STATE}
Coverage
Forecasts: All US territories and locations
Alerts: All US states and territories (using two-letter state codes)
Development
Project Structure
src/
├── core/
│ ├── constants/ # API endpoints and configuration
│ ├── interfaces/ # TypeScript type definitions
│ ├── utils/ # Utility functions for API calls and formatting
│ ├── server/ # Server bootstrap and transport setup
│ └── index.ts # Main MCP server implementation
└── client/ # (Empty - for future client implementations)Building
The project uses TypeScript and compiles to the dist/ directory:
npm run build:serverAdding New Tools
To add new weather-related tools:
Define the tool schema in
src/core/index.tsImplement the tool handler function
Add any necessary interfaces in
src/core/interfaces/index.tsAdd utility functions in
src/core/utils/index.tsif needed
Example:
server.tool(
"tool-name",
"Tool description",
{
param1: z.string().describe("Parameter description"),
},
async ({ param1 }) => {
// Implementation
return {
content: [
{
type: "text",
text: "Result",
},
],
};
}
);Error Handling
The server includes comprehensive error handling:
API Failures: Graceful handling of NWS API errors with informative messages
Invalid Coordinates: Validation for latitude/longitude bounds
Missing Data: Proper handling when forecast or alert data is unavailable
Network Issues: Timeout and connection error handling
Dependencies
@modelcontextprotocol/sdk: MCP server implementation
@anthropic-ai/sdk: Anthropic SDK (for potential future features)
zod: Runtime type validation
dotenv: Environment variable management
License
ISC License
Contributing
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Submit a pull request
Support
For issues and questions:
Check the National Weather Service API documentation for data availability
Ensure your coordinates are within US territories for forecasts
Verify state codes are valid two-letter abbreviations for alerts
Limitations
US Only: The NWS API only provides data for US territories
Rate Limits: Subject to National Weather Service API rate limits
Data Availability: Some remote locations may not have detailed forecast data
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
US NWS weather alerts and 5-day forecasts for AI agents. $0.01 per call.
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.
Get US weather forecasts, active and recent alerts, and current observations.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to access real-time US weather forecasts and alerts through the National Weather Service API.211 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables users to get weather forecasts and alerts for any US city and state through natural language queries using the National Weather Service API.-
- FlicenseBqualityDmaintenanceProvides real-time US weather alerts and forecasts by integrating with the National Weather Service API. It enables AI assistants to fetch state-specific alerts and detailed local forecasts using geographic coordinates.21-
- FlicenseNot gradedqualityDmaintenanceProvides real-time weather alerts and forecasts from the National Weather Service for US locations, integrating with AI assistants via the Model Control Protocol.-