perf(mcp): fast external MCP capability search#2570
Draft
reachjalil wants to merge 5 commits into
Draft
Conversation
Contributor
|
@reachjalil is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Speeds up Den
/mcp/agentexternal MCP capability discovery by adding boundedtools/list, a derived manifest cache, stale-while-revalidate refresh, and batched connection status reads.Before this branch, search listed tools sequentially for every granted external MCP connection and had no hard per-connection deadline. One slow or unavailable MCP could stall the whole external capability stage.
What Changed
tools/list.external_mcp_tool_manifestfor derived, non-secret tool metadata keyed by connection + principal.POST /v1/mcp-connections/:connectionId/refresh-tools; returns202 in_progresswhen another worker owns the lease.GET /v1/mcp-connectionsincludes caller-relevant tool status and batches manifest/account lookups.Reviewer Focus
shared; per-member OAuth uses the member principal so users never share cached tool lists.config_hashshould make URL/auth/credential-mode changes cache misses even if invalidation is missed.in_progressfor manual refresh.Security / Correctness
execute_capabilitystill live-checks grant + credential and calls the upstream MCP server directly; the cache only affects discovery.Runtime Controls
DEN_MCP_LIST_TOOLS_TIMEOUT_MS3500DEN_MCP_LIST_TOOLS_CONCURRENCY5DEN_MCP_MANIFEST_CACHE_ENABLEDtrueDEN_MCP_MANIFEST_FRESH_TTL_MS900000DEN_MCP_MANIFEST_MAX_AGE_MS86400000DEN_MCP_MANIFEST_MAX_BYTES262144DEN_MCP_MANIFEST_REFRESH_INTERVAL_MS300000DEN_MCP_MANIFEST_REFRESH_BATCH_SIZE20DEN_MCP_MANIFEST_REFRESH_LEASE_MS60000DEN_MCP_MANIFEST_REVALIDATE_CONCURRENCY3Not Included
tools/list_changedwatchers.Validation
pnpm --filter @openwork-ee/den-api buildpnpm --filter @openwork-ee/den-api exec tsc --noEmitpnpm --filter @openwork-ee/den-api exec bun test test/external-mcp-manifests.test.tspnpm --filter @openwork-ee/den-api exec bun test test/external-capabilities-search-divergence.test.tspnpm --filter @openwork-ee/den-api exec bun test test/mcp-connections-connect-start.test.tspnpm --filter @openwork-ee/den-db db:pushforopenwork_test_searchdivandopenwork_test_pr7