Repository navigation
feat: expose mode/ocr/model in parse_document and report applied mode - #15
Merged
Merged
Conversation
mcp 2.0.0(2026-07-28)에서 mcp.server.fastmcp 가 제거돼, 상한 없는 `mcp[cli]>=1.6.0` 으로 새로 설치하면(uvx mcp-upstage 포함) import 단계에서 ModuleNotFoundError 로 서버가 뜨지 않는다. - pyproject: mcp[cli]>=1.6.0,<2 - uv.lock 재생성 (기존 고정 버전 변경 없음, 누락돼 있던 dev extra 추가) - __version__ 0.1.3 - CI 추가: lockfile 없이 pip install ".[dev]" 후 server import + pytest (Python 3.10/3.12). 상한 없는 의존성이 깨지면 CI 가 먼저 잡는다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parse_document 툴 스키마에 mode 가 없어 클라이언트가 mode="enhanced" 를 보내도 FastMCP 가 조용히 버리고 standard 로 처리했다. 에러가 없으니 사용자는 enhanced 결과를 받았다고 믿게 된다. - parse_document 에 mode(standard|enhanced|auto, 기본 standard), ocr(auto|force, 기본 force), model(기본 document-parse) 추가. description 에 enhanced/auto 를 고를 근거와 비용·속도 차이를 적었다. - 반환 텍스트 끝에 API 가 돌려준 model·usage 를 붙인다. standard/enhanced 요청인데 usage 에 해당 키가 없거나 다른 모드가 섞이면 WARNING 줄을 붙인다. auto 는 비교하지 않는다. - ctx.info/error 를 await (document_parser, info_extractor). - 저장 실패 경로의 ctx.warn(없는 메서드) → await ctx.warning. - 반환 JSON 을 ensure_ascii=False 로 만들어 한글 이스케이프 제거. - tenacity 재시도가 실제로 동작하도록 재구성: 안쪽 _post_with_retry 만 재시도하고 바깥에서 에러 메시지를 한 번 만든다. 연결 오류·429·5xx 만 재시도하고 그 밖의 4xx 는 바로 실패한다. - README 파라미터·비용 안내, 버전 0.2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
리뷰 반영. - 재시도 범위 축소: 파싱 엔드포인트는 유료이고 멱등하지 않아, 읽기 타임아웃·연결 끊김·500/502/504 는 서버가 이미 처리·과금한 뒤일 수 있다. ConnectError·ConnectTimeout·PoolTimeout 과 429·503 만 재시도한다. - usage 에 모드별 키가 없을 때(구버전 고정 모델 등)는 불일치가 아니라 "확인 불가"로 본다. standard 요청이면 조용히, enhanced 요청이면 Note 한 줄만 붙인다. 실제 불일치 WARNING 은 그대로. - mode 는 standard 가 아닐 때만 form 에 싣는다. API 기본값이 standard 이고, 필드를 모르는 구버전 모델·게이트웨이에서 400 이 나지 않게 한다. - 테스트: 재시도 상태코드·예외 파라미터화, 모드 키 없는 usage, info_extractor ctx.info await, JSON 아닌 200 응답. - CI: uv.lock 기준 잡(uv lock --check, uv sync --frozen) 추가, 잡마다 timeout-minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
리뷰 기록독립 리뷰 2라운드를 거쳤습니다. 1라운드: REQUEST CHANGES (
2라운드: APPROVE ( 남은 비차단 지적은 두 가지입니다. 🤖 Generated with Claude Code |
There was a problem hiding this comment.
🔆 CodeSolar review ✅ Looks good
Adds mode/ocr/model parameters to parse_document, reports actual processing mode in responses, fixes un-awaited ctx calls, ctx.warn→ctx.warning, ensure_ascii=False, and restricts tenacity retries to safe (pre-processing) failures only. Tests are comprehensive and verify each change.
✅ No issues worth flagging.
solar-pro4 (openrouter) · 9 files · +1129/-207 · 142.2s · CodeSolar
Comment /codesolar on this PR to re-run the review.
inahjeon
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
parse_document툴에mode인자가 없습니다. MCP 클라이언트가mode="enhanced"를 넘겨도 FastMCP가 모르는 인자를 조용히 버리고 성공을 돌려줍니다. 사용자는 enhanced로 처리됐다고 믿지만 실제로는 standard입니다.같은 1페이지 문서로 확인한 결과입니다.
usageparse_document(mode="enhanced")(현재){"pages": 1, "standard": [1]}mode=enhanced{"pages": 1, "enhanced": [1]}변경
옵션 노출.
parse_document에mode(standard/enhanced/auto, 기본standard),ocr(auto/force, 기본force로 기존 동작 유지),model(기본document-parse, 버전 고정용)을 추가했습니다. 필드 설명에 enhanced·auto를 언제 쓰는지, 비용이 더 든다는 점을 적었습니다.mode는standard가 아닐 때만 전송합니다. 기존에 보내지 않던 필드라 구버전 모델이나 게이트웨이에서 400이 날 위험을 피하려는 것이고, 생략 시 standard로 처리되는 것은 실호출로 확인했습니다.실제 처리 모드 표시. 반환 텍스트 끝에 API가 알려준 실제 처리 정보를 붙입니다.
요청한 모드와
usage가 어긋나면 WARNING을 붙입니다. 클라이언트가 옛 툴 스키마를 캐시하는 등의 이유로 모드가 또 조용히 빠지더라도 사용자가 알 수 있게 하려는 장치입니다.auto는 페이지별로 섞일 수 있어 비교하지 않고,usage에 모드별 키가 없으면 단정하지 않고 "확인 불가" 안내만 남깁니다.기존 결함 수정.
ctx.info,ctx.error를 await하지 않아 호출마다RuntimeWarning: coroutine ... was never awaited가 나고 로그가 클라이언트에 전달되지 않던 문제ctx.warn(존재하지 않는 메서드)이AttributeError로 툴 전체를 실패시키던 문제 →ctx.warning\uXXXX로 이스케이프돼 LLM 입력 토큰이 늘던 문제 →ensure_ascii=FalseException으로 바꿔 던졌기 때문입니다. 재시도를 살리되, 유료이고 멱등이 아닌 엔드포인트라 서버가 이미 처리했을 수 있는 실패는 재시도하지 않습니다. 재시도 대상은 연결 전 실패(ConnectError,ConnectTimeout,PoolTimeout)와 429·503뿐이고,ReadTimeout, 500·502·504 등은 첫 시도에서 실패를 돌려줍니다. 그렇지 않으면 enhanced 다페이지 문서가 타임아웃에 걸릴 때 최대 3회 중복 처리되고 약 15분 동안 매달릴 수 있습니다.CI. lock 정합성(
uv lock --check,uv sync --frozen) job과timeout-minutes를 추가했습니다. README에 새 파라미터를 문서화했고, 버전은 0.2.0입니다.검증
mode전송 제거, 재시도 정책 롤백, 모드 불일치 경고 제거,ctx.warning→ctx.warn, await 제거 등을 하나씩 되돌려 해당 테스트가 실패하는 것을 확인usage{}{"pages": 1, "standard": [1]}{"mode": "enhanced"}{"pages": 1, "enhanced": [1]}{"mode": "auto"}{"pages": 1, "enhanced": [1]}후속 (이 PR 범위 밖)
mode·ocr·model추가server.py의 시작 메시지print가 stdout으로 나가 stdio 프로토콜을 오염시킬 수 있는 문제🤖 Generated with Claude Code