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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。