Skip to content

perf(mcp): fast external MCP capability search#2570

Closed
reachjalil wants to merge 7 commits into
different-ai:devfrom
reachjalil:feature/fast-external-mcp-search
Closed

perf(mcp): fast external MCP capability search#2570
reachjalil wants to merge 7 commits into
different-ai:devfrom
reachjalil:feature/fast-external-mcp-search

Conversation

@reachjalil

@reachjalil reachjalil commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Warning

Queue audit (2026-07-17): returned to draft — do not merge this revision. Bounded capability discovery remains valuable, but this 18-file / 10k-line cache implementation predates the current OAuth recovery, connection diagnostics, and capability-source behavior. Reslice it after measuring current search latency; start with cache semantics/invalidation tests and add persistence only if the benchmark justifies it.

Manager summary

This makes External MCP capability discovery fast and bounded by caching derived tools/list manifests. A warm search reads tenant/principal-scoped cache rows instead of calling every remote MCP server, while execution still performs live authorization and invokes the provider directly.

What changed

Area Result
Manifest cache Stores non-secret tool metadata keyed by connection, credential principal, and configuration hash.
Read path Batch-loads manifests and connection/account state; fresh rows serve directly, stale rows serve with bounded background revalidation, and misses refresh live.
Refresh lifecycle Adds leases, maintenance refresh, manual refresh, list health, and invalidation after disconnect, deletion, OAuth callback, configuration changes, and unknown-tool responses.
Isolation Shared credentials use a shared principal; member OAuth uses the member principal. Access grants are checked live before cache use.
Failure behavior Cache/database failures remain an optimization failure and fall back safely; upstream structured connection diagnostics remain authoritative.

Performance evidence

Focused benchmark on the current branch:

Path Time Remote tools/list calls
Cold 6.98 ms 4
Warm 1.27 ms 0

The branch preserves the upstream 16-connection cap, concurrency 4, and lifecycle deadline. The obsolete branch-specific discovery-concurrency knob was removed during the upstream integration.

Security and correctness

  • Tokens, API keys, connection headers, and tool arguments are never stored in manifest rows.
  • Configuration hashes prevent reuse after endpoint/auth/config changes, even if an invalidation signal is missed.
  • execute_capability still checks grants and credentials live and calls the remote server directly.
  • Manual refresh contention returns in_progress rather than duplicating refresh work.
  • Late refreshes cannot stamp current configuration over an older manifest.

Validation

  • 41 focused manifest, marketplace, policy, divergence, benchmark, and OAuth discovery-route tests passed.
  • Den API typecheck passed.
  • Fresh isolated database schema push passed; repeat generation reports no schema changes.
  • GitHub schema/migration check, Linux/macOS OpenWork tests, Den/inference artifact builds, i18n, and Helm validation passed on the current head.
  • Migration is currently 0037_tranquil_big_bertha; after another schema PR merges, rebase and regenerate it before landing.

Reviewer focus

  1. Tenant/principal/config-hash cache key and live grant checks.
  2. Stale-while-revalidate leases and invalidation coverage.
  3. Optimization-only failure behavior and preservation of structured diagnostics.
  4. The migration and maintenance-query bounds.

@vercel

vercel Bot commented Jul 8, 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.

@vercel

vercel Bot commented Jul 8, 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 13, 2026 6:53pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-app-i7ru Skipped Skipped Jul 13, 2026 6:53pm

@reachjalil reachjalil changed the title Add fast external MCP capability search Proposal draft: Fast external MCP capability search Jul 8, 2026
@reachjalil reachjalil changed the title Proposal draft: Fast external MCP capability search Draft proposal: Fast external MCP capability search Jul 8, 2026
@reachjalil reachjalil changed the title Draft proposal: Fast external MCP capability search perf(mcp): fast external MCP capability search Jul 8, 2026
@vercel
vercel Bot temporarily deployed to Preview – openwork-app-i7ru July 13, 2026 18:52 Inactive
@reachjalil
reachjalil marked this pull request as ready for review July 13, 2026 18:55
@reachjalil
reachjalil marked this pull request as draft July 17, 2026 08:22
@reachjalil

Copy link
Copy Markdown
Collaborator Author

Superseded by #2967, rebuilt on current dev as a bounded search-only external MCP discovery cache that preserves current schemas and live execution behavior.

@reachjalil reachjalil closed this Jul 21, 2026
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