MCP
A Simple Implementation of the Model Context Protocol
Abhinavexists
README
MCP
A Simple implementation of a command-line tool that provides access to US weather data through a client-server architecture using the Model Context Protocol (MCP) and Google's Gemini AI. Built to practive and understand how MCP works.
Overview
This project connects a Python client application with a weather data server, allowing users to query weather information using natural language. The server communicates with the National Weather Service API to retrieve weather alerts and forecasts.
Features
- Query weather alerts for US states using state codes
- Get detailed weather forecasts for specific locations using latitude and longitude
- Natural language interface powered by Google's Gemini AI
- Client-server architecture using Model Context Protocol (MCP)
Prerequisites
- Python 3.8+
- Node.js (if running JavaScript server)
- Google Gemini API key
Installation
-
Clone the repository:
git clone https://github.com/Abhinavexists/MCP_Server.git cd weather-tool -
Install uv if you don't have it already:
pip install uv -
Create and activate a virtual environment:
uv venv- On Windows:
.venv\Scripts\activate - On macOS/Linux:
source .venv/bin/activate
- On Windows:
-
Install dependencies using uv (this project uses uv.lock and pyproject.toml):
uv pip sync -
Create a
.envfile in the project root directory with your Gemini API key:GEMINI_API_KEY=your_gemini_api_key_here
Usage
-
Start the client and connect to the weather server:
python client.py server.py -
Once connected, you can ask questions about weather information:
Query: What are the current weather alerts in CA? Query: What's the forecast for latitude 37.7749, longitude -122.4194? -
Type
quitto exit the application.
Available Tools
The server provides the following tools:
- get_alerts: Fetches weather alerts for a specified US state (using two-letter state code)
- get_forecast: Retrieves weather forecasts for a specific location (using latitude and longitude)
Project Structure
client.py: MCP client that connects to the server and processes user queries using Gemini AIserver.py: MCP server that implements weather data tools and communicates with the National Weather Service API
Error Handling
The application includes robust error handling for:
- Invalid server script paths
- Connection issues with the NWS API
- Invalid or missing data in API responses
Future Improvements
- Add additional weather data endpoints
- Implement caching for frequently requested data
- Add support for location name lookup (instead of requiring lat/long)
- Create a web interface
License
Resources
For more information about Model Context Protocol (MCP), refer to the official Claude MCP documentation:
Recommended Servers
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.
Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Ancestry MCP
Allows the AI to read .ged files and genetic data.
MCP-Logic
MCP-Logic is a server that provides AI systems with automated reasoning capabilities, enabling logical theorem proving and model verification using Prover9/Mace4 through a clean MCP interface.
Mentor MCP Server
Provides LLM Agents with AI-powered mentorship for code review, design critique, writing feedback, and brainstorming using the Deepseek API, enabling enhanced output in various development and strategic planning tasks.