@notionhq/notion-mcp-server 1.6.0 → 1.8.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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "mcp",
7
7
  "server"
8
8
  ],
9
- "version": "1.6.0",
9
+ "version": "1.8.0",
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "scripts": {
@@ -800,13 +800,20 @@
800
800
  "description": "When supplied, orders the results based on the provided [sort criteria](ref:post-database-query-sort).",
801
801
  "items": {
802
802
  "type": "object",
803
- "required": ["property", "direction"],
803
+ "required": [
804
+ "property",
805
+ "direction"
806
+ ],
804
807
  "properties": {
805
808
  "property": {
806
809
  "type": "string"
807
810
  },
808
811
  "direction": {
809
- "enum": ["ascending", "descending"]
812
+ "enum": [
813
+ "ascending",
814
+ "descending"
815
+ ],
816
+ "type": "string"
810
817
  }
811
818
  }
812
819
  }
@@ -983,30 +990,44 @@
983
990
  "maxLength": 2000
984
991
  },
985
992
  "link": {
986
- "type": ["object", "null"],
993
+ "type": [
994
+ "object",
995
+ "null"
996
+ ],
987
997
  "properties": {
988
998
  "url": {
989
999
  "type": "string"
990
1000
  }
991
1001
  },
992
- "required": ["url"]
1002
+ "required": [
1003
+ "url"
1004
+ ]
993
1005
  }
994
1006
  },
995
1007
  "additionalProperties": false,
996
- "required": ["content"]
1008
+ "required": [
1009
+ "content"
1010
+ ]
997
1011
  },
998
1012
  "type": {
999
- "enum": ["text"]
1013
+ "enum": [
1014
+ "text"
1015
+ ],
1016
+ "type": "string"
1000
1017
  }
1001
1018
  },
1002
1019
  "additionalProperties": false,
1003
- "required": ["text"]
1020
+ "required": [
1021
+ "text"
1022
+ ]
1004
1023
  },
1005
1024
  "maxItems": 100
1006
1025
  }
1007
1026
  },
1008
1027
  "additionalProperties": false,
1009
- "required": ["rich_text"]
1028
+ "required": [
1029
+ "rich_text"
1030
+ ]
1010
1031
  },
1011
1032
  "bulleted_list_item": {
1012
1033
  "type": "object",
@@ -1024,33 +1045,51 @@
1024
1045
  "maxLength": 2000
1025
1046
  },
1026
1047
  "link": {
1027
- "type": ["object", "null"],
1048
+ "type": [
1049
+ "object",
1050
+ "null"
1051
+ ],
1028
1052
  "properties": {
1029
1053
  "url": {
1030
1054
  "type": "string"
1031
1055
  }
1032
1056
  },
1033
- "required": ["url"]
1057
+ "required": [
1058
+ "url"
1059
+ ]
1034
1060
  }
1035
1061
  },
1036
1062
  "additionalProperties": false,
1037
- "required": ["content"]
1063
+ "required": [
1064
+ "content"
1065
+ ]
1038
1066
  },
1039
1067
  "type": {
1040
- "enum": ["text"]
1068
+ "enum": [
1069
+ "text"
1070
+ ],
1071
+ "type": "string"
1041
1072
  }
1042
1073
  },
1043
1074
  "additionalProperties": false,
1044
- "required": ["text"]
1075
+ "required": [
1076
+ "text"
1077
+ ]
1045
1078
  },
1046
1079
  "maxItems": 100
1047
1080
  }
1048
1081
  },
1049
1082
  "additionalProperties": false,
1050
- "required": ["rich_text"]
1083
+ "required": [
1084
+ "rich_text"
1085
+ ]
1051
1086
  },
1052
1087
  "type": {
1053
- "enum": ["paragraph", "bulleted_list_item"]
1088
+ "enum": [
1089
+ "paragraph",
1090
+ "bulleted_list_item"
1091
+ ],
1092
+ "type": "string"
1054
1093
  }
1055
1094
  },
1056
1095
  "additionalProperties": false
@@ -1217,33 +1256,50 @@
1217
1256
  "maxLength": 2000
1218
1257
  },
1219
1258
  "link": {
1220
- "type": ["object", "null"],
1259
+ "type": [
1260
+ "object",
1261
+ "null"
1262
+ ],
1221
1263
  "properties": {
1222
1264
  "url": {
1223
1265
  "type": "string"
1224
1266
  }
1225
1267
  },
1226
- "required": ["url"]
1268
+ "required": [
1269
+ "url"
1270
+ ]
1227
1271
  }
1228
1272
  },
1229
1273
  "additionalProperties": false,
1230
- "required": ["content"]
1274
+ "required": [
1275
+ "content"
1276
+ ]
1231
1277
  },
1232
1278
  "type": {
1233
- "enum": ["text"]
1279
+ "enum": [
1280
+ "text"
1281
+ ],
1282
+ "type": "string"
1234
1283
  }
1235
1284
  },
1236
1285
  "additionalProperties": false,
1237
- "required": ["text"]
1286
+ "required": [
1287
+ "text"
1288
+ ]
1238
1289
  },
1239
1290
  "maxItems": 100
1240
1291
  },
1241
1292
  "type": {
1242
- "enum": ["title"]
1293
+ "enum": [
1294
+ "title"
1295
+ ],
1296
+ "type": "string"
1243
1297
  }
1244
1298
  },
1245
1299
  "additionalProperties": false,
1246
- "required": ["title"]
1300
+ "required": [
1301
+ "title"
1302
+ ]
1247
1303
  },
1248
1304
  "in_trash": {
1249
1305
  "type": "boolean",
@@ -1262,7 +1318,9 @@
1262
1318
  }
1263
1319
  },
1264
1320
  "additionalProperties": false,
1265
- "required": ["emoji"]
1321
+ "required": [
1322
+ "emoji"
1323
+ ]
1266
1324
  },
1267
1325
  "cover": {
1268
1326
  "type": "object",
@@ -1276,13 +1334,20 @@
1276
1334
  }
1277
1335
  },
1278
1336
  "additionalProperties": false,
1279
- "required": ["url"]
1337
+ "required": [
1338
+ "url"
1339
+ ]
1280
1340
  },
1281
1341
  "type": {
1282
- "enum": ["external"]
1342
+ "enum": [
1343
+ "external"
1344
+ ],
1345
+ "type": "string"
1283
1346
  }
1284
1347
  },
1285
- "required": ["external"],
1348
+ "required": [
1349
+ "external"
1350
+ ],
1286
1351
  "additionalProperties": false
1287
1352
  }
1288
1353
  }
@@ -1319,7 +1384,9 @@
1319
1384
  "format": "uuid"
1320
1385
  }
1321
1386
  },
1322
- "required": ["page_id"]
1387
+ "required": [
1388
+ "page_id"
1389
+ ]
1323
1390
  },
1324
1391
  "properties": {
1325
1392
  "type": "object",
@@ -1328,11 +1395,15 @@
1328
1395
  "type": "array",
1329
1396
  "items": {
1330
1397
  "type": "object",
1331
- "required": ["text"],
1398
+ "required": [
1399
+ "text"
1400
+ ],
1332
1401
  "properties": {
1333
1402
  "text": {
1334
1403
  "type": "object",
1335
- "required": ["content"],
1404
+ "required": [
1405
+ "content"
1406
+ ],
1336
1407
  "properties": {
1337
1408
  "content": {
1338
1409
  "type": "string",
@@ -1345,11 +1416,16 @@
1345
1416
  "maxItems": 100
1346
1417
  },
1347
1418
  "type": {
1348
- "enum": ["title"]
1419
+ "enum": [
1420
+ "title"
1421
+ ],
1422
+ "type": "string"
1349
1423
  }
1350
1424
  },
1351
1425
  "additionalProperties": false,
1352
- "required": ["title"]
1426
+ "required": [
1427
+ "title"
1428
+ ]
1353
1429
  },
1354
1430
  "children": {
1355
1431
  "type": "array",
@@ -1389,20 +1465,29 @@
1389
1465
  "application/json": {
1390
1466
  "schema": {
1391
1467
  "type": "object",
1392
- "required": ["parent","properties"],
1468
+ "required": [
1469
+ "parent",
1470
+ "properties"
1471
+ ],
1393
1472
  "properties": {
1394
1473
  "parent": {
1395
1474
  "type": "object",
1396
1475
  "properties": {
1397
1476
  "type": {
1398
- "enum": ["page_id"]
1477
+ "enum": [
1478
+ "page_id"
1479
+ ],
1480
+ "type": "string"
1399
1481
  },
1400
1482
  "page_id": {
1401
1483
  "type": "string",
1402
1484
  "format": "uuid"
1403
1485
  }
1404
1486
  },
1405
- "required": ["type", "page_id"]
1487
+ "required": [
1488
+ "type",
1489
+ "page_id"
1490
+ ]
1406
1491
  },
1407
1492
  "properties": {
1408
1493
  "type": "object",
@@ -1424,7 +1509,9 @@
1424
1509
  }
1425
1510
  },
1426
1511
  "additionalProperties": false,
1427
- "required": ["title"]
1512
+ "required": [
1513
+ "title"
1514
+ ]
1428
1515
  }
1429
1516
  ]
1430
1517
  }
@@ -1433,7 +1520,9 @@
1433
1520
  "type": "array",
1434
1521
  "items": {
1435
1522
  "type": "object",
1436
- "required": ["text"],
1523
+ "required": [
1524
+ "text"
1525
+ ],
1437
1526
  "properties": {
1438
1527
  "text": {
1439
1528
  "type": "object",
@@ -1443,20 +1532,30 @@
1443
1532
  "maxLength": 2000
1444
1533
  },
1445
1534
  "link": {
1446
- "type": ["object", "null"],
1535
+ "type": [
1536
+ "object",
1537
+ "null"
1538
+ ],
1447
1539
  "properties": {
1448
1540
  "url": {
1449
1541
  "type": "string"
1450
1542
  }
1451
1543
  },
1452
- "required": ["url"]
1544
+ "required": [
1545
+ "url"
1546
+ ]
1453
1547
  }
1454
1548
  },
1455
1549
  "additionalProperties": false,
1456
- "required": ["content"]
1550
+ "required": [
1551
+ "content"
1552
+ ]
1457
1553
  },
1458
1554
  "type": {
1459
- "enum": ["text"]
1555
+ "enum": [
1556
+ "text"
1557
+ ],
1558
+ "type": "string"
1460
1559
  }
1461
1560
  },
1462
1561
  "additionalProperties": false
@@ -1513,7 +1612,9 @@
1513
1612
  "type": "array",
1514
1613
  "items": {
1515
1614
  "type": "object",
1516
- "required": ["text"],
1615
+ "required": [
1616
+ "text"
1617
+ ],
1517
1618
  "properties": {
1518
1619
  "text": {
1519
1620
  "type": "object",
@@ -1523,20 +1624,30 @@
1523
1624
  "maxLength": 2000
1524
1625
  },
1525
1626
  "link": {
1526
- "type": ["object", "null"],
1627
+ "type": [
1628
+ "object",
1629
+ "null"
1630
+ ],
1527
1631
  "properties": {
1528
1632
  "url": {
1529
1633
  "type": "string"
1530
1634
  }
1531
1635
  },
1532
- "required": ["url"]
1636
+ "required": [
1637
+ "url"
1638
+ ]
1533
1639
  }
1534
1640
  },
1535
1641
  "additionalProperties": false,
1536
- "required": ["content"]
1642
+ "required": [
1643
+ "content"
1644
+ ]
1537
1645
  },
1538
1646
  "type": {
1539
- "enum": ["text"]
1647
+ "enum": [
1648
+ "text"
1649
+ ],
1650
+ "type": "string"
1540
1651
  }
1541
1652
  },
1542
1653
  "additionalProperties": false
@@ -1546,7 +1657,9 @@
1546
1657
  "type": "array",
1547
1658
  "items": {
1548
1659
  "type": "object",
1549
- "required": ["text"],
1660
+ "required": [
1661
+ "text"
1662
+ ],
1550
1663
  "properties": {
1551
1664
  "text": {
1552
1665
  "type": "object",
@@ -1556,20 +1669,30 @@
1556
1669
  "maxLength": 2000
1557
1670
  },
1558
1671
  "link": {
1559
- "type": ["object", "null"],
1672
+ "type": [
1673
+ "object",
1674
+ "null"
1675
+ ],
1560
1676
  "properties": {
1561
1677
  "url": {
1562
1678
  "type": "string"
1563
1679
  }
1564
1680
  },
1565
- "required": ["url"]
1681
+ "required": [
1682
+ "url"
1683
+ ]
1566
1684
  }
1567
1685
  },
1568
1686
  "additionalProperties": false,
1569
- "required": ["content"]
1687
+ "required": [
1688
+ "content"
1689
+ ]
1570
1690
  },
1571
1691
  "type": {
1572
- "enum": ["text"]
1692
+ "enum": [
1693
+ "text"
1694
+ ],
1695
+ "type": "string"
1573
1696
  }
1574
1697
  },
1575
1698
  "additionalProperties": false
@@ -1762,7 +1885,9 @@
1762
1885
  "parent": {
1763
1886
  "type": "object",
1764
1887
  "description": "The page that contains the comment",
1765
- "required": ["page_id"],
1888
+ "required": [
1889
+ "page_id"
1890
+ ],
1766
1891
  "properties": {
1767
1892
  "page_id": {
1768
1893
  "type": "string",
@@ -1774,11 +1899,15 @@
1774
1899
  "type": "array",
1775
1900
  "items": {
1776
1901
  "type": "object",
1777
- "required": ["text"],
1902
+ "required": [
1903
+ "text"
1904
+ ],
1778
1905
  "properties": {
1779
1906
  "text": {
1780
1907
  "type": "object",
1781
- "required": ["content"],
1908
+ "required": [
1909
+ "content"
1910
+ ],
1782
1911
  "properties": {
1783
1912
  "content": {
1784
1913
  "type": "string",
@@ -3,6 +3,7 @@ import OpenAPIClientAxios from 'openapi-client-axios'
3
3
  import type { AxiosInstance } from 'axios'
4
4
  import FormData from 'form-data'
5
5
  import fs from 'fs'
6
+ import { Headers } from './polyfill-headers'
6
7
  import { isFileUploadParameter } from '../openapi/file-upload'
7
8
 
8
9
  export type HttpClientConfig = {
@@ -0,0 +1,42 @@
1
+ /*
2
+ * The Headers class was supported in Node.js starting with version 18, which was released on April 19, 2022.
3
+ * We need to have a polyfill ready to work for old Node versions.
4
+ * See more at https://github.com/makenotion/notion-mcp-server/issues/32
5
+ * */
6
+ class PolyfillHeaders {
7
+ private headers: Map<string, string[]> = new Map();
8
+
9
+ constructor(init?: Record<string, string>) {
10
+ if (init) {
11
+ Object.entries(init).forEach(([key, value]) => {
12
+ this.append(key, value);
13
+ });
14
+ }
15
+ }
16
+
17
+ public append(name: string, value: string): void {
18
+ const key = name.toLowerCase();
19
+
20
+ if (!this.headers.has(key)) {
21
+ this.headers.set(key, []);
22
+ }
23
+
24
+ this.headers.get(key)!.push(value);
25
+ }
26
+
27
+ public get(name: string): string | null {
28
+ const key = name.toLowerCase();
29
+
30
+ if (!this.headers.has(key)) {
31
+ return null;
32
+ }
33
+
34
+ return this.headers.get(key)!.join(', ');
35
+ }
36
+ }
37
+
38
+ const GlobalHeaders = typeof global !== 'undefined' && 'Headers' in global
39
+ ? (global as any).Headers
40
+ : undefined;
41
+
42
+ export const Headers = (GlobalHeaders || PolyfillHeaders);