mcp-springboot
这是一个使用 Spring Boot 和 Spring AI MCP 的示例项目,展示了如何集成和使用 MCP 功能。
claude mcp add --transport stdio james-zou-mcp-springboot-server docker run -i james-zou/mcp-springboot-server
How to use
This MCP server is a Spring Boot implementation of the MCP (Model Context Protocol) for providing weather information and related MCP endpoints. It exposes a Weather Service with endpoints that allow clients to fetch current weather information for a given city, and an alternative weather retrieval method. The project is built with Spring Boot 3.x, uses a Maven-based workflow, and runs as a standalone Spring Boot application. Once running, you can interact with the weather-related MCP methods to obtain weather data for specific locations as part of your Model Context Protocol integrations.
How to install
Prerequisites:
- Java Development Kit (JDK) 17 or newer
- Maven 3.6.x or later
- Git
Installation steps:
- Clone the repository
git clone https://github.com/your-username/mcp-springboot-server.git
cd mcp-springboot-server
- Build the project with Maven
mvn clean install
- Run the application locally
mvn spring-boot:run
The server will start on port 8080 by default unless configured otherwise (check application.properties for server.port).
Alternatively, run via Docker if you prefer a containerized setup:
docker build -t mcp-springboot-server .
docker run -p 8080:8080 mcp-springboot-server
Additional notes
Notes:
- Default port is 8080 unless overridden in application.properties (server.port).
- The MCP weather endpoints expose methods like getWeather(cityName) and getWeather1(cityName) for alternative retrieval.
- The project includes an API Documentation section; consult the generated docs or OpenAPI specs in the repository for the full API surface.
- Ensure Java 17+ and Maven are installed when building locally.
- If you plan to run in production, consider configuring environment variables for weather data sources or external API keys as needed by your deployment.
- For troubleshooting, verify that the application.properties file contains server.port and MCP-related feature toggles (enabled, resource-change-notification, prompt-change-notification) as described in the docs.