About Spring AI MCP Wallet Server
Spring AI MCP Wallet Server is an MCP server published by G-khan in the Blockchain category: this repository showcases how to easily transform an existing Spring Boot REST API for Finance Wallet Management into an AI-available tool using Spring AI's Model Context Protocol (MCP) server integration.
The repository has 2 stars and 1 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/G-khan/spring-ai-mcp-wallet-serverThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Spring AI MCP Wallet Server
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
Finance Wallet MCP Server
Article of the project: https://gokhana.medium.com/from-rest-api-to-mcp-server-convert-your-spring-apis-into-ai-tools-with-spring-ai-07b8f36b0212
This project is a simple wallet management backend that exposes REST APIs and integrates with Spring AI's MCP (Model Context Protocol) server for AI-powered tool access.
Spring AI Integration
- Integrated Spring AI MCP Server starter
- Annotated service methods with
@Toolfor AI tool exposure - Added configuration for MCP server operation
Key Dependencies
<properties>
<java.version>17</java.version>
<spring-ai.version>1.0.0</spring-ai.version>
</properties>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server</artifactId>
</dependency>
Features
- Wallet Management (Create, Read, Update, Delete)
- Add income and expenses to wallets
- Automatic balance updates
- Input validation and error handling
- H2 in-memory database for easy testing
Technical Stack
- Java 17
- Spring Boot 3.2.3
- Spring Data JPA
- H2 Database (in-memory)
- Maven
- Lombok
- Spring AI MCP Server
Data Model
| Field | Type | Description |
|---|---|---|
| id | Long | Wallet ID |
| name | String | Wallet name |
| balance | BigDecimal | Current balance |
API Endpoints
GET /api/wallets- Get all walletsGET /api/wallets/{id}- Get wallet by IDPOST /api/wallets- Create a new walletPUT /api/wallets/{id}- Update a walletDELETE /api/wallets/{id}- Delete a walletPOST /api/wallets/{id}/expense?amount={amount}- Add an expensePOST /api/wallets/{id}/income?amount={amount}- Add income
Tool Annotations
The application uses Spring AI Tool annotations to expose service methods as MCP tools.
Example:
@Tool(name = "create-wallet", description = "Creates a new wallet with the given details")
public Wallet createWallet(Wallet wallet) { ... }
Exposed Tools:
- create-wallet
- get-all-wallets
- get-wallet-by-id
- update-wallet
- delete-wallet
- add-expense
- add-income
MCP Server Configuration
Add the following to your src/main/resources/application.properties:
spring.main.web-application-type=none
spring.ai.mcp.server.name=wallet-mcp
spring.ai.mcp.server.version=0.0.1
server.port=8091
Register the tool callback in your configuration:
@Bean
public List<ToolCallback> walletTools(WalletService walletService) {
return List.of(ToolCallbacks.from(walletService));
}
H2 Console
- URL: http://localhost:8091/h2-console
- JDBC URL:
jdbc:h2:mem:walletdb - Username:
sa - Password: (empty)
Error Handling
- 404 for wallet not found
- 400 for insufficient balance or illegal arguments
- Centralized in
GlobalExceptionHandler
Running the Application
- Clone the repository
- Build with
mvn clean package - Start the MCP server:
Or usejava -jar target/finance-wallet-0.0.1-SNAPSHOT.jar.cursor/mcp.json:{ "mcpServers": { "finance-wallet-mcp": { "command": "java", "args": [ "-jar", "/Users/gokhanayrancioglu/finance-wallet/target/finance-wallet-0.0.1-SNAPSHOT.jar" ] } } }
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.