@todoist/mcp 17.3.14 → 17.3.15
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-BG9J-1Tn.js → mcp-server-KgV8_prN.js} +1 -1
- package/dist/middleware/require-valid-todoist-token.d.ts +3 -3
- package/dist/middleware/require-valid-todoist-token.d.ts.map +1 -1
- package/dist/require-valid-todoist-token-DuimkDtV.js +71 -0
- package/package.json +2 -2
- package/dist/require-valid-todoist-token-DQv7NcSa.js +0 -63
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-KgV8_prN.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-KgV8_prN.js";
|
|
3
|
+
import { r as is, v as ns } from "./require-valid-todoist-token-DuimkDtV.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-KgV8_prN.js";
|
|
8
|
+
import { r as g } from "./require-valid-todoist-token-DuimkDtV.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-KgV8_prN.js";
|
|
5
5
|
function i() {
|
|
6
6
|
const o = process.env.TODOIST_BASE_URL, r = process.env.TODOIST_API_KEY;
|
|
7
7
|
if (!r)
|
|
@@ -26,9 +26,9 @@ type RequireValidTodoistTokenOptions = TokenSource & {
|
|
|
26
26
|
/**
|
|
27
27
|
* Express middleware that validates the Todoist API token before MCP processing.
|
|
28
28
|
*
|
|
29
|
-
* Returns HTTP 401 with
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Returns HTTP 401 with an `invalid_token` challenge if the token is refused,
|
|
30
|
+
* allowing MCP clients to trigger OAuth token refresh, and 403 with an
|
|
31
|
+
* `insufficient_scope` challenge if it lacks a scope the tools need.
|
|
32
32
|
*/
|
|
33
33
|
declare function requireValidTodoistToken(options: RequireValidTodoistTokenOptions): RequestHandler;
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-valid-todoist-token.d.ts","sourceRoot":"","sources":["../../src/middleware/require-valid-todoist-token.ts"],"names":[],"mappings":"AAMA,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;
|
|
1
|
+
{"version":3,"file":"require-valid-todoist-token.d.ts","sourceRoot":"","sources":["../../src/middleware/require-valid-todoist-token.ts"],"names":[],"mappings":"AAMA,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;AAoFD;;;;;;GAMG;AACH,iBAAS,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,cAAc,CAgC1F;AAED;;GAEG;AACH,iBAAS,yBAAyB,IAAI,IAAI,CAEzC;AAED,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,KAAK,+BAA+B,EAAE,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todoist/mcp",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.15",
|
|
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.2.0",
|
|
71
71
|
"@todoist/sdk": "24.1.0",
|
|
72
72
|
"date-fns": "4.1.0",
|
|
73
73
|
"dompurify": "3.4.18",
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { validateBearerToken as _, createTokenVerdictCache as p, buildBearerChallenge as u } from "@todoist/mcp-core/host";
|
|
2
|
-
import { a2 as v, a3 as A } from "./mcp-server-BG9J-1Tn.js";
|
|
3
|
-
const k = "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 || k),
|
|
7
|
-
token: e,
|
|
8
|
-
headers: A({ label: "auth:validate-token" }),
|
|
9
|
-
fetch: v
|
|
10
|
-
}), b = 3e5, g = 12e4, y = 1e4, d = /* @__PURE__ */ new Map();
|
|
11
|
-
function E(e) {
|
|
12
|
-
let t = d.get(e);
|
|
13
|
-
return t || (t = p({
|
|
14
|
-
ttlMs: e,
|
|
15
|
-
maxEntries: y,
|
|
16
|
-
now: () => Date.now()
|
|
17
|
-
}), d.set(e, t)), t;
|
|
18
|
-
}
|
|
19
|
-
function T(e, t) {
|
|
20
|
-
e.status(401).set("WWW-Authenticate", u({ resourceMetadataUrl: t })).json({
|
|
21
|
-
error: "invalid_token",
|
|
22
|
-
error_description: "Todoist API token is invalid or expired"
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function L(e, t) {
|
|
26
|
-
e.status(403).set(
|
|
27
|
-
"WWW-Authenticate",
|
|
28
|
-
u({ error: "insufficient_scope", resourceMetadataUrl: t })
|
|
29
|
-
).json({
|
|
30
|
-
error: "insufficient_scope",
|
|
31
|
-
error_description: "Todoist API token does not have the required scopes"
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function l(e, t, a, r) {
|
|
35
|
-
e === "valid" ? a() : e === "forbidden" ? L(t, r) : T(t, r);
|
|
36
|
-
}
|
|
37
|
-
function C(e) {
|
|
38
|
-
const t = e.type === "static" ? b : g, a = E(e.cacheTtlMs ?? t), { resourceMetadataUrl: r } = e;
|
|
39
|
-
return async (f, n, o) => {
|
|
40
|
-
const i = e.type === "static" ? e.apiKey : e.getApiKey(f);
|
|
41
|
-
if (!i) {
|
|
42
|
-
T(n, r);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const c = a.get(i, e.baseUrl);
|
|
46
|
-
if (c !== void 0) {
|
|
47
|
-
l(c, n, o, r);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let s;
|
|
51
|
-
try {
|
|
52
|
-
s = await U(i, e.baseUrl);
|
|
53
|
-
} catch (h) {
|
|
54
|
-
console.warn("[Token validation] Validation failed, proceeding:", h), o();
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
a.set(i, e.baseUrl, s), l(s, n, o, r);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export {
|
|
61
|
-
C as r,
|
|
62
|
-
U as v
|
|
63
|
-
};
|