weather-mcp
MCP Server for Weather in US
Documentation
Weather MCP Server
A Model Context Protocol (MCP) server for weather data using Spring AI.
๐ Quick Start
# Build the JAR file first
./mvnw clean package
# Start the MCP server
docker-compose up
# The server will be available at:
# - HTTP: http://localhost:8080
# - MCP Endpoint: http://localhost:8080/sse
# - Health: http://localhost:8080/actuator/health๐ Cursor Integration
Add to your `~/.cursor/mcp.json`:
{
"mcpServers": {
"weather": {
"command": "/weather/start-mcp-server.sh"
}
}
}๐ ๏ธ Available Tools
- `getWeatherForecastByLocation(latitude, longitude)` - Get weather forecast
- `getAlerts(state)` - Get weather alerts for US states
๐ณ Docker Commands
# Build the JAR (required before running docker-compose)
./mvnw clean package
# Start in background
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down
# Rebuild and start
./mvnw clean package && docker-compose up --build๐งโ๐ป Development
Prerequisites
- Java 21 (e.g. OpenJDK 21 or Temurin 21)
- Maven 3.9+
- Docker & Docker Compose
Build Locally
# Compile & run unit tests
./mvnw clean verify
# Build the runnable JAR (output in target/)
./mvnw clean packageRun Locally
# Run with the JVM directly
java -jar target/weather-0.0.1-SNAPSHOT.jar
# Or use Spring Boot devtools for hot-reload
./mvnw spring-boot:run
# Or run with Docker Compose
./mvnw clean package && docker-compose upThe server starts on `http://localhost:8080` by default.
Environment Variables
| Name | Default | Description |
|---|---|---|
| `SERVER_PORT` | `8080` | HTTP port to bind |
| `SPRING_AI_MCP_SERVER_STDIO` | `false` | Run the MCP server over stdio (useful for editor integrations) |
| `SPRING_PROFILES_ACTIVE` | *(none)* | Comma-separated list of Spring profiles |
Variables can be defined in `src/main/resources/application.yml`, overridden via `-D` flags, or exported in your shell.
๐ก API Reference
This project exposes two flavours of API:
1. MCP Tool Endpoints โ consumed by supporting IDEs (e.g. Cursor).
2. REST Endpoints โ ordinary HTTP endpoints that you can call with `curl`, Postman, etc.
MCP Tools
| Tool | Signature | Description |
|---|---|---|
| `getWeatherForecastByLocation` | `(latitude: number, longitude: number)` | Returns a human-readable multi-day forecast for the supplied co-ordinates. |
| `getAlerts` | `(state: string)` | Returns active alerts for the supplied US state (two-letter code). |
REST Endpoints
| Method | Path | Example |
|---|---|---|
| GET | `/forecast?lat={lat}&lon={lon}` | `/forecast?lat=37.7749&lon=-122.4194` |
| GET | `/alerts/{state}` | `/alerts/CA` |
_Note: the REST layer simply proxies to the same service methods backing the MCP tools._
Frequently asked questions
What is weather-mcp?
weather-mcp is MCP Server for Weather in US
How do I install weather-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is weather-mcp open source?
Yes โ it is hosted on GitHub at https://github.com/suraj0223/weather-mcp.
Related MCP tools
MCP Server for Ghidra Java-based implementation. Trusted by 6400+ developers. Trusted by 6400+ developers. Trusted by 6400+ developers.
The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI Trusted by 2800+ developers.
A library for communication with a Minecraft client/server. Built for the Model Context Protocol to enhance AI capabilities. Java-based implementation.
Model Context Protocol Servers
Pre-indexed code knowledge graph, auto syncs on code changes, for Claude Code, Codex, Gemini, Cursor, OpenCode, AntiGravity, Kiro, CoPilot, and Hermes Agent โ fewer tokens, fewer tool calls, 100% local
an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP