Skip to content

perf(mcp): cap and de-duplicate discovered remote tools before caching (AGT-4873) - #909

Open
unohee wants to merge 1 commit into
mainfrom
heewonoh/agt-4873-mcp-tool-cap
Open

unohee wants to merge 1 commit into
mainfrom
heewonoh/agt-4873-mcp-tool-cap

Conversation

@unohee

@unohee unohee commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

무엇

  • MAX_DISCOVERED_TOOLS_PER_SERVER(256) / MAX_DISCOVERED_TOOLS(1024) 추가 (MAX_INPUT_SCHEMA_* 옆).
  • 서버 안에서 같은 이름 도구는 첫 번째만 남기고, 버린 중복 수·상한 초과 수를 console.warn 으로 남긴다.
  • 전체 상한은 서버 응답 순서가 아니라 registry 순서로 자른다 (워커 4개가 병렬이라 응답 순서는 매번 다르다). 잘린 도구는 routing 에도 없어서 호출하면 MCP tool not registered.
  • 상한으로 잘린 결과는 unreachable 이 아니므로 complete 로 캐시된다 (재시도 루프 없음).

왜

스키마 크기·속성 수만 자르고 도구 개수와 이름 중복은 막지 않아, 원격 서버 하나가 수천 개 도구를 주면 그대로 캐시·노출됐다 (AGT-4873).

검증

  • npx vitest run src/mcp/ — 3 files / 55 tests 통과 (신규 2: 중복 이름 + 서버별 상한, 서버 6개로 전체 상한·registry 순서 절단).
  • npm run typecheck, oxlint src/mcp 0 errors.

…g (AGT-4873)

Discovery bounded schema size but not how many tools a server could
list, so one server returning thousands of tools was cached whole. Each
server now keeps at most 256 tools and the whole set at most 1024; a
repeated name keeps its first entry. Dropped counts are logged, and the
global cap trims in registry order so the result does not depend on
which server answered first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant