Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Weather ProjectAre there any active weather alerts for Texas right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Weather Project
A Model Context Protocol (MCP) server implementation that provides weather alerts via the National Weather Service (NWS) API. This project includes both a FastMCP server and a LangChain-based client with memory capabilities.
Features
Weather Alerts: Fetch active weather alerts for any US state using the NWS API.
Echo Resource: A simple resource that echoes back messages.
Greeting Prompt: A customizable greeting prompt generator.
Interactive Client: A CLI-based chat client powered by Groq's Llama 3.3 model with conversation memory.
Prerequisites
Installation
Clone the repository:
git clone <repository_url> cd mcpfileInstall dependencies: Using
uv(recommended):uv syncOr using pip:
pip install -r requirements.txt(Note: You may need to generate a
Set up Environment Variables: Create a
.envfile in the root directory and add your Groq API key:GROQ_API_KEY=your_groq_api_key_here
Usage
Running the Entry Point
The main.py is a simple entry point script that prints a welcome message.
Running the interactive Client
The client connects to the weather server and allows you to interact with it using natural language.
Ensure the server configuration in
server/weather.jsonis correct (it points toserver/weather.py).Run the client:
uv run server/client.py # OR if using a virtual environment directly: # python server/client.pyExample Interaction:
You: Check weather alerts for TX Assistant: Checking weather alerts for Texas... [Agent responds with alerts]
Running the MCP Server Standalone
You can run the MCP server directly using uv. This is useful for inspection or debugging with the MCP Inspector.
Configuration Verification
Ensure that server/weather.json points to the correct absolute path of your server/weather.py file.
Project Structure
server/weather.py: The main MCP server implementation usingFastMCP. Defines tools (get_alerts), resources, and prompts.server/client.py: An MCP client implementation usingLangChainandChatGroq. Handles the interactive chat session.server/weather.json: Configuration file for the MCP client to locate the server.main.py: Simple entry point script.pyproject.toml: Project configuration and dependencies.
Tools Available
get_alerts(state: str): Get active weather alerts for a US state (e.g., "CA", "NY").
Resources
echo://{message}: Echoes a message.
Prompts
greet_user(name: str, style: str): Generates a greeting in a specified style ("friendly", "formal", or "casual").