Hands-on-MCP
This repository implements an MCP server that provides weather alert information for the US, leveraging the National Weather Service (NWS) API. The client application demonstrates interaction with the MCP server and integrates conversation memory. It serves as a good project for deepening the basic understanding of MCP.
GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
47
Forks
0
Issues
0
MCP US Weather Client/Server
This was my first encounter with hands on implementation of MCP, i really liked it & i firmly believe MCP is here to stay, i have to implement some more projects to get more more better understanding about the overall ecosystem,About the repository, This repository contains a simple MCP (Model Context Protocol) server that provides weather alert information for US states, leveraging the National Weather Service (NWS) API. It also includes an example client application that demonstrates how to interact with the MCP server using the mcp_use library and Langchain.
Features
- Weather Alerts: Fetches and formats active weather alerts for a specified US state.
- MCP Integration: Demonstrates how to build an MCP server using the
fastmcplibrary. - Client Example: Provides a client application that uses the server and integrates conversation memory.
- Langchain Integration: Example showcases LLM integration.
Architecture
graph LR
%% MCP System
subgraph MCP_System
A[Client: client.py]
B[MCP Agent: mcp_use.MCPAgent]
C[MCP Client: mcp_use.MCPClient]
D[FastMCP Server: weather.py]
E[NWS API: api.weather.gov]
A --> B
B --> C
C --> D
D --> E
end
%% Data Flow
subgraph Data_Flow
F[User Input]
F --> A
E -->|Geo+JSON| D
D -->|Weather Data| B
B -->|LLM Interaction| F
end
%% Styling with visible text
classDef client fill:#f9f,stroke:#333,color:#000,font-weight:bold;
classDef agent fill:#ccf,stroke:#333,color:#000,font-weight:bold;
classDef server fill:#fcc,stroke:#333,color:#000,font-weight:bold;
classDef api fill:#ffc,stroke:#333,color:#000,font-weight:bold;
classDef user fill:#cfc,stroke:#333,color:#000,font-weight:bold;
class A client;
class B,C agent;
class D server;
class E api;
class F user;
%% Link styling
linkStyle default stroke:#000,stroke-width:2px;
Prerequisites
Before running the server and client, ensure you have the following installed:
- Python 3.7+
- uv (recommended for dependency management - https://github.com/astral-sh/uv)
- Groq API key. This needs to be added to .env file.
mcp_useLibrary: Make sure you've installed this according to its documentation.
Installation
Clone the repository:
git clone <your_repository_url> cd <repository_directory>Install dependencies (using uv):
uv add -r requirements.txtThis command uses
uv pip install .to install the project and its dependencies based on thepyproject.tomlfile in the current directory.Create .env file:
Create a.envfile in the root directory with the following content, replacing<YOUR_GROQ_API_KEY>with your actual Groq API key:GROQ_API_KEY=<YOUR_GROQ_API_KEY>
Usage
Running the MCP Weather Server & Client
Start the server:
uv run mcp dev server/weather.pyStart the Client:
uv run server/client.py
Interacting with the Client
- Type your queries at the prompt. For example: "Get weather alerts for CA, NY or NJ etc".
- Type
exitorquitto end the conversation. - Type
clearto clear the conversation history.
Example Interactions
The agent will then use the get_alerts tool to fetch weather alerts for California and provide you with the formatted results.
The agent will then use the get_config tool to fetch the resource.
Configuration
server/weather.json
This configuration file describes the tools and resources exposed by the MCP server. It's crucial that this file accurately reflects the definitions in your weather.py file. See the mcp_use documentation for details on the format of this file. The default configuration is in the server folder.
Environment Variables
The client application uses environment variables, specifically GROQ_API_KEY, to authenticate with the Groq API. Make sure to set these variables before running the client. You can set those variables using the .env file.
Output
- Console Output: This screenshot shows the typical output of the client application during a conversation, demonstrating how the agent interacts with the MCP server and utilizes the
get_alertstool.
- MCP Inspector: This screenshot shows the typical weather.json used with the MCP Inspector
Contact
For any inquiries or support, please reach out:
- Email: business@aiankit.com
- Personal Website: aiankit.com
18
Followers
81
Repositories
0
Gists
0
Total Contributions
The Tufin MCP Server is an open-source project designed to bridge Tufin's APIs with modern AI development workflows. By providing a secure REST API, it allows users to integrate Tufin functionalities into custom scripts and applications. This community-driven initiative encourages contributions and aims to enhance security and usability.
fast-bitrix24-mcp is a server designed for interacting with the Bitrix24 REST API. It currently supports entities such as deals and custom fields, allowing for human-readable field names. It is recommended for use in local networks and is still under development, so stability should be considered.
The mcp-client-for-ollama is a simple yet powerful Python client designed for interacting with Model Context Protocol (MCP) servers using Ollama. This client enables local large language models (LLMs) to utilize tools effectively. It primarily facilitates communication with APIs, streamlining workflows and enhancing the capabilities of LLMs.