notion-mcp-server 2.8.0 → 2.9.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/build/services/notion.js +17 -0
- package/package.json +6 -4
package/build/services/notion.js
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import { Client } from "@notionhq/client";
|
|
2
|
+
import nodeFetch from "node-fetch";
|
|
3
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
2
4
|
import { authProvider } from "./auth.js";
|
|
3
5
|
let cachedClient = null;
|
|
4
6
|
let cachedToken = null;
|
|
7
|
+
// Route the Notion SDK's HTTP calls through an HTTP(S) proxy when one is
|
|
8
|
+
// configured via the standard env vars. node-fetch is used (instead of global
|
|
9
|
+
// fetch) because it accepts a custom `agent`. When no proxy is set we still go
|
|
10
|
+
// through node-fetch so behavior is uniform.
|
|
11
|
+
const proxyFetch = (url, init) => {
|
|
12
|
+
const proxyURL = process.env.HTTPS_PROXY ||
|
|
13
|
+
process.env.https_proxy ||
|
|
14
|
+
process.env.HTTP_PROXY ||
|
|
15
|
+
process.env.http_proxy ||
|
|
16
|
+
null;
|
|
17
|
+
if (!proxyURL)
|
|
18
|
+
return nodeFetch(url, init);
|
|
19
|
+
return nodeFetch(url, { ...init, agent: new HttpsProxyAgent(proxyURL) });
|
|
20
|
+
};
|
|
5
21
|
export async function getClient() {
|
|
6
22
|
const token = await authProvider.getToken();
|
|
7
23
|
if (token !== cachedToken || cachedClient === null) {
|
|
8
24
|
const fresh = new Client({
|
|
9
25
|
auth: token,
|
|
10
26
|
notionVersion: "2026-03-11",
|
|
27
|
+
fetch: proxyFetch,
|
|
11
28
|
});
|
|
12
29
|
cachedClient = fresh;
|
|
13
30
|
cachedToken = token;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notion-mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"notion-mcp-server": "build/index.js"
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
45
45
|
"@notionhq/client": "^5.22.0",
|
|
46
|
+
"https-proxy-agent": "9.1.0",
|
|
47
|
+
"node-fetch": "3.3.2",
|
|
46
48
|
"remark-gfm": "^4.0.1",
|
|
47
49
|
"remark-parse": "^11.0.0",
|
|
48
50
|
"unified": "^11.0.5",
|
|
@@ -50,9 +52,9 @@
|
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@types/mdast": "^4.0.4",
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"shx": "^0.
|
|
55
|
-
"typescript": "^
|
|
55
|
+
"@types/node": "^25.9.3",
|
|
56
|
+
"shx": "^0.4.0",
|
|
57
|
+
"typescript": "^6.0.3",
|
|
56
58
|
"vitest": "^4.1.7"
|
|
57
59
|
},
|
|
58
60
|
"engines": {
|