- Explore MCP Servers
- mcp-server-spring-java
Mcp Server Spring Java
What is Mcp Server Spring Java
mcp-server-spring-java is an implementation of a Model Context Protocol (MCP) server built using Spring Boot and Java 21. It provides user management tools specifically designed for AI assistants.
Use cases
Use cases include managing user data for AI applications, performing user searches, adding or updating user information, and integrating with other systems that require user management functionalities.
How to use
To use mcp-server-spring-java, clone the repository, build the project using Maven, and run the application. You can then interact with the server through its exposed endpoints using tools like Postman.
Key features
Key features include synchronous communication mode, user management tools, support for Standard I/O and Server-Sent Events transports, and integration with the DummyJSON external API for user data.
Where to use
mcp-server-spring-java can be used in applications that require user management for AI assistants, particularly in environments where synchronous communication is needed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Server Spring Java
mcp-server-spring-java is an implementation of a Model Context Protocol (MCP) server built using Spring Boot and Java 21. It provides user management tools specifically designed for AI assistants.
Use cases
Use cases include managing user data for AI applications, performing user searches, adding or updating user information, and integrating with other systems that require user management functionalities.
How to use
To use mcp-server-spring-java, clone the repository, build the project using Maven, and run the application. You can then interact with the server through its exposed endpoints using tools like Postman.
Key features
Key features include synchronous communication mode, user management tools, support for Standard I/O and Server-Sent Events transports, and integration with the DummyJSON external API for user data.
Where to use
mcp-server-spring-java can be used in applications that require user management for AI assistants, particularly in environments where synchronous communication is needed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Server using Spring Boot Java
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.
Features
- Implements MCP server functionality using Spring AI
- Exposes user management tools via MCP
- Synchronous communication mode
- Support for Standard I/O and Server-Sent Events transports
- Integrates with DummyJSON external API for user data
Technologies
- Java 21
- Spring Boot 3.4.3
- Spring AI (Model Context Protocol)
- Project Lombok
- Maven
Getting Started
Prerequisites
- Java 21 or higher
- Maven
Installation
- Clone the repository
git clone https://github.com/yourusername/mcp-spring-java.git
cd mcp-spring-java
- Build the project
mvn clean package
- Run the application
java -jar target/mcp-spring-java-0.0.1-SNAPSHOT.jar
Configuration
The MCP server is configured in application.yml:
- Server runs on port 8090
- Server name: my-dummy-users-server
- Synchronous communication mode
- Supports STDIO transport for terminal-based communication
- Exposes
/mcp/messageendpoint for SSE communication
Available Tools
The 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 user
Testing with Postman
You can use Postman to test the MCP server endpoints:
-
Start the MCP server
-
Open Postman and create a new request:
- Method: POST
- URL: http://localhost:8090/mcp/message
- Headers:
- Content-Type: application/json
- Accept: application/json
-
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]"
}
}
]
}
}
Example Requests
Get All Users (Default Pagination)
{
"message": {
"toolCalls": [
{
"id": "call-123",
"name": "getAllUsersDefault",
"parameters": {}
}
]
}
}
Get User by ID
{
"message": {
"toolCalls": [
{
"id": "call-123",
"name": "getUserById",
"parameters": {
"id": 1
}
}
]
}
}
Search Users
{
"message": {
"toolCalls": [
{
"id": "call-123",
"name": "searchUsers",
"parameters": {
"query": "John"
}
}
]
}
}
The response will contain a JSON object with the results from the tool execution.
Usage with MCP Clients
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"
]
}
}
}
License
This project is licensed under the terms provided in the LICENSE file.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










