Expose capability-gated Search API tools - #210
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 400688a. Configure here.
rgarcia
left a comment
There was a problem hiding this comment.
reviewed — the tool shape and non-retryable search call look good, but i'd change capability discovery and improve the advertised request contract before merging.
Changes requested
-
src/app/[transport]/route.ts:195-203,src/lib/mcp/search-access.ts:7-37— please determine whether this credential can callPOST /searchfrom the capabilities/entitlements endpoint once per MCP connection, then use that result to decide whetherweb_searchappears intools/list. Do not preflightGET /search/providersor recheck Search capability on every MCP request: provider discovery describes configured providers and options, not entitlement, and the current probe adds an upstream request (up to a five-second wait) to unrelated calls. If/org/entitlementsis the intended source, please add an explicit Search entitlement there (and to its API schema), since it currently advertisesvaultsbut notsearch. Keepprovidersas an explicit action for live provider discovery; update the README and routing tests to reflect connection-time gating. -
src/lib/mcp/tools/search.ts:36-95— please carry the keypackages/api/openapi.yamlsemantics into descriptions on the nested MCP request fields, especially the default/behavior ofstrategy, best-effort filters versusstrict_params, and whatcontent: trueand browser options do. The action shape matches other MCP tools, but without those descriptions clients see valid types without enough guidance to choose safe and effective inputs.
00fbc5c to
b976948
Compare
rgarcia
left a comment
There was a problem hiding this comment.
one follow-up on entitlement lookup behavior — sorry for asking you to clean up the pre-existing per-request vault lookup i introduced while working on this search PR.
src/app/[transport]/route.ts:176-187, src/lib/mcp/entitlements.ts:39-79 — please resolve entitlements on every tools/list and on calls to entitlement-gated tools, but not on unrelated tool calls. Cache the entitlement snapshot in memory per credential + MCP connection for 30 minutes (credential-bound TTL for stateless clients), rather than caching only the Search boolean for five minutes while still fetching /org/entitlements on every request. Keep the cache bounded and evict expired entries so it cannot grow indefinitely; don't retain transient lookup failures for the full TTL. The cache should control MCP tool exposure only: keep authenticating requests and let the Kernel API enforce access when a gated tool is invoked.
rgarcia
left a comment
There was a problem hiding this comment.
re-reviewed the latest changes: entitlement lookups are scoped to tools/list and gated tool calls, the bounded 30-minute cache covers vaults and Search, and the requested Search API descriptions are in place. focused tests pass.

Summary
web_searchwithcreate,get, andprovidersoperations, portable search parameters, provider-native options, project selection, and API response preservation.tools/listand calls to entitlement-gated tools only. Cache the full entitlement snapshot per credential and MCP connection for up to 30 minutes; transient failures are not cached.API assumptions and scope
GET /org/entitlementsprovides the explicit Search feature flag. The MCP server does not use/search/providersas an access probe; that operation remains available for live provider discovery when the Search tool is enabled.The pinned SDK does not yet include generated Search resources, so these calls use its public authenticated transport. Deferred content retrieval is not exposed; this change covers implemented search, retained-result, and provider-discovery endpoints only.
Tests
git diff --checkpass.bun run buildcompiled and passed TypeScript, then stopped during page-data collection because requiredKERNEL_CLI_PROD_CLIENT_IDenvironment configuration is absent.