MCP Spring Boot Toolkit
Provides tools and guides for Spring Boot development including code generation, security audit, and query optimization.
README
MCP Spring Boot Toolkit
MCP (Model Context Protocol) server cung cấp tools, resources và prompts hỗ trợ phát triển dự án Java Spring Boot.
Tính năng
Tools (8 tools)
| Tool | Mô tả |
|---|---|
generate_entity |
Tạo JPA Entity class với Lombok annotations, audit fields (createdAt/updatedAt), soft delete |
generate_controller |
Tạo REST Controller với CRUD endpoints, pagination, validation |
generate_service |
Tạo Service interface + implementation với @Transactional, @Cacheable |
generate_dto |
Tạo Request/Response DTOs với validation annotations + MapStruct mapper |
generate_repository |
Tạo Spring Data JPA Repository với custom query methods, Specification support |
generate_exception_handler |
Tạo @ControllerAdvice global exception handler + custom exception classes |
generate_application_properties |
Tạo application.yml theo profile (dev/prod) với database, security, actuator, swagger... |
analyze_pom |
Phân tích pom.xml để tìm vấn đề dependency, version conflict và đề xuất cải thiện |
Prompts (6 prompts)
| Prompt | Mô tả |
|---|---|
review_api |
Review REST API controller theo best practices (HTTP conventions, validation, security, performance) |
debug_exception |
Phân tích stack trace và đề xuất cách fix |
optimize_query |
Tối ưu JPA/Hibernate query (N+1, projection, indexing, caching) |
security_audit |
Audit bảo mật Spring Security config (JWT, CORS, CSRF, input validation) |
migration_plan |
Lên kế hoạch upgrade Spring Boot version (breaking changes, namespace migration) |
design_microservice |
Thiết kế kiến trúc microservice (package structure, API contracts, communication patterns) |
Resources (4 guides)
| Resource | URI | Nội dung |
|---|---|---|
| Project Structure | guide://spring-boot/project-structure |
Cấu trúc package chuẩn cho ứng dụng Spring Boot |
| Security | guide://spring-boot/security |
Checklist bảo mật: JWT, OAuth2, CORS, rate limiting |
| Layered Architecture | guide://spring-boot/layered-architecture |
Kiến trúc phân lớp Controller → Service → Repository |
| API Design | guide://spring-boot/api-design |
Thiết kế RESTful API: versioning, pagination, error handling |
Cài đặt
# Clone hoặc copy project
cd mcp-spring-boot-toolkit
# Cài dependencies
npm install
# Build
npm run build
Cách sử dụng
Cấu hình MCP Server
Thêm vào file cấu hình MCP của IDE (ví dụ .kiro/settings/mcp.json, claude_desktop_config.json, hoặc tương đương):
Production (dùng bản build):
{
"mcpServers": {
"spring-boot-toolkit": {
"command": "node",
"args": ["/đường-dẫn-tới/mcp-spring-boot-toolkit/dist/index.js"]
}
}
}
Development (dùng tsx, không cần build):
{
"mcpServers": {
"spring-boot-toolkit": {
"command": "npx",
"args": ["tsx", "/đường-dẫn-tới/mcp-spring-boot-toolkit/src/index.ts"]
}
}
}
Ví dụ sử dụng tools
Tạo Entity:
Tạo entity Product với fields: name (String, not null), price (BigDecimal), description (String), stock (Integer)
Tạo Controller + Service + Repository cho entity:
Tạo full CRUD cho entity Order bao gồm controller, service, repository, DTOs
Phân tích pom.xml:
Phân tích file pom.xml của tôi xem có vấn đề gì về dependency không
Tạo config:
Tạo application.yml cho project dùng PostgreSQL, có security, actuator, swagger, với 2 profiles dev và prod
Ví dụ sử dụng prompts
Review API:
Review controller UserController.java theo best practices
Debug lỗi:
Debug exception này: LazyInitializationException - could not initialize proxy...
Tối ưu query:
Tối ưu query trong OrderRepository, đang bị N+1 khi load OrderItems
Scripts
| Script | Mô tả |
|---|---|
npm run build |
Compile TypeScript → JavaScript (output vào dist/) |
npm run dev |
Chạy trực tiếp từ source bằng tsx |
npm start |
Chạy bản đã build |
Tech Stack
- Runtime: Node.js
- Language: TypeScript
- MCP SDK:
@modelcontextprotocol/sdk - Validation: Zod
- Transport: stdio
Cấu trúc project
mcp-spring-boot-toolkit/
├── src/
│ ├── index.ts # Entry point - khởi tạo MCP server
│ ├── tools.ts # Đăng ký 8 tools code generation
│ ├── prompts.ts # Đăng ký 6 prompts
│ ├── resources.ts # Đăng ký 4 resources
│ └── resources/ # Markdown guides
│ ├── project-structure.md
│ ├── security-checklist.md
│ ├── layered-architecture.md
│ └── api-design.md
├── dist/ # Build output
├── package.json
├── tsconfig.json
└── README.md
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.