@contextstream/mcp-server 0.4.31 → 0.4.32

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.
Files changed (2) hide show
  1. package/dist/index.js +477 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7436,7 +7436,7 @@ W:${wsHint}
7436
7436
  const query = new URLSearchParams();
7437
7437
  if (params?.days) query.set("days", String(params.days));
7438
7438
  const suffix = query.toString() ? `?${query.toString()}` : "";
7439
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/slack/stats${suffix}`, {
7439
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/slack/stats${suffix}`, {
7440
7440
  method: "GET"
7441
7441
  });
7442
7442
  }
@@ -7452,7 +7452,7 @@ W:${wsHint}
7452
7452
  if (params?.page) query.set("page", String(params.page));
7453
7453
  if (params?.per_page) query.set("per_page", String(params.per_page));
7454
7454
  const suffix = query.toString() ? `?${query.toString()}` : "";
7455
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/slack/users${suffix}`, {
7455
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/slack/users${suffix}`, {
7456
7456
  method: "GET"
7457
7457
  });
7458
7458
  }
@@ -7464,7 +7464,7 @@ W:${wsHint}
7464
7464
  if (!withDefaults.workspace_id) {
7465
7465
  throw new Error("workspace_id is required for Slack channels");
7466
7466
  }
7467
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/slack/channels`, {
7467
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/slack/channels`, {
7468
7468
  method: "GET"
7469
7469
  });
7470
7470
  }
@@ -7483,7 +7483,7 @@ W:${wsHint}
7483
7483
  const suffix = query.toString() ? `?${query.toString()}` : "";
7484
7484
  return request(
7485
7485
  this.config,
7486
- `/workspaces/${withDefaults.workspace_id}/slack/activity${suffix}`,
7486
+ `/integrations/workspaces/${withDefaults.workspace_id}/slack/activity${suffix}`,
7487
7487
  { method: "GET" }
7488
7488
  );
7489
7489
  }
@@ -7500,7 +7500,7 @@ W:${wsHint}
7500
7500
  const suffix = query.toString() ? `?${query.toString()}` : "";
7501
7501
  return request(
7502
7502
  this.config,
7503
- `/workspaces/${withDefaults.workspace_id}/slack/discussions${suffix}`,
7503
+ `/integrations/workspaces/${withDefaults.workspace_id}/slack/discussions${suffix}`,
7504
7504
  { method: "GET" }
7505
7505
  );
7506
7506
  }
@@ -7517,7 +7517,7 @@ W:${wsHint}
7517
7517
  const suffix = query.toString() ? `?${query.toString()}` : "";
7518
7518
  return request(
7519
7519
  this.config,
7520
- `/workspaces/${withDefaults.workspace_id}/slack/contributors${suffix}`,
7520
+ `/integrations/workspaces/${withDefaults.workspace_id}/slack/contributors${suffix}`,
7521
7521
  { method: "GET" }
7522
7522
  );
7523
7523
  }
@@ -7529,7 +7529,7 @@ W:${wsHint}
7529
7529
  if (!withDefaults.workspace_id) {
7530
7530
  throw new Error("workspace_id is required for syncing Slack users");
7531
7531
  }
7532
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/slack/sync-users`, {
7532
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/slack/sync-users`, {
7533
7533
  method: "POST"
7534
7534
  });
7535
7535
  }
@@ -7546,7 +7546,7 @@ W:${wsHint}
7546
7546
  if (params?.limit) query.set("limit", String(params.limit));
7547
7547
  return request(
7548
7548
  this.config,
7549
- `/workspaces/${withDefaults.workspace_id}/slack/search?${query.toString()}`,
7549
+ `/integrations/workspaces/${withDefaults.workspace_id}/slack/search?${query.toString()}`,
7550
7550
  { method: "GET" }
7551
7551
  );
7552
7552
  }
@@ -7561,7 +7561,7 @@ W:${wsHint}
7561
7561
  if (!withDefaults.workspace_id) {
7562
7562
  throw new Error("workspace_id is required for GitHub stats");
7563
7563
  }
7564
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/github/stats`, {
7564
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/github/stats`, {
7565
7565
  method: "GET"
7566
7566
  });
7567
7567
  }
@@ -7573,7 +7573,7 @@ W:${wsHint}
7573
7573
  if (!withDefaults.workspace_id) {
7574
7574
  throw new Error("workspace_id is required for GitHub repos");
7575
7575
  }
7576
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/github/repos`, {
7576
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/github/repos`, {
7577
7577
  method: "GET"
7578
7578
  });
7579
7579
  }
@@ -7593,7 +7593,7 @@ W:${wsHint}
7593
7593
  const suffix = query.toString() ? `?${query.toString()}` : "";
7594
7594
  return request(
7595
7595
  this.config,
7596
- `/workspaces/${withDefaults.workspace_id}/github/activity${suffix}`,
7596
+ `/integrations/workspaces/${withDefaults.workspace_id}/github/activity${suffix}`,
7597
7597
  { method: "GET" }
7598
7598
  );
7599
7599
  }
@@ -7611,7 +7611,7 @@ W:${wsHint}
7611
7611
  if (params?.state) query.set("state", params.state);
7612
7612
  if (params?.repo) query.set("repo", params.repo);
7613
7613
  const suffix = query.toString() ? `?${query.toString()}` : "";
7614
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/github/issues${suffix}`, {
7614
+ return request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/github/issues${suffix}`, {
7615
7615
  method: "GET"
7616
7616
  });
7617
7617
  }
@@ -7628,7 +7628,7 @@ W:${wsHint}
7628
7628
  const suffix = query.toString() ? `?${query.toString()}` : "";
7629
7629
  return request(
7630
7630
  this.config,
7631
- `/workspaces/${withDefaults.workspace_id}/github/contributors${suffix}`,
7631
+ `/integrations/workspaces/${withDefaults.workspace_id}/github/contributors${suffix}`,
7632
7632
  { method: "GET" }
7633
7633
  );
7634
7634
  }
@@ -7645,7 +7645,7 @@ W:${wsHint}
7645
7645
  if (params?.limit) query.set("limit", String(params.limit));
7646
7646
  return request(
7647
7647
  this.config,
7648
- `/workspaces/${withDefaults.workspace_id}/github/search?${query.toString()}`,
7648
+ `/integrations/workspaces/${withDefaults.workspace_id}/github/search?${query.toString()}`,
7649
7649
  { method: "GET" }
7650
7650
  );
7651
7651
  }
@@ -7663,7 +7663,7 @@ W:${wsHint}
7663
7663
  const suffix = query.toString() ? `?${query.toString()}` : "";
7664
7664
  return request(
7665
7665
  this.config,
7666
- `/workspaces/${withDefaults.workspace_id}/github/knowledge${suffix}`,
7666
+ `/integrations/workspaces/${withDefaults.workspace_id}/github/knowledge${suffix}`,
7667
7667
  { method: "GET" }
7668
7668
  );
7669
7669
  }
@@ -7681,7 +7681,7 @@ W:${wsHint}
7681
7681
  const suffix = query.toString() ? `?${query.toString()}` : "";
7682
7682
  return request(
7683
7683
  this.config,
7684
- `/workspaces/${withDefaults.workspace_id}/slack/knowledge${suffix}`,
7684
+ `/integrations/workspaces/${withDefaults.workspace_id}/slack/knowledge${suffix}`,
7685
7685
  { method: "GET" }
7686
7686
  );
7687
7687
  }
@@ -7693,9 +7693,10 @@ W:${wsHint}
7693
7693
  if (!withDefaults.workspace_id) {
7694
7694
  throw new Error("workspace_id is required for integrations status");
7695
7695
  }
7696
- return request(this.config, `/workspaces/${withDefaults.workspace_id}/integrations/status`, {
7696
+ const result = await request(this.config, `/integrations/workspaces/${withDefaults.workspace_id}/integrations/status`, {
7697
7697
  method: "GET"
7698
7698
  });
7699
+ return unwrapApiResponse(result);
7699
7700
  }
7700
7701
  /**
7701
7702
  * Get GitHub summary for a workspace
@@ -7784,17 +7785,176 @@ W:${wsHint}
7784
7785
  if (!withDefaults.workspace_id) {
7785
7786
  throw new Error("workspace_id is required for creating Notion pages");
7786
7787
  }
7787
- return request(this.config, `/integrations/notion/pages`, {
7788
+ return request(this.config, `/integrations/notion/pages?workspace_id=${withDefaults.workspace_id}`, {
7788
7789
  method: "POST",
7789
- body: JSON.stringify({
7790
- workspace_id: withDefaults.workspace_id,
7790
+ body: {
7791
7791
  title: params.title,
7792
7792
  content: params.content,
7793
7793
  parent_database_id: params.parent_database_id,
7794
7794
  parent_page_id: params.parent_page_id
7795
- })
7795
+ }
7796
7796
  });
7797
7797
  }
7798
+ /**
7799
+ * Get Notion integration statistics and overview
7800
+ */
7801
+ async notionStats(params) {
7802
+ const withDefaults = this.withDefaults(params || {});
7803
+ if (!withDefaults.workspace_id) {
7804
+ throw new Error("workspace_id is required for Notion stats");
7805
+ }
7806
+ const query = new URLSearchParams();
7807
+ if (params?.days) query.set("days", String(params.days));
7808
+ const suffix = query.toString() ? `?${query.toString()}` : "";
7809
+ return request(
7810
+ this.config,
7811
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/stats${suffix}`,
7812
+ { method: "GET" }
7813
+ );
7814
+ }
7815
+ /**
7816
+ * Get recent Notion activity feed
7817
+ */
7818
+ async notionActivity(params) {
7819
+ const withDefaults = this.withDefaults(params || {});
7820
+ if (!withDefaults.workspace_id) {
7821
+ throw new Error("workspace_id is required for Notion activity");
7822
+ }
7823
+ const query = new URLSearchParams();
7824
+ if (params?.limit) query.set("limit", String(params.limit));
7825
+ if (params?.database_id) query.set("database_id", params.database_id);
7826
+ const suffix = query.toString() ? `?${query.toString()}` : "";
7827
+ return request(
7828
+ this.config,
7829
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/activity${suffix}`,
7830
+ { method: "GET" }
7831
+ );
7832
+ }
7833
+ /**
7834
+ * Get knowledge extracted from Notion (decisions, lessons, insights)
7835
+ */
7836
+ async notionKnowledge(params) {
7837
+ const withDefaults = this.withDefaults(params || {});
7838
+ if (!withDefaults.workspace_id) {
7839
+ throw new Error("workspace_id is required for Notion knowledge");
7840
+ }
7841
+ const query = new URLSearchParams();
7842
+ if (params?.limit) query.set("limit", String(params.limit));
7843
+ if (params?.node_type) query.set("node_type", params.node_type);
7844
+ const suffix = query.toString() ? `?${query.toString()}` : "";
7845
+ return request(
7846
+ this.config,
7847
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/knowledge${suffix}`,
7848
+ { method: "GET" }
7849
+ );
7850
+ }
7851
+ /**
7852
+ * Get Notion summary for a workspace
7853
+ */
7854
+ async notionSummary(params) {
7855
+ const withDefaults = this.withDefaults(params || {});
7856
+ if (!withDefaults.workspace_id) {
7857
+ throw new Error("workspace_id is required for Notion summary");
7858
+ }
7859
+ const query = new URLSearchParams();
7860
+ if (params?.days) query.set("days", String(params.days));
7861
+ if (params?.database_id) query.set("database_id", params.database_id);
7862
+ const suffix = query.toString() ? `?${query.toString()}` : "";
7863
+ return request(
7864
+ this.config,
7865
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/summary${suffix}`,
7866
+ { method: "GET" }
7867
+ );
7868
+ }
7869
+ /**
7870
+ * List Notion databases available in the workspace
7871
+ */
7872
+ async notionListDatabases(params) {
7873
+ const withDefaults = this.withDefaults(params || {});
7874
+ if (!withDefaults.workspace_id) {
7875
+ throw new Error("workspace_id is required for listing Notion databases");
7876
+ }
7877
+ return request(
7878
+ this.config,
7879
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/databases`,
7880
+ { method: "GET" }
7881
+ );
7882
+ }
7883
+ /**
7884
+ * Search/list pages in Notion
7885
+ */
7886
+ async notionSearchPages(params) {
7887
+ const withDefaults = this.withDefaults(params || {});
7888
+ if (!withDefaults.workspace_id) {
7889
+ throw new Error("workspace_id is required for searching Notion pages");
7890
+ }
7891
+ const query = new URLSearchParams();
7892
+ if (params?.query) query.set("query", params.query);
7893
+ if (params?.database_id) query.set("database_id", params.database_id);
7894
+ if (params?.limit) query.set("limit", String(params.limit));
7895
+ const suffix = query.toString() ? `?${query.toString()}` : "";
7896
+ return request(
7897
+ this.config,
7898
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/pages${suffix}`,
7899
+ { method: "GET" }
7900
+ );
7901
+ }
7902
+ /**
7903
+ * Get a specific Notion page with its content
7904
+ */
7905
+ async notionGetPage(params) {
7906
+ const withDefaults = this.withDefaults(params || {});
7907
+ if (!withDefaults.workspace_id) {
7908
+ throw new Error("workspace_id is required for getting Notion page");
7909
+ }
7910
+ return request(
7911
+ this.config,
7912
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/pages/${params.page_id}`,
7913
+ { method: "GET" }
7914
+ );
7915
+ }
7916
+ /**
7917
+ * Query a Notion database (get rows with optional filters)
7918
+ */
7919
+ async notionQueryDatabase(params) {
7920
+ const withDefaults = this.withDefaults(params || {});
7921
+ if (!withDefaults.workspace_id) {
7922
+ throw new Error("workspace_id is required for querying Notion database");
7923
+ }
7924
+ return request(
7925
+ this.config,
7926
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/databases/${params.database_id}/query`,
7927
+ {
7928
+ method: "POST",
7929
+ body: {
7930
+ filter: params.filter,
7931
+ sorts: params.sorts,
7932
+ page_size: params.limit
7933
+ }
7934
+ }
7935
+ );
7936
+ }
7937
+ /**
7938
+ * Update a Notion page
7939
+ */
7940
+ async notionUpdatePage(params) {
7941
+ const withDefaults = this.withDefaults(params || {});
7942
+ if (!withDefaults.workspace_id) {
7943
+ throw new Error("workspace_id is required for updating Notion page");
7944
+ }
7945
+ return request(
7946
+ this.config,
7947
+ `/integrations/workspaces/${withDefaults.workspace_id}/notion/pages/${params.page_id}`,
7948
+ {
7949
+ method: "PATCH",
7950
+ body: {
7951
+ title: params.title,
7952
+ content: params.content,
7953
+ properties: params.properties
7954
+ }
7955
+ }
7956
+ );
7957
+ }
7798
7958
  // ============================================
7799
7959
  // Reminder Methods
7800
7960
  // ============================================
@@ -9635,7 +9795,16 @@ var GITHUB_TOOLS = /* @__PURE__ */ new Set([
9635
9795
  "github_summary"
9636
9796
  ]);
9637
9797
  var NOTION_TOOLS = /* @__PURE__ */ new Set([
9638
- "notion_create_page"
9798
+ "notion_create_page",
9799
+ "notion_list_databases",
9800
+ "notion_search_pages",
9801
+ "notion_get_page",
9802
+ "notion_query_database",
9803
+ "notion_update_page",
9804
+ "notion_stats",
9805
+ "notion_activity",
9806
+ "notion_knowledge",
9807
+ "notion_summary"
9639
9808
  ]);
9640
9809
  var CROSS_INTEGRATION_TOOLS = /* @__PURE__ */ new Set([
9641
9810
  "integrations_status",
@@ -9849,6 +10018,15 @@ var TOOL_BUNDLES = {
9849
10018
  "github_knowledge",
9850
10019
  "github_summary",
9851
10020
  "notion_create_page",
10021
+ "notion_list_databases",
10022
+ "notion_search_pages",
10023
+ "notion_get_page",
10024
+ "notion_query_database",
10025
+ "notion_update_page",
10026
+ "notion_stats",
10027
+ "notion_activity",
10028
+ "notion_knowledge",
10029
+ "notion_summary",
9852
10030
  "integrations_status",
9853
10031
  "integrations_search",
9854
10032
  "integrations_summary",
@@ -10000,7 +10178,7 @@ var CONSOLIDATED_TOOLS = /* @__PURE__ */ new Set([
10000
10178
  "reminder",
10001
10179
  // Consolidates reminders_list, reminders_create, etc.
10002
10180
  "integration",
10003
- // Consolidates slack_*, github_*, integrations_*
10181
+ // Consolidates slack_*, github_*, notion_*, integrations_*
10004
10182
  "help"
10005
10183
  // Consolidates session_tools, auth_me, mcp_server_version, etc.
10006
10184
  ]);
@@ -10328,7 +10506,16 @@ function registerTools(server, client, sessionManager) {
10328
10506
  "github_issues",
10329
10507
  "github_search",
10330
10508
  // Notion integration tools
10331
- "notion_create_page"
10509
+ "notion_create_page",
10510
+ "notion_list_databases",
10511
+ "notion_search_pages",
10512
+ "notion_get_page",
10513
+ "notion_query_database",
10514
+ "notion_update_page",
10515
+ "notion_stats",
10516
+ "notion_activity",
10517
+ "notion_knowledge",
10518
+ "notion_summary"
10332
10519
  ]);
10333
10520
  const proTools = (() => {
10334
10521
  const raw = process.env.CONTEXTSTREAM_PRO_TOOLS;
@@ -10383,14 +10570,14 @@ function registerTools(server, client, sessionManager) {
10383
10570
  ].join("\n")
10384
10571
  );
10385
10572
  }
10386
- let integrationStatus = { checked: false, slack: false, github: false };
10573
+ let integrationStatus = { checked: false, slack: false, github: false, notion: false };
10387
10574
  let toolsListChangedNotified = false;
10388
10575
  async function checkIntegrationStatus(workspaceId) {
10389
10576
  if (integrationStatus.checked && integrationStatus.workspaceId === workspaceId) {
10390
- return { slack: integrationStatus.slack, github: integrationStatus.github };
10577
+ return { slack: integrationStatus.slack, github: integrationStatus.github, notion: integrationStatus.notion };
10391
10578
  }
10392
10579
  if (!workspaceId) {
10393
- return { slack: false, github: false };
10580
+ return { slack: false, github: false, notion: false };
10394
10581
  }
10395
10582
  try {
10396
10583
  const status = await client.integrationsStatus({ workspace_id: workspaceId });
@@ -10400,32 +10587,38 @@ function registerTools(server, client, sessionManager) {
10400
10587
  const githubConnected = status?.some(
10401
10588
  (s) => s.provider === "github" && s.status === "connected"
10402
10589
  ) ?? false;
10590
+ const notionConnected = status?.some(
10591
+ (s) => s.provider === "notion" && s.status === "connected"
10592
+ ) ?? false;
10403
10593
  integrationStatus = {
10404
10594
  checked: true,
10405
10595
  slack: slackConnected,
10406
10596
  github: githubConnected,
10597
+ notion: notionConnected,
10407
10598
  workspaceId
10408
10599
  };
10409
10600
  console.error(
10410
- `[ContextStream] Integration status: Slack=${slackConnected}, GitHub=${githubConnected}`
10601
+ `[ContextStream] Integration status: Slack=${slackConnected}, GitHub=${githubConnected}, Notion=${notionConnected}`
10411
10602
  );
10412
- return { slack: slackConnected, github: githubConnected };
10603
+ return { slack: slackConnected, github: githubConnected, notion: notionConnected };
10413
10604
  } catch (error) {
10414
10605
  console.error("[ContextStream] Failed to check integration status:", error);
10415
- return { slack: false, github: false };
10606
+ return { slack: false, github: false, notion: false };
10416
10607
  }
10417
10608
  }
10418
10609
  function updateIntegrationStatus(status, workspaceId) {
10419
10610
  const hadSlack = integrationStatus.slack;
10420
10611
  const hadGithub = integrationStatus.github;
10612
+ const hadNotion = integrationStatus.notion;
10421
10613
  integrationStatus = {
10422
10614
  checked: true,
10423
10615
  slack: status.slack,
10424
10616
  github: status.github,
10617
+ notion: status.notion,
10425
10618
  workspaceId
10426
10619
  };
10427
10620
  if (AUTO_HIDE_INTEGRATIONS && !toolsListChangedNotified) {
10428
- const newlyConnected = !hadSlack && status.slack || !hadGithub && status.github;
10621
+ const newlyConnected = !hadSlack && status.slack || !hadGithub && status.github || !hadNotion && status.notion;
10429
10622
  if (newlyConnected) {
10430
10623
  try {
10431
10624
  server.server?.sendToolsListChanged?.();
@@ -10443,8 +10636,9 @@ function registerTools(server, client, sessionManager) {
10443
10636
  if (!AUTO_HIDE_INTEGRATIONS) return null;
10444
10637
  const requiresSlack = SLACK_TOOLS.has(toolName);
10445
10638
  const requiresGithub = GITHUB_TOOLS.has(toolName);
10639
+ const requiresNotion = NOTION_TOOLS.has(toolName);
10446
10640
  const requiresCrossIntegration = CROSS_INTEGRATION_TOOLS.has(toolName);
10447
- if (!requiresSlack && !requiresGithub && !requiresCrossIntegration) {
10641
+ if (!requiresSlack && !requiresGithub && !requiresNotion && !requiresCrossIntegration) {
10448
10642
  return null;
10449
10643
  }
10450
10644
  const workspaceId = sessionManager?.getContext()?.workspace_id;
@@ -10479,6 +10673,18 @@ function registerTools(server, client, sessionManager) {
10479
10673
  ].join("\n")
10480
10674
  );
10481
10675
  }
10676
+ if (requiresNotion && !status.notion) {
10677
+ return errorResult(
10678
+ [
10679
+ `Integration not connected: \`${toolName}\` requires Notion integration.`,
10680
+ "",
10681
+ "To use Notion tools:",
10682
+ "1. Go to https://contextstream.io/settings/integrations",
10683
+ "2. Connect your Notion workspace",
10684
+ "3. Try this command again"
10685
+ ].join("\n")
10686
+ );
10687
+ }
10482
10688
  if (requiresCrossIntegration && !status.slack && !status.github) {
10483
10689
  return errorResult(
10484
10690
  [
@@ -10504,6 +10710,9 @@ function registerTools(server, client, sessionManager) {
10504
10710
  if (GITHUB_TOOLS.has(toolName)) {
10505
10711
  return integrationStatus.github;
10506
10712
  }
10713
+ if (NOTION_TOOLS.has(toolName)) {
10714
+ return integrationStatus.notion;
10715
+ }
10507
10716
  if (CROSS_INTEGRATION_TOOLS.has(toolName)) {
10508
10717
  return integrationStatus.slack || integrationStatus.github;
10509
10718
  }
@@ -14504,7 +14713,10 @@ Use this to verify integrations are healthy and syncing properly.`,
14504
14713
  const githubConnected = result?.some(
14505
14714
  (s) => s.provider === "github" && s.status === "connected"
14506
14715
  ) ?? false;
14507
- updateIntegrationStatus({ slack: slackConnected, github: githubConnected }, workspaceId);
14716
+ const notionConnected = result?.some(
14717
+ (s) => s.provider === "notion" && s.status === "connected"
14718
+ ) ?? false;
14719
+ updateIntegrationStatus({ slack: slackConnected, github: githubConnected, notion: notionConnected }, workspaceId);
14508
14720
  }
14509
14721
  if (result.length === 0) {
14510
14722
  return {
@@ -16187,9 +16399,9 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16187
16399
  "integration",
16188
16400
  {
16189
16401
  title: "Integration",
16190
- description: `Integration operations for Slack and GitHub. Provider: slack, github, all. Actions: status, search, stats, activity, contributors, knowledge, summary, channels (slack), discussions (slack), repos (github), issues (github).`,
16402
+ description: `Integration operations for Slack, GitHub, and Notion. Provider: slack, github, notion, all. Actions: status, search, stats, activity, contributors, knowledge, summary, channels (slack), discussions (slack), repos (github), issues (github), create_page (notion), list_databases (notion), search_pages (notion), get_page (notion), query_database (notion), update_page (notion).`,
16191
16403
  inputSchema: external_exports.object({
16192
- provider: external_exports.enum(["slack", "github", "all"]).describe("Integration provider"),
16404
+ provider: external_exports.enum(["slack", "github", "notion", "all"]).describe("Integration provider"),
16193
16405
  action: external_exports.enum([
16194
16406
  "status",
16195
16407
  "search",
@@ -16202,21 +16414,43 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16202
16414
  "discussions",
16203
16415
  "sync_users",
16204
16416
  "repos",
16205
- "issues"
16417
+ "issues",
16418
+ // Notion-specific actions
16419
+ "create_page",
16420
+ "list_databases",
16421
+ "search_pages",
16422
+ "get_page",
16423
+ "query_database",
16424
+ "update_page"
16206
16425
  ]).describe("Action to perform"),
16207
16426
  workspace_id: external_exports.string().uuid().optional(),
16208
16427
  project_id: external_exports.string().uuid().optional(),
16209
16428
  query: external_exports.string().optional(),
16210
16429
  limit: external_exports.number().optional(),
16211
16430
  since: external_exports.string().optional(),
16212
- until: external_exports.string().optional()
16431
+ until: external_exports.string().optional(),
16432
+ // Notion-specific parameters
16433
+ title: external_exports.string().optional().describe("Page title (for Notion create_page/update_page)"),
16434
+ content: external_exports.string().optional().describe("Page content in Markdown (for Notion create_page/update_page)"),
16435
+ parent_database_id: external_exports.string().optional().describe("Parent database ID (for Notion create_page)"),
16436
+ parent_page_id: external_exports.string().optional().describe("Parent page ID (for Notion create_page)"),
16437
+ page_id: external_exports.string().optional().describe("Page ID (for Notion get_page/update_page)"),
16438
+ database_id: external_exports.string().optional().describe("Database ID (for Notion query_database/search_pages/activity)"),
16439
+ days: external_exports.number().optional().describe("Number of days for stats/summary (default: 7)"),
16440
+ node_type: external_exports.string().optional().describe("Filter knowledge by type (for Notion knowledge)"),
16441
+ filter: external_exports.record(external_exports.unknown()).optional().describe("Query filter (for Notion query_database)"),
16442
+ sorts: external_exports.array(external_exports.object({
16443
+ property: external_exports.string(),
16444
+ direction: external_exports.enum(["ascending", "descending"])
16445
+ })).optional().describe("Sort order (for Notion query_database)"),
16446
+ properties: external_exports.record(external_exports.unknown()).optional().describe("Page properties (for Notion update_page)")
16213
16447
  })
16214
16448
  },
16215
16449
  async (input) => {
16216
16450
  const workspaceId = resolveWorkspaceId(input.workspace_id);
16217
16451
  const projectId = resolveProjectId(input.project_id);
16218
16452
  const integrationGated = await gateIfIntegrationTool(
16219
- input.provider === "slack" ? "slack_search" : input.provider === "github" ? "github_search" : "integrations_status"
16453
+ input.provider === "slack" ? "slack_search" : input.provider === "github" ? "github_search" : input.provider === "notion" ? "notion_create_page" : "integrations_status"
16220
16454
  );
16221
16455
  if (integrationGated) return integrationGated;
16222
16456
  const params = {
@@ -16284,8 +16518,17 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16284
16518
  content: [{ type: "text", text: formatContent(result) }],
16285
16519
  structuredContent: toStructured(result)
16286
16520
  };
16521
+ } else if (input.provider === "notion") {
16522
+ const result = await client.notionStats({
16523
+ workspace_id: workspaceId,
16524
+ days: input.days
16525
+ });
16526
+ return {
16527
+ content: [{ type: "text", text: formatContent(result) }],
16528
+ structuredContent: toStructured(result)
16529
+ };
16287
16530
  }
16288
- return errorResult("stats requires provider: slack or github");
16531
+ return errorResult("stats requires provider: slack, github, or notion");
16289
16532
  }
16290
16533
  case "activity": {
16291
16534
  if (input.provider === "slack") {
@@ -16300,8 +16543,18 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16300
16543
  content: [{ type: "text", text: formatContent(result) }],
16301
16544
  structuredContent: toStructured(result)
16302
16545
  };
16546
+ } else if (input.provider === "notion") {
16547
+ const result = await client.notionActivity({
16548
+ workspace_id: workspaceId,
16549
+ limit: input.limit,
16550
+ database_id: input.database_id
16551
+ });
16552
+ return {
16553
+ content: [{ type: "text", text: formatContent(result) }],
16554
+ structuredContent: toStructured(result)
16555
+ };
16303
16556
  }
16304
- return errorResult("activity requires provider: slack or github");
16557
+ return errorResult("activity requires provider: slack, github, or notion");
16305
16558
  }
16306
16559
  case "contributors": {
16307
16560
  if (input.provider === "slack") {
@@ -16332,6 +16585,16 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16332
16585
  content: [{ type: "text", text: formatContent(result) }],
16333
16586
  structuredContent: toStructured(result)
16334
16587
  };
16588
+ } else if (input.provider === "notion") {
16589
+ const result = await client.notionKnowledge({
16590
+ workspace_id: workspaceId,
16591
+ limit: input.limit,
16592
+ node_type: input.node_type
16593
+ });
16594
+ return {
16595
+ content: [{ type: "text", text: formatContent(result) }],
16596
+ structuredContent: toStructured(result)
16597
+ };
16335
16598
  } else {
16336
16599
  const result = await client.integrationsKnowledge(params);
16337
16600
  return {
@@ -16353,6 +16616,16 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16353
16616
  content: [{ type: "text", text: formatContent(result) }],
16354
16617
  structuredContent: toStructured(result)
16355
16618
  };
16619
+ } else if (input.provider === "notion") {
16620
+ const result = await client.notionSummary({
16621
+ workspace_id: workspaceId,
16622
+ days: input.days,
16623
+ database_id: input.database_id
16624
+ });
16625
+ return {
16626
+ content: [{ type: "text", text: formatContent(result) }],
16627
+ structuredContent: toStructured(result)
16628
+ };
16356
16629
  } else {
16357
16630
  const result = await client.integrationsSummary(params);
16358
16631
  return {
@@ -16411,6 +16684,170 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16411
16684
  structuredContent: toStructured(result)
16412
16685
  };
16413
16686
  }
16687
+ case "create_page": {
16688
+ if (input.provider !== "notion") {
16689
+ return errorResult("create_page is only available for notion provider");
16690
+ }
16691
+ if (!input.title) {
16692
+ return errorResult("title is required for create_page action");
16693
+ }
16694
+ if (!workspaceId) {
16695
+ return errorResult(
16696
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16697
+ );
16698
+ }
16699
+ const result = await client.createNotionPage({
16700
+ workspace_id: workspaceId,
16701
+ title: input.title,
16702
+ content: input.content,
16703
+ parent_database_id: input.parent_database_id,
16704
+ parent_page_id: input.parent_page_id
16705
+ });
16706
+ return {
16707
+ content: [
16708
+ {
16709
+ type: "text",
16710
+ text: `Page created successfully!
16711
+
16712
+ Title: ${result.title}
16713
+ URL: ${result.url}
16714
+ ID: ${result.id}
16715
+ Created: ${result.created_time}`
16716
+ }
16717
+ ],
16718
+ structuredContent: toStructured(result)
16719
+ };
16720
+ }
16721
+ case "list_databases": {
16722
+ if (input.provider !== "notion") {
16723
+ return errorResult("list_databases is only available for notion provider");
16724
+ }
16725
+ if (!workspaceId) {
16726
+ return errorResult(
16727
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16728
+ );
16729
+ }
16730
+ const databases = await client.notionListDatabases({
16731
+ workspace_id: workspaceId
16732
+ });
16733
+ return {
16734
+ content: [{ type: "text", text: formatContent(databases) }],
16735
+ structuredContent: toStructured(databases)
16736
+ };
16737
+ }
16738
+ case "search_pages": {
16739
+ if (input.provider !== "notion") {
16740
+ return errorResult("search_pages is only available for notion provider");
16741
+ }
16742
+ if (!workspaceId) {
16743
+ return errorResult(
16744
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16745
+ );
16746
+ }
16747
+ const pages = await client.notionSearchPages({
16748
+ workspace_id: workspaceId,
16749
+ query: input.query,
16750
+ database_id: input.database_id,
16751
+ limit: input.limit
16752
+ });
16753
+ return {
16754
+ content: [{ type: "text", text: formatContent(pages) }],
16755
+ structuredContent: toStructured(pages)
16756
+ };
16757
+ }
16758
+ case "get_page": {
16759
+ if (input.provider !== "notion") {
16760
+ return errorResult("get_page is only available for notion provider");
16761
+ }
16762
+ if (!input.page_id) {
16763
+ return errorResult("page_id is required for get_page action");
16764
+ }
16765
+ if (!workspaceId) {
16766
+ return errorResult(
16767
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16768
+ );
16769
+ }
16770
+ const page = await client.notionGetPage({
16771
+ workspace_id: workspaceId,
16772
+ page_id: input.page_id
16773
+ });
16774
+ return {
16775
+ content: [
16776
+ {
16777
+ type: "text",
16778
+ text: `# ${page.title}
16779
+
16780
+ ID: ${page.id}
16781
+ URL: ${page.url}
16782
+ Created: ${page.created_time}
16783
+ Last edited: ${page.last_edited_time}
16784
+
16785
+ ---
16786
+
16787
+ ${page.content}`
16788
+ }
16789
+ ],
16790
+ structuredContent: toStructured(page)
16791
+ };
16792
+ }
16793
+ case "query_database": {
16794
+ if (input.provider !== "notion") {
16795
+ return errorResult("query_database is only available for notion provider");
16796
+ }
16797
+ if (!input.database_id) {
16798
+ return errorResult("database_id is required for query_database action");
16799
+ }
16800
+ if (!workspaceId) {
16801
+ return errorResult(
16802
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16803
+ );
16804
+ }
16805
+ const queryResult = await client.notionQueryDatabase({
16806
+ workspace_id: workspaceId,
16807
+ database_id: input.database_id,
16808
+ filter: input.filter,
16809
+ sorts: input.sorts,
16810
+ limit: input.limit
16811
+ });
16812
+ return {
16813
+ content: [{ type: "text", text: formatContent(queryResult) }],
16814
+ structuredContent: toStructured(queryResult)
16815
+ };
16816
+ }
16817
+ case "update_page": {
16818
+ if (input.provider !== "notion") {
16819
+ return errorResult("update_page is only available for notion provider");
16820
+ }
16821
+ if (!input.page_id) {
16822
+ return errorResult("page_id is required for update_page action");
16823
+ }
16824
+ if (!workspaceId) {
16825
+ return errorResult(
16826
+ "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
16827
+ );
16828
+ }
16829
+ const updatedPage = await client.notionUpdatePage({
16830
+ workspace_id: workspaceId,
16831
+ page_id: input.page_id,
16832
+ title: input.title,
16833
+ content: input.content,
16834
+ properties: input.properties
16835
+ });
16836
+ return {
16837
+ content: [
16838
+ {
16839
+ type: "text",
16840
+ text: `Page updated successfully!
16841
+
16842
+ Title: ${updatedPage.title}
16843
+ URL: ${updatedPage.url}
16844
+ ID: ${updatedPage.id}
16845
+ Last edited: ${updatedPage.last_edited_time}`
16846
+ }
16847
+ ],
16848
+ structuredContent: toStructured(updatedPage)
16849
+ };
16850
+ }
16414
16851
  default:
16415
16852
  return errorResult(`Unknown action: ${input.action}`);
16416
16853
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
3
  "mcpName": "io.github.contextstreamio/mcp-server",
4
- "version": "0.4.31",
4
+ "version": "0.4.32",
5
5
  "description": "ContextStream MCP server - v0.4.x with consolidated domain tools (~11 tools, ~75% token reduction). Code context, memory, search, and AI tools.",
6
6
  "type": "module",
7
7
  "license": "MIT",