Repository navigation
Conversation
The protected-resource metadata no longer lists scopes_supported, so MCP clients request no scopes and the authorization server's consent page, where the person connecting chooses permissions and projects, decides. When a Kernel-issued token names the actions it was granted, toolsets none of those actions can use are left out of the tool list, and get_connection_context reports the granted actions and projects. A token that names no action, and every API key, lists every toolset as before. The API still authorizes each call.
|
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 2 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 a6ff090. Configure here.
…sion-consent # Conflicts: # src/app/[transport]/route.ts # src/lib/mcp/tools/connection-context.ts
Make the toolset-to-resource-kind table exhaustive so a new toolset cannot be added without deciding how a granted permission affects it. Task tools need a tasks action; workload identity tools, like API key tools, are never listed for a token that names actions. Document that the vault and search tools also need organizations:read, because entitlements are read with the connection's token.
masnwilliams
left a comment
There was a problem hiding this comment.
approving. the change is small and the shape is reasonable. one thing to fix before merging, plus a few optional notes.
fix before merge
get_connection_context only includes granted when the token names action scopes. A grant that is limited to some projects but names no actions never reports granted.projects, so agents treat the connection as org-wide. A one-line fix:
--- a/src/lib/mcp/tools/connection-context.ts
+++ b/src/lib/mcp/tools/connection-context.ts
@@ -29,3 +29,3 @@
- ...(permissions !== undefined && {
+ ...((permissions !== undefined || projects !== undefined) && {
granted: { permissions, projects },
}),Please add a test for that case too (exchange response with projects and a token with identity scopes only).
optional
- In
mcpToolsetResourceKinds,nullvs[]carries meaning only through the comment. Named values like"any"/"never"would read better.api_keysandworkload_identityare both meant to stay hidden for grants, but they get there by different mechanisms, which is worth unifying or commenting on. - A typo in a resource-kind string compiles fine and silently hides a toolset. A small union type of the API's resource kinds would catch it.
CACHE_KEY_INFOstays atv1while the sealed payload gainsprojects. Entries cached before the deploy report "every project" until they expire. Bumping tov2is free.- The
JSON.stringify(JSON.stringify(...)).slice(1, -1)assertion inroute.test.tsis brittle. Parsing the JSON-RPC response and checkinggranteddirectly would be clearer. - Longer term, if
/auth/contextreported the effective policy for these tokens, the server could derive toolsets and project limits from the connection context it already fetches. That would remove theprojectsplumbing through the exchange cache.
The BugBot "single granted project is not selected" finding looks like a false positive. The API runs requests that name no project in the single granted project, so omitting project already works. A short comment at the tool description pointing at that would help future readers.
Report granted in get_connection_context when the grant is limited to some projects even if the token names no action. Replace the null and empty-list markers in the toolset table with "any" and "never", type the resource kinds so a misspelled one does not compile, and hide API key tools by the same rule as workload identity tools. Bump the exchange cache key because the sealed entry now carries projects.

Summary
Two changes so the Kernel MCP server works with permission consent on Kernel's authorization server, where the person connecting chooses what the client may do and in which projects.
scopes_supported. It used to tell clients to requestopenid. With nothing listed here, what a connection may do is decided on the consent page, not by the scopes a client was told to ask for.tools/list, andget_connection_contextreports the granted actions and projects undergranted. A grant limited to some projects reports them even when its token names no action.Details
scopes_supportedand request all of it. Both work: the consent page offers every permission in the first case and the requested ones in the second, and in neither case is anything granted that the person did not check.browsers:*for the browser, computer, shell, and Playwright tools). The table is insrc/lib/mcp/register.ts. It must name every toolset and its resource kinds are typed, so adding a toolset without deciding this, or misspelling a kind, does not compile. This only trims the list: the API authorizes every call, and its 403 already names the missing permission.projects(the projects a grant is limited to). It is cached with the exchanged token and surfaced inget_connection_context. The exchange cache key is bumped so entries sealed before this change, which carry no project list, are not read as "every project".Known limitation
The vault and search tools are also gated on the organization's entitlements, which the server reads from the API with the connection's own token. That read needs
organizations:read. Someone who unchecks it on the consent page ("view plan entitlements and limits", on by default) gets no vault or search tools, even if they granted vault or search permissions. Scoped API keys already behave this way. It is documented indocs/native-oauth.mdand not changed here.Effect on merge
scopes_supportedis gone from the resource metadata. An absentscopealready defaults toopenidat/authorize.Testing
bun testpasses (1332 tests), including new cases for the metadata, toolset filtering, and the connection context.tsc --noEmitandprettier --checkpass.bun run lintfails before and after this change (next lintno longer exists in this Next.js version), so it was not run.