MCP_Server
A Simple Implementation of the Model Context Protocol
claude mcp add --transport stdio abhinavexists-mcp_server python server.py \ --env GEMINI_API_KEY="your_gemini_api_key_here"
How to use
This MCP server provides a Python-based weather data toolset that exposes two main MCP tools: get_alerts and get_forecast. The server uses the National Weather Service API to retrieve weather alerts for US states and provide location-based forecasts by latitude and longitude. Natural language queries are processed via Google's Gemini AI, enabling you to ask questions like, “What are the current weather alerts in CA?” or “What’s the forecast for latitude 37.7749, longitude -122.4194?” The client (client.py) connects to the server (server.py) and relays user intent to these tools, returning structured results to the console. To use it, you’ll need a Gemini API key and Python 3.8+ installed; you can optionally run the project with a virtual environment managed by uv.
How to install
Prerequisites:
- Python 3.8+
- Node.js (optional, only if you plan to run JavaScript variants)
- Google Gemini API key
Installation steps:
- Clone the repository and navigate to the project directory:
git clone https://github.com/Abhinavexists/MCP_Server.git
cd weather-tool
- Create and activate a Python virtual environment (using uv):
uv venv
- Windows:
.venv\Scripts\activate
- macOS/Linux:
source .venv/bin/activate
- Install dependencies using uv (this project uses uv.lock and pyproject.toml):
uv pip sync
- Create a .env file in the project root with your Gemini API key:
GEMINI_API_KEY=your_gemini_api_key_here
- Run the server:
python server.py
- In another terminal, run the client to connect to the server:
python client.py server.py
Note: If you are using a Node.js variant or different server entry point, adjust the command and args accordingly. Ensure the GEMINI_API_KEY environment variable is available to the process running server.py.
Additional notes
- Ensure you have a valid Gemini API key and that it has access to the Gemini services used by the server.
- The server relies on the National Weather Service API; network access must be available from the host running server.py.
- If you encounter connection issues, verify that server.py is running and that client.py is pointing to the correct server entry (server.py).
- For troubleshooting, check environment variable availability in your shell or IDE where you launch the processes.
- This project uses uv for dependency management; you can also install dependencies manually via pip if needed, but uv provides consistent reproducible environments.
- If you want to extend functionality, you can add additional tools for more weather endpoints or implement caching for frequently requested data.
Related MCP Servers
Gitingest
mcp server for gitingest
zotero
Model Context Protocol (MCP) server for the Zotero API, in Python
google_ads_mcp
The Google Ads MCP Server is an implementation of the Model Context Protocol (MCP) that enables Large Language Models (LLMs), such as Gemini, to interact directly with the Google Ads API.
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
sympy
A MCP server for symbolic manipulation of mathematical expressions
mcp-oi-wiki
🌟 Wiki of OI / ICPC for LLMs. (面向大模型的某大型游戏线上攻略,内含炫酷算术魔法)