@todoist/mcp-core 1.1.0 → 1.2.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
@@ -129,14 +129,14 @@ export const validateNotesToken: ValidateToken = (token, baseUrl = 'https://note
129
129
  validateBearerToken({ url: `${baseUrl}/api/v1/me`, token })
130
130
  ```
131
131
 
132
- | The API answers | `validateBearerToken` |
133
- | ------------------------------------- | -------------------------------------------------------------------------------------------- |
134
- | 2xx | `valid` |
135
- | 401 | `invalid`: the host sends a 401 challenge, and the client refreshes its token |
136
- | 403 | `forbidden`, or whatever `classifyForbidden(response)` returns |
137
- | any other status, a redirect included | throws `TokenValidationError`, whose `httpStatusCode` lets the host treat a 5xx as transient |
138
- | nothing within `timeoutMs` (5s) | rejects with the `TimeoutError` |
139
- | a network failure | rejects with the error unchanged |
132
+ | The API answers | `validateBearerToken` |
133
+ | ------------------------------------- | --------------------------------------------------------------------------------------------- |
134
+ | 2xx | `valid` |
135
+ | 401 | `invalid`: the host sends a 401 `invalid_token` challenge, and the client refreshes its token |
136
+ | 403 | `forbidden`, or whatever `classifyForbidden(response)` returns |
137
+ | any other status, a redirect included | throws `TokenValidationError`, whose `httpStatusCode` lets the host treat a 5xx as transient |
138
+ | nothing within `timeoutMs` (5s) | rejects with the `TimeoutError` |
139
+ | a network failure | rejects with the error unchanged |
140
140
 
141
141
  The body is drained unread, so a change to the response's shape can't misclassify a token and the connection goes back to the pool. Redirects aren't followed: a sign-in page that answers 200 would otherwise pass for an accepted token. Pass `classifyForbidden` when a 403 can also mean a refusal that consent can't lift, `headers` to tag the request, and `fetch` when the server's API client has its own transport (a proxy from `HTTPS_PROXY`, say), so validation goes the same way as every other call.
142
142
 
@@ -168,7 +168,7 @@ async function checkToken(token: string, baseUrl: string): Promise<Response | 'p
168
168
  status: forbidden ? 403 : 401,
169
169
  headers: {
170
170
  'WWW-Authenticate': buildBearerChallenge({
171
- error: forbidden ? 'insufficient_scope' : undefined,
171
+ error: forbidden ? 'insufficient_scope' : 'invalid_token',
172
172
  resourceMetadataUrl:
173
173
  'https://notes.example.com/.well-known/oauth-protected-resource/mcp',
174
174
  scopes: ['notes:read', 'notes:write'],
@@ -179,7 +179,7 @@ async function checkToken(token: string, baseUrl: string): Promise<Response | 'p
179
179
  ```
180
180
 
181
181
  - `isTransientValidationError`: a timeout, a dropped or refused connection, or a 5xx, the rejections worth retrying. A redirect or a 404 is not.
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
+ - `buildBearerChallenge`: `Bearer`, with `error="…"`, `resource_metadata="…"` and `scope="…"` (from `scopes`, space-separated) when given. Pass `error: 'invalid_token'` on a 401 for a token that was sent and refused, `'insufficient_scope'` on a 403, and no `error` when the request carried no token (RFC 6750 §3.1). 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.
183
183
  - `createTokenVerdictCache`: verdicts keyed by token and base URL, kept for `ttlMs`, the oldest dropped when full.
184
184
 
185
185
  ### Contract tests
@@ -1,9 +1,12 @@
1
1
  export type BearerChallengeOptions = {
2
2
  /**
3
- * `insufficient_scope` (RFC 6750) for a 403 on a token that lacks a scope, so the client asks
4
- * for consent again. Left out for a 401, where the client refreshes its token.
3
+ * The RFC 6750 error code. `invalid_token` for a 401 on a token that was sent but is revoked,
4
+ * expired or otherwise refused, so the client knows to refresh it or authorise again.
5
+ * `insufficient_scope` for a 403 on a token that lacks a scope, so the client asks for consent
6
+ * again. Left out when the request carried no token at all (RFC 6750 §3.1): there is nothing
7
+ * wrong with a token that was never sent.
5
8
  */
6
- error?: 'insufficient_scope';
9
+ error?: 'invalid_token' | 'insufficient_scope';
7
10
  /** The resource's protected-resource metadata (RFC 9728), where the client finds how to authorise. */
8
11
  resourceMetadataUrl?: string;
9
12
  /**
@@ -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;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"}
1
+ {"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,eAAe,GAAG,oBAAoB,CAAA;IAC9C,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"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/host/challenge.ts"],"names":[],"mappings":"AAmBA,+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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoist/mcp-core",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared core for the Doist MCP servers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -64,11 +64,11 @@
64
64
  "@types/node": "25.9.9",
65
65
  "conventional-changelog-conventionalcommits": "9.3.1",
66
66
  "lefthook": "2.2.2",
67
- "oxfmt": "0.75.0",
68
- "oxlint": "1.90.0",
67
+ "oxfmt": "0.79.0",
68
+ "oxlint": "1.94.0",
69
69
  "semantic-release": "25.0.9",
70
70
  "typescript": "7.0.2",
71
- "vitest": "5.0.5",
71
+ "vitest": "5.1.1",
72
72
  "zod": "4.6.7"
73
73
  },
74
74
  "peerDependencies": {