mcp -spring-java
MCP Server using Spring Boot Java
claude mcp add --transport stdio mtwn105-mcp-server-spring-java java -Dspring.ai.mcp.server.stdio=true -Dspring.main.web-application-type=none -Dlogging.pattern.console= -jar target/mcp-spring-java-0.0.1-SNAPSHOT.jar
How to use
This MCP server provides a Spring Boot-based implementation of a Model Context Protocol (MCP) server focused on user management. It exposes a set of tools such as getAllUsers, getAllUsersDefault, getUserById, searchUsers, addUser, updateUser, and deleteUser via MCP tool calls. The server operates in synchronous mode and supports Standard I/O and Server-Sent Events transports, allowing both terminal and streaming interactions. To interact with it, you can send JSON toolCall payloads to the /mcp/message endpoint, instructing the server to invoke the desired tool with appropriate parameters. The server is configured to fetch or manage user data via a DummyJSON external API, enabling realistic responses for development and testing.
How to install
Prerequisites:
- Java 21 or higher
- Maven
Installation steps:
-
Clone the repository: git clone https://github.com/yourusername/mcp-spring-java.git cd mcp-spring-java
-
Build the project with Maven: mvn clean package
-
Run the application: java -jar target/mcp-spring-java-0.0.1-SNAPSHOT.jar
-
Verify the server is running:
- Default port is 8090
- Endpoint for MCP messages: http://localhost:8090/mcp/message
Additional notes
Tips and notes:
- The server is configured for port 8090 and exposes the /mcp/message endpoint for MCP interactions.
- If you need to change the transport (e.g., enable SSE or STDIO), adjust the application.yml and startup arguments accordingly.
- Ensure Java 21 is installed and JAVA_HOME is set.
- For MCP client usage, you can configure the client to run the Java command with the specified system properties and jar path as shown in the configuration example.
- If you encounter issues with the external API (DummyJSON), check network access and consider configuring a mock API during development.