Skip to main content
Glama
Yachitha

Weather MCP Server

by Yachitha

MCP Server – Weather MCP Server

This project implements an MCP server built using the Model Context Protocol. It follows the “Build an MCP server” tutorial and provides custom tools for your application.

Table of Contents

Related MCP server: Weather MCP Server

What this does

This server exposes MCP tools that can be called by MCP clients (such as the Claude for Desktop client) to perform specific operations.
In the tutorial you followed, the example implements two tools: get_alerts(state) and get_forecast(latitude, longitude).
In your version, you may have modified or added tools according to your use-case.

Prerequisites

  • Python 3.10 or higher (or whichever version you used)

  • MCP SDK version ≥ 1.2.0 (for Python) as described.

  • (If applicable) uv tool (or equivalent) for running the server.

  • Internet connection (if the tools query external APIs).

  • For integration with Claude for Desktop: ensure you have the client installed and configured correctly.

Installation

  1. Clone this repository:

    git clone <repo-url>
    cd <repo-name>
  2. Create and activate a virtual environment:

    source .venv/bin/activate   # (on macOS/Linux)
    # or on Windows: .venv\Scripts\activate
  3. Install dependencies:

    pip install mcp[cli] httpx

Usage

To start the MCP server:

uv run <server_file>.py

or if you don’t use uv, simply:

python <server_file>.py

The server will start listening for MCP host messages (via stdio or HTTP depending on your transport).

If you’re integrating with Claude for Desktop, update your claude_desktop_config.json like this:

{
  "mcpServers": {
    "<server-name>": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/PARENT/FOLDER/<server-dir>",
        "run",
        "<server_file>.py"
      ]
    }
  }
}

Then restart Claude for Desktop to pick up this configuration.

Tools / Endpoints

Below are the tools exposed by the server:

get_alerts(state: str) -> str

Gets weather alerts for a US state (2-letter code, e.g., “CA”, “NY”). Returns a formatted string of alerts or an informative message if none available.

get_forecast(latitude: float, longitude: float) -> str

Gets a weather forecast for a given latitude & longitude (US only, based on external API). Returns a readable string summarizing the next few forecast periods.

(Modify this section if you added additional tools.)

Architecture & How it Works

When a client sends a request:

  1. The client sends your question to the LLM host.

  2. The host selects which tool(s) to call (based on MCP tooling metadata).

  3. The MCP server receives a tool invocation via JSON-RPC (or HTTP) and executes it.

  4. The result is returned to the host, which then uses the LLM to formulate a natural language response to the user. (This flow is based on the “What’s happening under the hood” section of the tutorial.)

Logging & Best Practices

  • Do not write to stdout for stdio-transport servers (in Python: avoid print() statements) as it may corrupt JSON-RPC messages. Use a logging library that writes to stderr or file instead.

  • Tool names should follow the naming conventions specified by MCP.

  • Validate inputs and handle errors gracefully (e.g., when external API fails or returns unexpected data).

Troubleshooting

  • If the server isn’t showing up in the client (e.g., Claude for Desktop):

    • Check your JSON config syntax.

    • Ensure the path to your server script is absolute.

    • Make sure you fully quit and restart the client application.

  • If tool calls fail silently:

    • Check client logs (e.g., ~/Library/Logs/Claude/mcp*.log on macOS).

    • Verify that your server runs without startup errors.

    • Confirm that your network/API access is working (for example, if using an external weather API).

  • If you're working outside the US and the example API only supports US locations: consider switching to a global API or adjust the logic accordingly.

Available Tools

2 tools
get_alertsB

Get weather alerts for a US state.

Args:
    state: Two-letter US state code (e.g. CA, NY)
ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It doesn't mention return format, pagination, whether alerts are current or historical, severity levels, or any rate limits or auth requirements. For a read-type tool the lack of annotations leaves significant gaps.

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?

Extremely concise and well-scoped. The description is two lines with an args docstring for the single parameter. Every word is functional with zero waste.

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

Completeness3/5

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

An output schema exists, which reduces the burden for explaining return values. However, with 0% schema description coverage, 1 single param (already covered in the args), no annotations, and no behavioral details (alert types, severity, expiration, update frequency), the description is minimal. For a weather alert tool, agents would benefit from knowing what constitutes an alert return vs. a no-alert return.

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 single parameter 'state' is described in the argument docstring as a two-letter US state code with examples (CA, NY), which adds meaning beyond the bare schema. However, it doesn't specify case sensitivity, whether territories are included (e.g., DC, PR), or what happens for invalid state codes. The examples help but full semantics aren't covered.

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 tool gets weather alerts for a US state, with a specific verb ('get') and resource ('weather alerts') and a geographic scope ('US state'). It distinguishes from the sibling tool 'get_forecast' by the resource type, though it doesn't explicitly name the sibling.

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

Usage Guidelines3/5

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

The description implies usage context ('for a US state') but provides no when-to-use guidance, no exclusions, and no comparison to the sibling get_forecast tool. The intent is reasonably clear but the agent doesn't know when alerts vs forecast is more appropriate.

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.

Args:
    latitude: Latitude of the location
    longitude: Longitude of the location
ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.4/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It doesn't disclose how many days of forecast are returned, data freshness, caching behavior, rate limits, or what units (Celsius/Fahrenheit) are used. The description only restates the parameters without adding behavioral context.

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

Conciseness3/5

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

The description is brief but under-specified rather than appropriately concise. The Args section is mostly unnecessary given the input schema repeats the same parameter names and types. The single opening sentence is useful, but the parameter documentation is redundant with the schema.

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

Completeness3/5

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

There is an output schema present, which helps, but the description still fails to communicate what the forecast contains or how comprehensive it is. For a tool that returns weather data, the agent has no sense of forecast length, granularity, or data fields without inspecting the output schema. The description is minimally sufficient for a basic 2-param lookup tool but leaves key context undocumented.

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

Parameters2/5

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

Schema description coverage is 0%, meaning the description must compensate. The description merely restates that latitude/longitude are coordinates of the location, which adds marginal value over the schema. It doesn't explain valid ranges (e.g., -90 to 90, -180 to 180), precision requirements, or format expectations. Minimal semantic addition.

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

Purpose3/5

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

The description states 'Get weather forecast for a location' with a clear verb+resource. It doesn't distinguish from its sibling tool get_alerts, and 'forecast' vs 'alerts' distinction is implied but not explicit. The purpose is clear but missing scope details (time range, units).

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?

No guidance on when to use this tool vs get_alerts. The description doesn't explain the distinction between getting a forecast and getting alerts, nor does it mention any special circumstances (e.g., use get_alerts for severe weather warnings). No when/when-not guidance is provided.

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 updatesv0.1.0
    • First observedget_alerts
    • First observedget_forecast

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

get_alerts and get_forecast have clearly distinct purposes: one retrieves alerts by state, the other retrieves forecasts by coordinates. There is no overlap or ambiguity between them.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern (get_alerts, get_forecast). The naming is predictable and readable.

Tool Count3/5

Two tools is thin for a general weather server. Many common operations (e.g., current conditions, historical data) are absent, making the set feel minimal.

Completeness3/5

The server covers alerts and forecasts but lacks current conditions, hourly forecasts, or other standard weather data. This is a notable gap for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers