MCP Weather Application (Client-Server)
LocalAbout MCP Weather Application (Client-Server)
MCP Weather Application (Client-Server) is a sample weather application with an MCP server and chat client. The server retrieves alerts and forecasts from the National Weather Service, while the client uses LangChain and Groq to handle natural-language requests.
Key features
- 01Fetches weather alerts and forecasts
- 02Discovers server tools through MCP
- 03Chat interface for natural-language queries
- 04Uses LangChain and Groq
Use cases
- 01Ask for weather alerts in chat
- 02Request a weather forecast in natural language
MCP support
The server exposes `get_alerts` and `get_forecast` tools backed by the National Weather Service API. Its client connects over stdio, discovers those tools, and invokes them through MCP.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Weather Application (Client-Server)
This project demonstrates a client-server application using the MCP (Model Context Protocol) framework to retrieve weather information.
weather/: Contains the MCP server code, which fetches data from the National Weather Service (NWS) API.mcp-client/: Contains the MCP client code, which interacts with the server and uses LangChain with Groq for natural language queries.
Description
The MCP Server (weather/) provides specific tools (get_alerts, get_forecast) accessible via MCP. It connects to the NWS API to fulfill requests made through these tools.
The MCP Client (mcp-client/) connects to the MCP server, discovers its tools, and allows users to interact via a chat interface. It uses LangChain and the Groq API (Llama 3 model) to process natural language queries, determine if a server tool is needed, call the tool via MCP if necessary, and formulate a final response.
Architecture
- The Client starts and initiates an MCP connection (via stdio) to the Server script.
- The Client discovers the tools available on the Server.
- The user provides a natural language query to the Client.
- The Client uses the Groq LLM (via LangChain) to interpret the query and potentially identify the need to use a server tool.
- If a tool is needed, the Client sends an MCP request to the Server to execute the specific tool (e.g.,
get_forecast) with the required arguments. - The Server executes the tool logic, fetching data from the NWS API.
- The Server sends the result back to the Client via MCP.
- The Client incorporates the tool's result into the ongoing conversation with the LLM.
- The Client presents the final LLM-generated response to the user.
Setup
Detailed setup instructions, including dependency installation and environment configuration (like API keys), can be found in the README files within each component's directory:
- Server Setup: See
weather/README.md - Client Setup: See
mcp-client/README.md
Running the Application
To run the client and have it automatically start and connect to the server, execute the following command from the mcp-client/ (the directory containing client.py):
uv run client.py ../weather/weather.py
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.