This MCP server implemented with Spring Boot and Java 21 provides user management tools for AI assistants through the Model Context Protocol (MCP). It offers a robust set of features including user management operations and supports both Standard I/O and Server-Sent Events transports.
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 server is configured through application.yml
with these default settings:
/mcp/message
The MCP server provides several user management tools:
getAllUsers
- Retrieves users with paginationgetAllUsersDefault
- Gets users with default paginationgetUserById
- Fetches a single user by IDsearchUsers
- Searches for users by queryaddUser
- Creates a new userupdateUser
- Updates an existing userdeleteUser
- Removes a userTo test the MCP server endpoints:
Start the MCP server
Configure a Postman request:
Use this JSON format for the request body:
{
"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"
}
}
]
}
}
To configure this server in MCP client applications, use 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"
]
}
}
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "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"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"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"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"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"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect