Skip to content

Commit 17d0676

Browse files
committed
docs(spec): an admitted MCP call refused later for what it asks is still recorded as used
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pERdWox6UVMyKRjPq
1 parent e8c0e99 commit 17d0676

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎content/docs/kernel/contracts/auth-service.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Everything after `verify` is optional, and each optional member describes a capa
5858

5959
- **`api` and `getApi()`** are the same session handle by two routes. `api` is the legacy direct mount; `getApi()` is the lazy accessor, and it is the one to prefer — the shipped `plugin-auth` registers an `AuthManager`, which has **no `api` member at all**, so a caller that reads only `api` gets `undefined` on every current deployment. Read `api ?? await getApi?.()`.
6060
- **`getMcpResourceUrl()` and `getMcpResourceMetadataUrl()`** both describe the MCP OAuth surface; the second returns `null` (rather than being absent) when the OAuth track is off for the deployment.
61-
- **`verifyMcpAccessToken()` and `recordMcpAccessTokenUse()`** split verifying a token from admitting the call. The MCP door verifies first, then applies its own refusals (a banned subject, an authorization store it could not read), and only for a call it admits hands the verified principal back to `recordMcpAccessTokenUse()`. So a refused call is never recorded as a use of the grant (the coarse "last used" time the authorized-clients reads show).
61+
- **`verifyMcpAccessToken()` and `recordMcpAccessTokenUse()`** split verifying a token from admitting the call. The MCP door verifies first, then applies its own refusals (a banned subject, an authorization store it could not read), and only for a call it admits hands the verified principal back to `recordMcpAccessTokenUse()`. So a refused call is never recorded as a use of the grant (the coarse "last used" time the authorized-clients reads show). Admitting is the decision about who calls, not every later verdict: a refusal of what the admitted principal then asks for (a 403 `insufficient_scope` for a token that grants none of the MCP tool families, a tool or an action its scopes do not reach) is still a use, and is recorded.
6262

6363
---
6464

‎packages/spec/src/contracts/auth-service.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,14 @@ export interface IAuthService {
332332
* provider records nothing at verification, and the caller calls this
333333
* member once per admitted call, only after its last refusal has had its
334334
* say, with the very object `verifyMcpAccessToken` resolved to. A refused
335-
* call never reaches it, so it is never recorded as a use.
335+
* call never reaches it, so it is never recorded as a use. Admitting is
336+
* the decision about WHO calls, not every later authorization verdict:
337+
* once the principal is admitted, a refusal of what it then asks for,
338+
* rendered further down the request (the MCP domain's 403
339+
* `insufficient_scope` for a token that grants none of the MCP tool
340+
* families, a tool the token's scopes leave unregistered, an action whose
341+
* scope family the token was not granted), is still a use of the grant,
342+
* and it is recorded.
336343
*
337344
* The provider records only a principal object it returned itself; any
338345
* other object (a hand-built principal, a copy) records nothing. It

0 commit comments

Comments
 (0)