@todoist/mcp 17.3.15 → 17.3.16
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/dist/index.js +3 -3
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-KgV8_prN.js → mcp-server-kou63fuj.js} +1 -1
- package/dist/middleware/require-valid-todoist-token.d.ts +3 -2
- package/dist/middleware/require-valid-todoist-token.d.ts.map +1 -1
- package/dist/require-valid-todoist-token-EV7xylof.js +82 -0
- package/package.json +2 -2
- package/dist/require-valid-todoist-token-DuimkDtV.js +0 -71
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as s } from "./mcp-server-
|
|
2
|
-
import { F as d, a as r, b as i, c as n, d as c, e as l, f as p, g as m, h as f, i as T, j as u, k as j, l as g, m as k, n as v, o as P, p as S, q as h, r as b, s as F, u as y, v as A, w as C, x as R, y as x, z as M, A as O, B as E, C as L, D as U, E as w, G as H, H as I, I as W, J as q, K as z, L as B, M as D, N, O as V, P as _, Q as G, R as J, S as K, T as Q, U as X, V as Y, W as Z, X as $, Y as ss, Z as as, _ as es, $ as ts, a0 as os, a1 as ds } from "./mcp-server-
|
|
3
|
-
import { r as is, v as ns } from "./require-valid-todoist-token-
|
|
1
|
+
import { t as s } from "./mcp-server-kou63fuj.js";
|
|
2
|
+
import { F as d, a as r, b as i, c as n, d as c, e as l, f as p, g as m, h as f, i as T, j as u, k as j, l as g, m as k, n as v, o as P, p as S, q as h, r as b, s as F, u as y, v as A, w as C, x as R, y as x, z as M, A as O, B as E, C as L, D as U, E as w, G as H, H as I, I as W, J as q, K as z, L as B, M as D, N, O as V, P as _, Q as G, R as J, S as K, T as Q, U as X, V as Y, W as Z, X as $, Y as ss, Z as as, _ as es, $ as ts, a0 as os, a1 as ds } from "./mcp-server-kou63fuj.js";
|
|
3
|
+
import { r as is, v as ns } from "./require-valid-todoist-token-EV7xylof.js";
|
|
4
4
|
const e = s;
|
|
5
5
|
export {
|
|
6
6
|
d as FEATURE_NAMES,
|
package/dist/main-http.js
CHANGED
|
@@ -4,8 +4,8 @@ import S from "dotenv";
|
|
|
4
4
|
import { toNodeHandler as w } from "@modelcontextprotocol/node";
|
|
5
5
|
import { createMcpHandler as v } from "@modelcontextprotocol/server";
|
|
6
6
|
import h from "express";
|
|
7
|
-
import { B as I } from "./mcp-server-
|
|
8
|
-
import { r as g } from "./require-valid-todoist-token-
|
|
7
|
+
import { B as I } from "./mcp-server-kou63fuj.js";
|
|
8
|
+
import { r as g } from "./require-valid-todoist-token-EV7xylof.js";
|
|
9
9
|
function p(e) {
|
|
10
10
|
return e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
11
11
|
}
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { serveStdio as t } from "@modelcontextprotocol/server/stdio";
|
|
3
3
|
import n from "dotenv";
|
|
4
|
-
import { B as s } from "./mcp-server-
|
|
4
|
+
import { B as s } from "./mcp-server-kou63fuj.js";
|
|
5
5
|
function i() {
|
|
6
6
|
const o = process.env.TODOIST_BASE_URL, r = process.env.TODOIST_API_KEY;
|
|
7
7
|
if (!r)
|
|
@@ -27,8 +27,9 @@ type RequireValidTodoistTokenOptions = TokenSource & {
|
|
|
27
27
|
* Express middleware that validates the Todoist API token before MCP processing.
|
|
28
28
|
*
|
|
29
29
|
* Returns HTTP 401 with an `invalid_token` challenge if the token is refused,
|
|
30
|
-
* allowing MCP clients to trigger OAuth token refresh,
|
|
31
|
-
* `insufficient_scope` challenge if it lacks a scope the tools need
|
|
30
|
+
* allowing MCP clients to trigger OAuth token refresh, 403 with an
|
|
31
|
+
* `insufficient_scope` challenge if it lacks a scope the tools need, and 429
|
|
32
|
+
* with `Retry-After` if the Todoist API is rate-limiting the token's user.
|
|
32
33
|
*/
|
|
33
34
|
declare function requireValidTodoistToken(options: RequireValidTodoistTokenOptions): RequestHandler;
|
|
34
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-valid-todoist-token.d.ts","sourceRoot":"","sources":["../../src/middleware/require-valid-todoist-token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"require-valid-todoist-token.d.ts","sourceRoot":"","sources":["../../src/middleware/require-valid-todoist-token.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAA;AAI9E,KAAK,iBAAiB,GAAG;IACrB,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACtB,IAAI,EAAE,SAAS,CAAA;IACf,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;AAEzD,KAAK,+BAA+B,GAAG,WAAW,GAAG;IACjD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AAgGD;;;;;;;GAOG;AACH,iBAAS,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,cAAc,CAyC1F;AAED;;GAEG;AACH,iBAAS,yBAAyB,IAAI,IAAI,CAEzC;AAED,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,KAAK,+BAA+B,EAAE,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { validateBearerToken as A, getValidationRateLimit as v, createTokenVerdictCache as k, buildBearerChallenge as f } from "@todoist/mcp-core/host";
|
|
2
|
+
import { a2 as p, a3 as g } from "./mcp-server-kou63fuj.js";
|
|
3
|
+
const m = "https://api.todoist.com", E = (e, t) => A({
|
|
4
|
+
// Resolved the way the SDK resolves its own requests against a custom base URL. An empty
|
|
5
|
+
// base (`TODOIST_BASE_URL=`) means the default, as it does for the SDK client.
|
|
6
|
+
url: new URL("/api/v1/user", t || m),
|
|
7
|
+
token: e,
|
|
8
|
+
headers: g({ label: "auth:validate-token" }),
|
|
9
|
+
fetch: p
|
|
10
|
+
}), L = 3e5, S = 12e4, U = 1e4, y = 60, u = /* @__PURE__ */ new Map();
|
|
11
|
+
function b(e) {
|
|
12
|
+
let t = u.get(e);
|
|
13
|
+
return t || (t = k({
|
|
14
|
+
ttlMs: e,
|
|
15
|
+
maxEntries: U,
|
|
16
|
+
now: () => Date.now()
|
|
17
|
+
}), u.set(e, t)), t;
|
|
18
|
+
}
|
|
19
|
+
function h(e, { tokenSent: t, resourceMetadataUrl: r }) {
|
|
20
|
+
e.status(401).set(
|
|
21
|
+
"WWW-Authenticate",
|
|
22
|
+
f({
|
|
23
|
+
error: t ? "invalid_token" : void 0,
|
|
24
|
+
resourceMetadataUrl: r
|
|
25
|
+
})
|
|
26
|
+
).json(
|
|
27
|
+
t ? {
|
|
28
|
+
error: "invalid_token",
|
|
29
|
+
error_description: "Todoist API token is invalid or expired"
|
|
30
|
+
} : { error_description: "Todoist API token is missing" }
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function w(e, t) {
|
|
34
|
+
e.status(403).set(
|
|
35
|
+
"WWW-Authenticate",
|
|
36
|
+
f({ error: "insufficient_scope", resourceMetadataUrl: t })
|
|
37
|
+
).json({
|
|
38
|
+
error: "insufficient_scope",
|
|
39
|
+
error_description: "Todoist API token does not have the required scopes"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function I(e, t) {
|
|
43
|
+
e.status(429).set("Retry-After", String(t)).json({ error_description: "Todoist API rate limit reached, retry later" });
|
|
44
|
+
}
|
|
45
|
+
function T(e, t, r, i) {
|
|
46
|
+
e === "valid" ? r() : e === "forbidden" ? w(t, i) : h(t, { tokenSent: !0, resourceMetadataUrl: i });
|
|
47
|
+
}
|
|
48
|
+
function D(e) {
|
|
49
|
+
const t = e.type === "static" ? L : S, r = b(e.cacheTtlMs ?? t), { resourceMetadataUrl: i } = e;
|
|
50
|
+
return async (_, n, a) => {
|
|
51
|
+
const o = e.type === "static" ? e.apiKey : e.getApiKey(_);
|
|
52
|
+
if (!o) {
|
|
53
|
+
h(n, { tokenSent: !1, resourceMetadataUrl: i });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const d = r.get(o, e.baseUrl);
|
|
57
|
+
if (d !== void 0) {
|
|
58
|
+
T(d, n, a, i);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let s;
|
|
62
|
+
try {
|
|
63
|
+
s = await E(o, e.baseUrl);
|
|
64
|
+
} catch (c) {
|
|
65
|
+
const l = v(c);
|
|
66
|
+
if (l) {
|
|
67
|
+
console.warn(
|
|
68
|
+
"[Token validation] Todoist API rate limit reached, answering 429:",
|
|
69
|
+
c
|
|
70
|
+
), I(n, l.retryAfterSeconds ?? y);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.warn("[Token validation] Validation failed, proceeding:", c), a();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
r.set(o, e.baseUrl, s), T(s, n, a, i);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
D as r,
|
|
81
|
+
E as v
|
|
82
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todoist/mcp",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@modelcontextprotocol/ext-apps": "2.0.4",
|
|
70
|
-
"@todoist/mcp-core": "1.
|
|
70
|
+
"@todoist/mcp-core": "1.3.0",
|
|
71
71
|
"@todoist/sdk": "24.1.0",
|
|
72
72
|
"date-fns": "4.1.0",
|
|
73
73
|
"dompurify": "3.4.18",
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { validateBearerToken as _, createTokenVerdictCache as v, buildBearerChallenge as u } from "@todoist/mcp-core/host";
|
|
2
|
-
import { a2 as k, a3 as p } from "./mcp-server-KgV8_prN.js";
|
|
3
|
-
const A = "https://api.todoist.com", U = (e, t) => _({
|
|
4
|
-
// Resolved the way the SDK resolves its own requests against a custom base URL. An empty
|
|
5
|
-
// base (`TODOIST_BASE_URL=`) means the default, as it does for the SDK client.
|
|
6
|
-
url: new URL("/api/v1/user", t || A),
|
|
7
|
-
token: e,
|
|
8
|
-
headers: p({ label: "auth:validate-token" }),
|
|
9
|
-
fetch: k
|
|
10
|
-
}), g = 3e5, b = 12e4, m = 1e4, d = /* @__PURE__ */ new Map();
|
|
11
|
-
function y(e) {
|
|
12
|
-
let t = d.get(e);
|
|
13
|
-
return t || (t = v({
|
|
14
|
-
ttlMs: e,
|
|
15
|
-
maxEntries: m,
|
|
16
|
-
now: () => Date.now()
|
|
17
|
-
}), d.set(e, t)), t;
|
|
18
|
-
}
|
|
19
|
-
function T(e, { tokenSent: t, resourceMetadataUrl: r }) {
|
|
20
|
-
e.status(401).set(
|
|
21
|
-
"WWW-Authenticate",
|
|
22
|
-
u({
|
|
23
|
-
error: t ? "invalid_token" : void 0,
|
|
24
|
-
resourceMetadataUrl: r
|
|
25
|
-
})
|
|
26
|
-
).json(
|
|
27
|
-
t ? {
|
|
28
|
-
error: "invalid_token",
|
|
29
|
-
error_description: "Todoist API token is invalid or expired"
|
|
30
|
-
} : { error_description: "Todoist API token is missing" }
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
function E(e, t) {
|
|
34
|
-
e.status(403).set(
|
|
35
|
-
"WWW-Authenticate",
|
|
36
|
-
u({ error: "insufficient_scope", resourceMetadataUrl: t })
|
|
37
|
-
).json({
|
|
38
|
-
error: "insufficient_scope",
|
|
39
|
-
error_description: "Todoist API token does not have the required scopes"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function l(e, t, r, i) {
|
|
43
|
-
e === "valid" ? r() : e === "forbidden" ? E(t, i) : T(t, { tokenSent: !0, resourceMetadataUrl: i });
|
|
44
|
-
}
|
|
45
|
-
function w(e) {
|
|
46
|
-
const t = e.type === "static" ? g : b, r = y(e.cacheTtlMs ?? t), { resourceMetadataUrl: i } = e;
|
|
47
|
-
return async (f, o, a) => {
|
|
48
|
-
const n = e.type === "static" ? e.apiKey : e.getApiKey(f);
|
|
49
|
-
if (!n) {
|
|
50
|
-
T(o, { tokenSent: !1, resourceMetadataUrl: i });
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const c = r.get(n, e.baseUrl);
|
|
54
|
-
if (c !== void 0) {
|
|
55
|
-
l(c, o, a, i);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
let s;
|
|
59
|
-
try {
|
|
60
|
-
s = await U(n, e.baseUrl);
|
|
61
|
-
} catch (h) {
|
|
62
|
-
console.warn("[Token validation] Validation failed, proceeding:", h), a();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
r.set(n, e.baseUrl, s), l(s, o, a, i);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
w as r,
|
|
70
|
-
U as v
|
|
71
|
-
};
|