weather-mcp-server

dbillion/weather-mcp-server

3.2

If you are the rightful owner of weather-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Weather MCP Server is a specialized service that provides weather information based on location coordinates using the Model Context Protocol.

Tools
1
Resources
0
Prompts
0

Weather MCP Server

A Model Context Protocol (MCP) server that provides weather information based on location coordinates.

Overview

The Weather MCP Server is a specialized service that implements the Model Context Protocol to provide weather information to AI assistants and other clients. It exposes a simple tool for retrieving weather data based on latitude and longitude coordinates.

Features

  • MCP-compliant server implementation
  • Weather information service based on location coordinates
  • Secure API key management for LLM integrations
  • Lightweight server with minimal dependencies
  • Ready for integration with AI assistants

Prerequisites

  • Java 21 or higher
  • Maven 3.6.0 or higher
  • Google Gemini API key

Setup

1. Clone the repository

git clone <repository-url>
cd weather-mcp-server

2. Start the Server

Use the provided startup script to build and start the server:

./start-server.sh

The script will:

  • Prompt you for your Google Gemini API key
  • Build the project
  • Start the MCP server

3. Start the Client (in a separate terminal)

cd weather-client
mvn spring-boot:run

Usage

The server exposes the following tool:

getWeatherByLocation(lat, lon)

  • Description: Get weather information by location based on latitude and longitude
  • Parameters:
    • lat (int): Latitude coordinate
    • lon (int): Longitude coordinate
  • Returns: Weather description based on the provided coordinates

Configuration

The server uses the following configuration:

  • Server Name: weather-mcp-server
  • Server Version: 1.0.0
  • Transport: stdio
  • Required Environment Variable: GOOGLE_GEMINI_API_KEY

Project Structure

weather-mcp-server/
├── src/
│   └── main/
│       └── java/
│           └── dev/dayo/
│               └── weathermcpserver/
│                   ├── WeatherMcpServerApplication.java
│                   └── service/
│                       └── WeatherService.java
├── weather-client/
│   └── (Client application for testing the MCP server)
├── start-server.sh (Startup script with API key prompt)
└── pom.xml

Integration with MCP Clients

The server can be integrated with MCP-compatible clients. The server exposes the weather tool through stdio transport, which is configured in the application properties.

The client in this repository (weather-client) is already configured to communicate with this server via the configuration in weather-client/src/main/resources/mcp-servers.config.json.

For external MCP integrations, the server runs with stdio transport and can be invoked as:

java -jar /path/to/your/cloned/weather-mcp-server/target/weather-mcp-server-0.0.1-SNAPSHOT.jar

Replace /path/to/your/cloned/weather-mcp-server with the actual path where you cloned the repository.

Security

  • API keys are not stored in the repository
  • The .gitignore file prevents environment files from being committed
  • API keys are only loaded into memory during runtime

Development

To run tests:

mvn test

To build without running tests:

mvn clean package -DskipTests

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

[Specify your license here]