Subitha-Murugesan/MCP-Weather-Chatbot
If you are the rightful owner of MCP-Weather-Chatbot and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP Weather Chatbot is a Generative AI project that provides real-time weather data and alerts through an MCP server, utilizing the US National Weather Service API.
MCP Weather Chatbot
MCP Weather Chatbot is a Generative AI project that exposes real-time weather data and alerts as an MCP (Model Context Protocol) server. It demonstrates how to build MCP tools that can be accessed by different clients using both SSE (Server-Sent Events over HTTP) and stdio transport.
The backend integrates with the US National Weather Service (NWS) API to provide accurate, structured weather alerts and forecasts.
Quick Start
Clone the repo and set up the environment using uv:
# Initialize venv
uv venv
source .venv/bin/activate
# Install dependencies
uv add mcp httpx nest_asyncio
Run the MCP Weather server:
uv run server.py
Run a client (stdio or SSE):
uv run client_stdio.py
# or
uv run client_sse.py
Workflow Overview
User -> Client (stdio / SSE) -> MCP Weather Server -> NWS API
-
Weather MCP Server (
server.py
)-
Tools:
get_alerts(state)
→ Fetches weather alerts for a given U.S. stateget_forecast(lat, lon)
→ Returns a detailed forecast for a location
-
Supports stdio and SSE (HTTP) transports
-
Runs locally or in Docker
-
-
Clients
client_stdio.py
→ Connects via stdioclient_sse.py
→ Connects via SSE (http://localhost:8000/sse
)
User Experience
-
Start the server:
uv run server.py
-
Run the SSE client:
uv run client_sse.py
-
Or run the stdio client:
uv run client_stdio.py
-
Example interaction:
You: provide me the weather state of NC
Running with Docker
Build and run the containerized server:
docker build -t mcp-weather .
docker run -p 8000:8000 mcp-weather
This starts the MCP Weather Server with SSE enabled and exposes it on localhost:8000
.
Testing the MCP Weather Server
You can test the server in three different ways:
MCP Inspector
uv run mcp dev server/weather.py
Claude Desktop
Install the MCP server:
uv run mcp install server/weather.py
Cursor IDE
- Open Cursor → Settings → MCP & Integrations
- Add a Custom MCP Server
- Insert your server config (
server/weather.py
) - Save → Chat with weather tools directly in Cursor