Get the FREE Ultimate OpenClaw Setup Guide →

weather -java

A simple weather MCP server implementation in Java

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio chrischiedo-weather-mcp-server-java java -Dspring.ai.mcp.server.stdio=true -jar /absolute/path/to/weather-mcp-server-0.0.1-SNAPSHOT.jar \
  --env JAVA_OPTS="Optional additional JVM options"

How to use

This MCP server implements a weather information tool that exposes current weather data for any location by querying the public wttr.in API. Clients like Claude Desktop can connect to the server via the MCP interface and invoke the getWeatherDetailsByLocation tool to fetch real-time weather details for a specified place. The server communicates over STDIO transport, which is typically initiated and managed by the MCP client, so you’ll usually start the Java process and let the client handle the transport layer. The included example configuration shows how to expose the server to Claude Desktop so that the tool can be invoked from natural-language prompts such as asking for the current weather in a city.

How to install

Prerequisites:

  • Java 17+ (JDK)
  • Maven 3.6+ (for building from source)
  • A Java 17+ compatible environment and a working Maven setup
  1. Clone the repository git clone https://github.com/chrischiedo/weather-mcp-server-java.git cd weather-mcp-server-java

  2. Build the project (skip tests if desired) ./mvnw clean install -DskipTests

    The build will produce a jar in the target directory, e.g. target/weather-mcp-server-0.0.1-SNAPSHOT.jar

  3. Run the server java -jar target/weather-mcp-server-0.0.1-SNAPSHOT.jar

  4. Configure the MCP client (example for Claude Desktop) Create the following configuration in Claude Desktop (or adapt to your client): { "mcpServers": { "mcp-weather-server": { "command": "java", "args": [ "-Dspring.ai.mcp.server.stdio=true", "-jar", "/absolute/path/to/weather-mcp-server-0.0.1-SNAPSHOT.jar" ] } } }

  5. Replace /absolute/path/to/ with the actual path to the built jar file on your system.

Additional notes

Tips and notes:

  • The server uses the public wttr.in API, which requires no API key. If you need more advanced weather data, consider wiring in an alternative weather API via your own extension.
  • If you upgrade the Java version or dependencies, ensure your MCP client configuration remains compatible with the stdio transport mode.
  • For macOS users, remember file paths in JSON configs may require escaping spaces and using absolute paths.
  • The tool exposed by the server is getWeatherDetailsByLocation; you can extend the server with additional tools like forecasts or alerts if you need more capabilities.

Related MCP Servers

Sponsor this space

Reach thousands of developers