Skip to content

perf(mcp): cache external tool discovery for search#2967

Draft
reachjalil wants to merge 1 commit into
different-ai:devfrom
reachjalil:feature/external-mcp-search-cache-v2
Draft

perf(mcp): cache external tool discovery for search#2967
reachjalil wants to merge 1 commit into
different-ai:devfrom
reachjalil:feature/external-mcp-search-cache-v2

Conversation

@reachjalil

Copy link
Copy Markdown
Collaborator

Summary

  • add a 60-second process-local cache for external MCP tool discovery used by search
  • coalesce concurrent misses and avoid caching failures
  • retain complete sanitized tool schemas so argumentsSchema, schemaDigest, and invocation metadata stay current
  • key entries by organization, connection, principal, endpoint, auth and credential mode, connection version, and connected-account version
  • bound retention to 256 entries and 16 MiB with LRU eviction; oversized catalogs are not retained

Why this version

The useful latency goal from #2570 is preserved without reviving its large persisted-manifest migration. Authorization and credential checks remain live, execution still performs live schema discovery, and only search discovery is cached.

Checks

  • bun test test/external-mcp-search-cache.test.ts — 5 passed
  • focused integration: repeated search variants reuse the full current external tool catalog — 1 passed
  • benchmark fixture: cold 20.38 ms / 4 remote requests; warm 2.79 ms / 0 remote requests
  • pnpm --filter @openwork-ee/den-api exec tsc --noEmit -p tsconfig.json
  • git diff --check

Risk and gaps

  • cache lifetime is process-local, so cold starts still discover tools remotely
  • the benchmark is a deterministic local fixture, not a production latency claim
  • backend-only change; no UI manual journey applies
  • full Den API suite was not run in this branch

Supersedes #2570.

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 21, 2026 2:02pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Jul 21, 2026 2:02pm

@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics July 21, 2026 14:01 Inactive
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown
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.

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