Skip to main content
Glama
SandroSD

MCP Weather Server

by SandroSD

MCP Weather Server (Node.js)

This repository contains a fully-featured MCP (Model Context Protocol) server built with Node.js and TypeScript that exposes weather-related tools using the US National Weather Service API.


Table of Contents


Overview

This MCP server provides two main tools:

  • get_alerts - Retrieve current weather alerts for any US state (by two-letter state code)

  • get_forecast - Get detailed weather forecast by geographic coordinates

It follows the Model Context Protocol standards to be compatible with clients such as Claude for Desktop and allows seamless LLM-driven interactions.


Features

  • Typed requests and responses using zod schemas for argument validation

  • Asynchronous API requests with error handling

  • Modular tool definitions for scalable code architecture

  • Environment variable configuration for flexible deployments

  • Integration-ready with popular MCP client tools and MCP Inspector for debugging


Tech Stack

  • Node.js (v18+)

  • TypeScript

  • Zod for schema validations

  • httpx or node-fetch for HTTP requests

  • dotenv for environment configuration

  • MCP SDK (JavaScript/TypeScript)

  • Optional: ts-node or build with tsc


Getting Started

Prerequisites

  • Node.js 18 or higher

  • npm or yarn

Available Tools

2 tools
get_alertsC

Get weather alerts for a state

ParametersJSON Schema
NameRequiredDescriptionDefault
stateYesTwo-letter state code (e.g. CA, NY)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't mention any behavioral traits such as rate limits, authentication needs, response format, or error handling. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., alert types, severity levels, timeframes) or any behavioral context needed for effective use, which is insufficient for a tool with no structured support.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, fully documenting the single parameter 'state' with its format and constraints. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('weather alerts for a state'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling tool 'get_forecast', which likely provides different weather data, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_forecast'. It lacks any context about prerequisites, exclusions, or comparative use cases, leaving the agent to infer usage based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_forecastC

Get weather forecast for a location

ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYesLatitude of the location
longitudeYesLongitude of the location

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but lacks critical details like whether this is a read-only operation, potential rate limits, authentication requirements, or what the forecast output includes (e.g., time range, weather elements).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the forecast returns (e.g., temperature, precipitation, timeframe), behavioral constraints, or how it differs from the sibling tool, leaving significant gaps in understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds no additional parameter information beyond implying location-based input, so it meets the baseline score when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'weather forecast for a location', making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling tool 'get_alerts', which likely serves a related but distinct function in weather data retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'get_alerts'. There's no mention of prerequisites, alternatives, or specific contexts where this tool is preferred, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • First observedget_alerts
    • First observedget_forecast

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: get_alerts retrieves weather alerts for a state, while get_forecast provides weather forecasts for a location. There is no overlap or ambiguity between them, making it easy for an agent to select the correct tool based on the need for alerts versus forecasts.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern with 'get_' prefix and descriptive nouns (alerts, forecast). This naming convention is predictable and readable, ensuring clarity and ease of use across the tool set.

Tool Count2/5

With only 2 tools, the server feels under-scoped for a weather domain, as it lacks essential operations like current conditions, historical data, or radar information. While the tools are well-defined, the count is too low to provide comprehensive coverage for typical weather-related tasks.

Completeness2/5

The tool surface is significantly incomplete for a weather server. It includes alerts and forecasts but misses core functionalities such as current weather conditions, historical data, or location-based searches. This will likely cause agent failures when handling broader weather queries.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors