@todoist/mcp-core 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -171,6 +171,7 @@ async function checkToken(token: string, baseUrl: string): Promise<Response | 'p
|
|
|
171
171
|
error: forbidden ? 'insufficient_scope' : undefined,
|
|
172
172
|
resourceMetadataUrl:
|
|
173
173
|
'https://notes.example.com/.well-known/oauth-protected-resource/mcp',
|
|
174
|
+
scopes: ['notes:read', 'notes:write'],
|
|
174
175
|
}),
|
|
175
176
|
},
|
|
176
177
|
})
|
|
@@ -178,7 +179,7 @@ async function checkToken(token: string, baseUrl: string): Promise<Response | 'p
|
|
|
178
179
|
```
|
|
179
180
|
|
|
180
181
|
- `isTransientValidationError`: a timeout, a dropped or refused connection, or a 5xx, the rejections worth retrying. A redirect or a 404 is not.
|
|
181
|
-
- `buildBearerChallenge`: `Bearer`, with `error="insufficient_scope"` and `
|
|
182
|
+
- `buildBearerChallenge`: `Bearer`, with `error="insufficient_scope"`, `resource_metadata="…"` and `scope="…"` (from `scopes`, space-separated) when given. MCP clients request the challenge's `scope` ahead of the metadata's `scopes_supported`, so pass the resource's scopes to help a client that never reads the metadata.
|
|
182
183
|
- `createTokenVerdictCache`: verdicts keyed by token and base URL, kept for `ttlMs`, the oldest dropped when full.
|
|
183
184
|
|
|
184
185
|
### Contract tests
|
package/dist/host/challenge.d.ts
CHANGED
|
@@ -6,7 +6,13 @@ export type BearerChallengeOptions = {
|
|
|
6
6
|
error?: 'insufficient_scope';
|
|
7
7
|
/** The resource's protected-resource metadata (RFC 9728), where the client finds how to authorise. */
|
|
8
8
|
resourceMetadataUrl?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The scopes a token needs for this resource, sent as RFC 6750's `scope` attribute. MCP clients
|
|
11
|
+
* request these first, ahead of the metadata's `scopes_supported`, so a client that can't find
|
|
12
|
+
* the resource's metadata still asks for the right ones. Left out when empty.
|
|
13
|
+
*/
|
|
14
|
+
scopes?: readonly string[];
|
|
9
15
|
};
|
|
10
16
|
/** The `WWW-Authenticate` value for a refused bearer token. */
|
|
11
|
-
export declare function buildBearerChallenge({ error, resourceMetadataUrl, }?: BearerChallengeOptions): string;
|
|
17
|
+
export declare function buildBearerChallenge({ error, resourceMetadataUrl, scopes, }?: BearerChallengeOptions): string;
|
|
12
18
|
//# sourceMappingURL=challenge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAA;IAC5B,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAA;IAC5B,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B,CAAA;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,EACjC,KAAK,EACL,mBAAmB,EACnB,MAAM,GACT,GAAE,sBAA2B,GAAG,MAAM,CAOtC"}
|
package/dist/host/challenge.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** The `WWW-Authenticate` value for a refused bearer token. */
|
|
2
|
-
export function buildBearerChallenge({ error, resourceMetadataUrl, } = {}) {
|
|
2
|
+
export function buildBearerChallenge({ error, resourceMetadataUrl, scopes, } = {}) {
|
|
3
3
|
const params = [
|
|
4
4
|
...(error ? [`error="${error}"`] : []),
|
|
5
5
|
...(resourceMetadataUrl ? [`resource_metadata="${resourceMetadataUrl}"`] : []),
|
|
6
|
+
...(scopes && scopes.length > 0 ? [`scope="${scopes.join(' ')}"`] : []),
|
|
6
7
|
];
|
|
7
8
|
return params.length > 0 ? `Bearer ${params.join(', ')}` : 'Bearer';
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"AAgBA,+DAA+D;AAC/D,MAAM,UAAU,oBAAoB,CAAC,EACjC,KAAK,EACL,mBAAmB,EACnB,MAAM,GACT,GAA2B,EAAE;IAC1B,MAAM,MAAM,GAAG;QACX,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,sBAAsB,mBAAmB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAA;AACvE,CAAC"}
|