Repository navigation
feat(mcp): add opt-in permission-aware deferred tool discovery - #38
Conversation
Add multillm.tools.discover on both MCP endpoints behind DEFERRED_TOOLS_ENABLED (default off): grant-filtered local ranking with complete schemas, signed short-lived cursors, and grant and argument rechecks before every tool call. Grants live in the new tool_grants table (migration 0018) with compatibility rows for current tools.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | 6cabc31 | Oct 09 2026, 12:31 AM |
…o feat/deferred-tools # Conflicts: # package.json
c7fa539
into
integrate/gateway-waves-1-3
Summary
Adds permission-aware deferred tool discovery behind
DEFERRED_TOOLS_ENABLED, which defaults to false. With the flag off, tool lists, tool calls, schemas, responses, headers and storage access are unchanged, andmultillm.tools.discoverreturns the existing method-not-found error./v1/mcpon the gateway and/mcpfor Knowledge) acceptmultillm.tools.discover, with a query and a limit of 1–16 tools:inputSchema. A schema is never shortened: one that cannot fit returns 413tool_schema_too_large.tools/listreturns only granted tools.tools/callrereads grants and validates the full argument schema before dispatch, including for tools the caller never discovered.tool_not_granted.tool_grants(migration0018):*compatibility rows for every current tool, using the tool's existing required scope, so existing scope holders keep their access.jsonschemalibrary.tool_grantsoperation on the private model-state endpoint. The Worker readsINTELLIGENCE_DBdirectly.Details are in
docs/deferred-tools.md.Known limitation
There is no admin endpoint or dashboard for editing grants yet. Operators change
tool_grantsrows with D1 SQL and should bump the row revision in the same statement.Deployment
Apply migration 0018 before enabling the flag. A push to main does not apply D1 migrations:
Stacking
This is the first Wave 4 migration (
0018). Later Wave 4 PRs that add migrations (0019–0023) stack on it, so that each PR keeps the contiguous numberingcf:migrations:checkrequires.Shared registrations
tests/test_deferred_tools_worker.mjstotest:worker.DEFERRED_TOOLS_ENABLEDto the Container env keys.tool_grantsto the D1 readiness tables.worker/knowledge/deferred-tools.mjsto the secret firewall inventory.Tests
tests/test_deferred_tools.pyandtests/test_deferred_tools_worker.mjsare new. They cover:/mcproutes (allowed, scope-denied, pin-mismatch and non-object calls; discover returning -32601);tool_grantsread and its 503 when the table is missing.npm run test:worker: 1,374 passed.npm run test:integration: 7 passed.cf:migrations:checkreports 18 contiguous, additive migrations.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.tests/test_frontend_build.mjsfails locally because@tailwindcss/cliis not installed. It fails the same way on main.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.#43 stacks on this branch.
This is part of Wave 4. It is based on
integrate/gateway-waves-1-3, and the Wave 4 integration PR adds the README line.