Spring AI MCP Weather Server
by alexandredavi
This sample project demonstrates how to create an MCP server using the Spring AI MCP Server Boot Starter with WebMVC transport. It implements a weather service that exposes tools for retrieving weather information using the National Weather Service API.
Last updated: N/A
What is Spring AI MCP Weather Server?
This is a sample MCP server built with Spring AI and the WebMVC starter, providing weather information through tools exposed via SSE and STDIO transports.
How to use Spring AI MCP Weather Server?
Build the project with Maven, then run the server in either WebMVC SSE mode (default) or STDIO mode by setting the appropriate properties. Configure the server through application.properties
and interact with it using MCP clients via SSE or STDIO transport.
Key features of Spring AI MCP Weather Server
Integration with spring-ai-mcp-server-webmvc-spring-boot-starter
Support for both SSE and STDIO transports
Automatic tool registration using Spring AI's @Tool annotation
Provides weather forecast and weather alerts tools
Configurable via application.properties
Use cases of Spring AI MCP Weather Server
Integrating weather information into AI applications
Building custom weather-related tools and services
Demonstrating the use of Spring AI MCP Server Boot Starter
Experimenting with different MCP transport modes (SSE, STDIO)
FAQ from Spring AI MCP Weather Server
What is MCP?
What is MCP?
MCP stands for Model Context Protocol, a standard for communication between AI models and external tools or services.
What is Spring AI?
What is Spring AI?
Spring AI is a framework for building AI-powered applications with Spring.
How do I configure the server?
How do I configure the server?
The server is configured through the application.properties
file, allowing you to set server name, version, transport mode, and other properties.
What are the available tools?
What are the available tools?
The server provides two tools: getWeatherForecastByLocation
to get the weather forecast for a specific latitude/longitude, and getAlerts
to get weather alerts for a US state.
How do I connect to the server?
How do I connect to the server?
You can connect to the server using either SSE or STDIO transport. Example clients are provided in the project, and you can also use the MCP Client Boot Starters for auto-configuration.