[Feat] MCP 서버 골격 및 도구 3종 스켈레톤 등록 - #95
Conversation
spring-ai-bom 1.1.8 기반 spring-ai-starter-mcp-server-webmvc를 도입하고 protocol=STREAMABLE, annotation-scanner.enabled=true로 설정한다.
@McpTool/@McpToolParam 어노테이션 스캔이 정상 동작하는지 검증하기 위해 search_documents, get_document_detail, get_indexing_status 빈 핸들러를 등록한다. 실제 로직은 후속 이슈에서 구현한다.
/mcp/** 를 임시로 permitAll 처리한다. API 키 인증 필터(McpApiKeyAuthFilter)는 다음 이슈에서 구현 후 이 예외를 교체한다.
Spring AI 1.1.x 채택 근거, javap로 검증한 SDK 내부 구조(패키지 경로, 설정 프로퍼티, #4882/#4392 회피 경로), tools/list 실제 검증 결과를 기록한다.
|
Warning Review limit reached
Next review available in: 46 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughSpring AI MCP WebMVC Starter를 추가했다. Streamable 동기식 MCP 서버를 설정했다. 세 개의 빈 도구를 등록했다. ChangesMCP 서버 스켈레톤
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant MCPWebMVCEndpoint
participant AnnotationScanner
participant DocGridMcpTools
MCPClient->>MCPWebMVCEndpoint: initialize 요청
MCPWebMVCEndpoint->>AnnotationScanner: `@McpTool` 스캔
AnnotationScanner->>DocGridMcpTools: 세 도구 등록
MCPClient->>MCPWebMVCEndpoint: tools/list 요청
MCPWebMVCEndpoint-->>MCPClient: 세 도구와 입력 스키마 반환
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
# Conflicts: # src/main/resources/application.yml
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/design/kangcheolung-`#93-mcp-server-skeleton.md:
- Line 171: Remove the `// get_document_detail, get_indexing_status 도 동일하게 정상
반환됨` comment from the JSON example near the MCP server response documentation,
and move the omitted-fields explanation outside the JSON code block so the
example remains valid JSON.
In `@src/main/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpTools.java`:
- Around line 7-8: DocGridMcpTools 클래스에 클래스 수준 Javadoc을 추가하여 MCP 프로토콜의 입력·출력 경계만
담당하고 검색, 권한, 문서 조회 규칙은 도메인 서비스에 위임한다는 역할과 책임 범위를 명시하세요.
- Around line 10-34: Update the `@McpTool` annotations on searchDocuments,
getDocumentDetail, and getIndexingStatus to explicitly set readOnlyHint = true
and destructiveHint = false. Do not alter their authentication or authorization
behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 40fb674b-a74a-43c4-961a-25781118ba03
📒 Files selected for processing (5)
build.gradledocs/design/kangcheolung-#93-mcp-server-skeleton.mdsrc/main/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpTools.javasrc/main/java/com/opensource/docgrid/global/config/SecurityConfig.javasrc/main/resources/application.yml
| @Component | ||
| public class DocGridMcpTools { |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
DocGridMcpTools의 역할과 경계를 설명하는 Javadoc을 추가해 주세요.
이 클래스는 새로 생성되었지만 클래스 수준 주석이 없습니다. MCP 프로토콜 입력·출력 경계만 담당하고 검색·권한·문서 조회 규칙은 도메인 서비스에 위임한다는 역할을 명시하세요.
제안
+/**
+ * DocGrid 문서 조회 기능을 MCP 도구로 노출하는 어댑터다.
+ *
+ * 프로토콜 경계만 담당하고 검색·권한·문서 조회 규칙은 도메인 서비스에 위임한다.
+ */
`@Component`
public class DocGridMcpTools {As per coding guidelines: “Every newly created class, interface, or record must have a class-level comment explaining its role, responsibility, and boundary.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @Component | |
| public class DocGridMcpTools { | |
| /** | |
| * DocGrid 문서 조회 기능을 MCP 도구로 노출하는 어댑터다. | |
| * | |
| * 프로토콜 경계만 담당하고 검색·권한·문서 조회 규칙은 도메인 서비스에 위임한다. | |
| */ | |
| `@Component` | |
| public class DocGridMcpTools { |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpTools.java`
around lines 7 - 8, DocGridMcpTools 클래스에 클래스 수준 Javadoc을 추가하여 MCP 프로토콜의 입력·출력
경계만 담당하고 검색, 권한, 문서 조회 규칙은 도메인 서비스에 위임한다는 역할과 책임 범위를 명시하세요.
Source: Coding guidelines
annotations 속성을 생략하면 SDK 기본값(readOnlyHint=false, destructiveHint=true)이 그대로 노출되어 조회 전용 도구가 파괴적 작업처럼 클라이언트에 선언되는 문제를 수정한다.
JSON 코드블록 안의 주석을 밖으로 빼고, readOnlyHint/destructiveHint 항목을 '다음 이슈' TODO에서 '이번 이슈 반영 완료'로 옮긴다.
배경
DocGrid의 검색/문서조회/인덱싱상태 조회 기능을 MCP 표준(JSON-RPC 2.0, Streamable HTTP)으로 노출해
Claude Desktop 같은 AI Agent가 직접 호출할 수 있게 하는 MCP Server 블록의 첫 번째 이슈입니다.
Spring AI MCP SDK 연동이 이 프로젝트에서 처음 시도되는 것이라, 실제 검색/권한 로직을 붙이기 전에
어노테이션 스캔 기반 도구 등록이 정상 동작하는지부터 검증할 필요가 있었습니다.
변경 사항
spring-ai-bom:1.1.8+spring-ai-starter-mcp-server-webmvc의존성을 추가하고 Streamable HTTP(protocol=STREAMABLE,type=SYNC)로 설정했습니다.@McpTool/@McpToolParam어노테이션으로search_documents/get_document_detail/get_indexing_status빈 핸들러 3개를 등록했습니다 (실제 로직은 후속 이슈)./mcp/**를 임시로permitAll처리했습니다 (다음 이슈에서 API 키 인증 필터로 교체 예정, TODO 명시).tools/list검증 결과를 기록했습니다.검증
./gradlew compileJava정상 컴파일initialize→tools/list흐름을 직접 호출해 도구 3종의name/description/inputSchema(필수값 포함)가 정상 반환되는 것을 확인했습니다.Registered tools: 3확인.문서
docs/design/kangcheolung-#93-mcp-server-skeleton.mdCloses #93
Summary by CodeRabbit
새 기능
문서
제한 사항