feat: 코인 백엔드 Swagger MCP 추가 (develop)#2250
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (30)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Pull request overview
Adds a Spring AI MCP server that exposes read-only tools for discovering KOIN API endpoint specs (descriptions, request specs, response specs) derived from Spring MVC handler mappings and springdoc OpenAPI metadata. Adds a @Deprecation annotation plus an OperationCustomizer to enrich Swagger output, and refactors the spec service into EndpointCatalog, EndpointSchemaMapper, and McpOpenApiProvider.
Changes:
- Add MCP server config (
spring.ai.mcp.serverin application.yml, Spring AI BOM/dependency,-parameterscompile flag) and four MCP tools wired throughMethodToolCallbackProvider. - Implement endpoint discovery and OpenAPI schema mapping (with $ref expansion, depth/cycle truncation, fallback schemas, error-response defaults) gated by
spring.ai.mcp.server.enabled. - Introduce
@Deprecationannotation andDeprecationOperationCustomizer, and apply it to allGroupedOpenApigroups inSwaggerGroupConfig.
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle | Adds Spring AI BOM, MCP starter, and -parameters compile flag. |
| .env.example | Adds KOIN_MCP_ENABLED toggle. |
| src/main/resources/application.yml | Configures Spring AI MCP server (streamable HTTP, capabilities). |
| src/main/java/in/koreatech/koin/mcp/McpConstants.java | Centralizes the enabled-property name. |
| src/main/java/in/koreatech/koin/mcp/config/McpToolConfig.java | Registers MCP tool callbacks from EndpointSpecTools. |
| src/main/java/in/koreatech/koin/mcp/tool/EndpointSpecTools.java | Defines the four @Tool methods and parses the deprecated filter. |
| src/main/java/in/koreatech/koin/mcp/service/EndpointSpecService.java | Orchestrates catalog + schema mapper to build response DTOs. |
| src/main/java/in/koreatech/koin/mcp/service/EndpointCatalog.java | Builds endpoint entries from handler mapping + grouped OpenAPI. |
| src/main/java/in/koreatech/koin/mcp/service/EndpointSchemaMapper.java | Resolves $refs and converts OpenAPI schemas to MCP DTOs. |
| src/main/java/in/koreatech/koin/mcp/service/McpOpenApiProvider.java | Exposes per-group OpenAPI via subclassed OpenApiWebMvcResource. |
| src/main/java/in/koreatech/koin/mcp/model/* | Adds EndpointEntry record and DeprecatedFilter enum. |
| src/main/java/in/koreatech/koin/mcp/exception/EndpointSpecException.java | Domain exception carrying code/details/candidates. |
| src/main/java/in/koreatech/koin/mcp/dto/** | New DTOs (summaries, descriptions, parameters, schemas, errors). |
| src/main/java/in/koreatech/koin/global/code/Deprecation.java | New deprecation metadata annotation. |
| src/main/java/in/koreatech/koin/global/code/DeprecationOperationCustomizer.java | Springdoc customizer that emits deprecation extensions. |
| src/main/java/in/koreatech/koin/global/config/SwaggerGroupConfig.java | Wires the new deprecation customizer into all OpenAPI groups. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private void resolveChildSchemas( | ||
| Schema<?> schema, | ||
| Map<String, ?> referencedSchemas, | ||
| Set<String> resolvingRefs, | ||
| int depth | ||
| ) { | ||
| if (schema.getProperties() != null) { | ||
| schema.getProperties().replaceAll((name, property) -> | ||
| resolveRefs(property, referencedSchemas, resolvingRefs, depth + 1)); | ||
| } | ||
| if (schema.getItems() != null) { | ||
| schema.setItems(resolveRefs(schema.getItems(), referencedSchemas, resolvingRefs, depth + 1)); | ||
| } | ||
| if (schema.getAdditionalProperties() instanceof Schema<?> additionalProperties) { | ||
| schema.setAdditionalProperties( | ||
| resolveRefs(additionalProperties, referencedSchemas, resolvingRefs, depth + 1)); | ||
| } | ||
| } |
| entry.tags(), | ||
| entry.deprecated(), | ||
| deprecation == null ? null : deprecation.reason(), | ||
| deprecation == null || deprecation.replacedByMethod().isBlank() && deprecation.replacedByPath().isBlank() |
| operation, | ||
| operationTags(operation, handlerMethod.getBeanType(), docsMethod), | ||
| deprecation, | ||
| operation != null && Boolean.TRUE.equals(operation.getDeprecated()) || deprecation != null, |
| private List<EndpointEntry> entries() { | ||
| List<EndpointEntry> entries = new ArrayList<>(); | ||
| handlerMapping.getHandlerMethods().forEach((info, handlerMethod) -> { | ||
| if (!handlerMethod.getBeanType().getPackageName().startsWith(ROOT_PACKAGE)) { | ||
| return; | ||
| } | ||
| Method docsMethod = findDocsMethod(handlerMethod); | ||
| Deprecation deprecation = findDeprecation(docsMethod); | ||
|
|
||
| for (String path : paths(info)) { | ||
| for (String group : groupsOf(handlerMethod.getBeanType(), path)) { | ||
| for (String method : methods(info)) { | ||
| Operation operation = openApiOperation(group, method, path); | ||
| entries.add(new EndpointEntry( | ||
| group, | ||
| method, | ||
| path, | ||
| docsMethod, | ||
| operation, | ||
| operationTags(operation, handlerMethod.getBeanType(), docsMethod), | ||
| deprecation, | ||
| operation != null && Boolean.TRUE.equals(operation.getDeprecated()) || deprecation != null, | ||
| authRequired(docsMethod, operation) | ||
| )); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| return entries; | ||
| } |
| return pathItem.readOperationsMap().get(PathItem.HttpMethod.valueOf(method)); | ||
| } | ||
|
|
🔍 개요
🚀 주요 변경 내용
find_endpoints,get_endpoint_description,get_endpoint_request_spec,get_endpoint_response_specTool 추가EndpointSpecService책임 분리EndpointCatalogEndpointSchemaiMapperMcpOpenApiProvider💬 참고 사항
@Operation(deprecated = true)또는@Deprecation기반으로 판단합니다.truncated로 표시합니다.✅ Checklist (완료 조건)