
MCP_Server
A Simple Implementation of the Model Context Protocol
1
Github Watches
0
Github Forks
5
Github Stars
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
.env
file 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
quit
to 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 AI -
server.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:
相关推荐
I find academic articles and books for research and literature reviews.
Confidential guide on numerology and astrology, based of GG33 Public information
Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.
Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.
Advanced software engineer GPT that excels through nailing the basics.
Converts Figma frames into front-end code for various mobile frameworks.
Take an adjectivised noun, and create images making it progressively more adjective!
Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.
The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.
Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
🧑🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.
Reviews

user_A88pTLZ2
As a dedicated user of MCP_Server, I highly recommend this tool for anyone needing a reliable and efficient server solution. Created by Abhinavexists, this project is well-documented and easy to deploy. The seamless user experience and robust performance make it a standout choice. For more details, visit the GitHub page here: https://github.com/Abhinavexists/MCP_Server.