Get the FREE Ultimate OpenClaw Setup Guide →

MCP_Server

A Simple Implementation of the Model Context Protocol

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Clone the repository and navigate to the project directory:
git clone https://github.com/Abhinavexists/MCP_Server.git
cd weather-tool
  1. Create and activate a Python virtual environment (using uv):
uv venv
  • Windows:
.venv\Scripts\activate
  • macOS/Linux:
source .venv/bin/activate
  1. Install dependencies using uv (this project uses uv.lock and pyproject.toml):
uv pip sync
  1. Create a .env file in the project root with your Gemini API key:
GEMINI_API_KEY=your_gemini_api_key_here
  1. Run the server:
python server.py
  1. 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

Sponsor this space

Reach thousands of developers