Skip to content

feat: 코인 백엔드 Swagger MCP 추가 (develop)#2250

Open
ImTotem wants to merge 14 commits into
developfrom
feature/2239-swagger-mcp
Open

feat: 코인 백엔드 Swagger MCP 추가 (develop)#2250
ImTotem wants to merge 14 commits into
developfrom
feature/2239-swagger-mcp

Conversation

@ImTotem
Copy link
Copy Markdown
Collaborator

@ImTotem ImTotem commented May 19, 2026

🔍 개요


🚀 주요 변경 내용

  • Spring AI MCP server 설정 및 Streamable HTTP 기반 MCP Tool 등록
  • find_endpoints, get_endpoint_description, get_endpoint_request_spec, get_endpoint_response_spec Tool 추가
  • Spring MVC handler mapping과 springdoc OpenAPI 정보를 활용해 실제 endpoint와 Swagger 명세 기반 정보를 조합
  • Swagger group alias, deprecated 필터, 인증 필요 여부, request parameter/body, response status/body schema 제공
  • 공통 MCP 에러 응답 구조
  • EndpointSpecService 책임 분리
    • EndpointCatalog
    • EndpointSchemaiMapper
    • McpOpenApiProvider

💬 참고 사항

  • MCP Tool은 API 요청을 직접 보내지 않으며, 명세 조회 전용입니다.
  • deprecated 여부는 @Operation(deprecated = true) 또는 @Deprecation 기반으로 판단합니다.
  • schema는 가능한 한 $ref 대신 펼쳐서 내려주며, 순환/깊이 제한이 필요한 경우 truncated로 표시합니다.
  • 로컬 실행 서버에서 Codex MCP Tool 호출로 주요 응답 구조를 확인했습니다.

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@ImTotem ImTotem self-assigned this May 19, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 09:11
@ImTotem ImTotem added 기능 새로운 기능을 개발합니다. 공통 백엔드 공통으로 작업할 이슈입니다. labels May 19, 2026
@github-actions github-actions Bot added the 문서 문서화와 관련된 이슈입니다. label May 19, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@ImTotem has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 7 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad05c5b7-55b2-4915-adad-76a0a2a0aa9f

📥 Commits

Reviewing files that changed from the base of the PR and between 915ffe1 and 01cab37.

📒 Files selected for processing (30)
  • .env.example
  • build.gradle
  • src/main/java/in/koreatech/koin/global/code/Deprecation.java
  • src/main/java/in/koreatech/koin/global/code/DeprecationOperationCustomizer.java
  • src/main/java/in/koreatech/koin/global/config/SwaggerGroupConfig.java
  • src/main/java/in/koreatech/koin/mcp/McpConstants.java
  • src/main/java/in/koreatech/koin/mcp/config/McpToolConfig.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/EndpointCandidate.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/EndpointDescription.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/EndpointSummary.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/FindEndpointsResponse.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/ReplacedBy.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/request/EndpointParameter.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/request/EndpointParameters.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/request/EndpointRequestSpec.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/request/RequestBodySpec.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/response/EndpointResponse.java
  • src/main/java/in/koreatech/koin/mcp/dto/endpoint/response/EndpointResponseSpec.java
  • src/main/java/in/koreatech/koin/mcp/dto/error/McpError.java
  • src/main/java/in/koreatech/koin/mcp/dto/error/McpErrorResponse.java
  • src/main/java/in/koreatech/koin/mcp/dto/schema/EndpointSchema.java
  • src/main/java/in/koreatech/koin/mcp/exception/EndpointSpecException.java
  • src/main/java/in/koreatech/koin/mcp/model/DeprecatedFilter.java
  • src/main/java/in/koreatech/koin/mcp/model/EndpointEntry.java
  • src/main/java/in/koreatech/koin/mcp/service/EndpointCatalog.java
  • src/main/java/in/koreatech/koin/mcp/service/EndpointSchemaMapper.java
  • src/main/java/in/koreatech/koin/mcp/service/EndpointSpecService.java
  • src/main/java/in/koreatech/koin/mcp/service/McpOpenApiProvider.java
  • src/main/java/in/koreatech/koin/mcp/tool/EndpointSpecTools.java
  • src/main/resources/application.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2239-swagger-mcp

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot requested review from DHkimgit and taejinn May 19, 2026 09:12
@ImTotem ImTotem requested review from Soundbar91 and kongwoojin and removed request for DHkimgit and taejinn May 19, 2026 09:12
@github-actions github-actions Bot requested review from BaeJinho4028 and kih1015 May 19, 2026 09:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.server in application.yml, Spring AI BOM/dependency, -parameters compile flag) and four MCP tools wired through MethodToolCallbackProvider.
  • 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 @Deprecation annotation and DeprecationOperationCustomizer, and apply it to all GroupedOpenApi groups in SwaggerGroupConfig.

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.

Comment on lines +214 to +231
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,
Comment on lines +111 to +140
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;
}
Comment on lines +153 to +155
return pathItem.readOperationsMap().get(PathItem.HttpMethod.valueOf(method));
}

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Unit Test Results

672 tests  ±0   669 ✔️ ±0   1m 29s ⏱️ +12s
166 suites ±0       3 💤 ±0 
166 files   ±0       0 ±0 

Results for commit 01cab37. ± Comparison against base commit 915ffe1.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

공통 백엔드 공통으로 작업할 이슈입니다. 기능 새로운 기능을 개발합니다. 문서 문서화와 관련된 이슈입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] swagger mcp 추가

2 participants