User Management Tools
STDIOModel Context Protocol server implementation providing user management tools for AI assistants.
Model Context Protocol server implementation providing user management tools for AI assistants.
A Model Context Protocol (MCP) server implementation built with Spring Boot and Java 21. This project demonstrates how to create an MCP server that provides user management tools for AI assistants.
git clone https://github.com/yourusername/mcp-spring-java.git cd mcp-spring-java
mvn clean package
java -jar target/mcp-spring-java-0.0.1-SNAPSHOT.jar
The MCP server is configured in application.yml
:
/mcp/message
endpoint for SSE communicationThe server exposes the following user management tools:
getAllUsers
- Get all users with paginationgetAllUsersDefault
- Get all users with default paginationgetUserById
- Get a single user by IDsearchUsers
- Search for users by queryaddUser
- Add a new userupdateUser
- Update a userdeleteUser
- Delete a userYou can use Postman to test the MCP server endpoints:
Start the MCP server
Open Postman and create a new request:
For the request body, use the following JSON format to invoke any of the available tools:
{ "message": { "toolCalls": [ { "id": "call-123", "name": "[TOOL_NAME]", "parameters": { "[PARAMETER_NAME]": "[PARAMETER_VALUE]" } } ] } }
{ "message": { "toolCalls": [ { "id": "call-123", "name": "getAllUsersDefault", "parameters": {} } ] } }
{ "message": { "toolCalls": [ { "id": "call-123", "name": "getUserById", "parameters": { "id": 1 } } ] } }
{ "message": { "toolCalls": [ { "id": "call-123", "name": "searchUsers", "parameters": { "query": "John" } } ] } }
The response will contain a JSON object with the results from the tool execution.
You can configure this server in MCP client applications using the following configuration:
{ "mcpServers": { "dummy-user-server": { "command": "java", "args": [ "-Dspring.ai.mcp.server.stdio=true", "-Dspring.main.web-application-type=none", "-Dlogging.pattern.console=", "-jar", "path/to/mcp-spring-java-0.0.1-SNAPSHOT.jar" ] } } }
This project is licensed under the terms provided in the LICENSE file.