Weather MCP Server
Provides weather alerts for US states and forecasts for given coordinates via MCP tools.
README
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
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)
uvtool (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
-
Clone this repository:
git clone <repo-url> cd <repo-name> -
Create and activate a virtual environment:
source .venv/bin/activate # (on macOS/Linux) # or on Windows: .venv\Scripts\activate -
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:
-
The client sends your question to the LLM host.
-
The host selects which tool(s) to call (based on MCP tooling metadata).
-
The MCP server receives a tool invocation via JSON-RPC (or HTTP) and executes it.
-
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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.