@topolo/mcp 0.2.3 → 0.2.5

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 +48 -26
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.ts
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
 
6
- // node_modules/@topolo/sdk/dist/index.js
6
+ // ../packages/topolo-sdk/dist/index.js
7
7
  function applyAuthHeaders(headers, credential) {
8
8
  if (credential.kind === "api_key") {
9
9
  headers.set("X-Api-Key", credential.apiKey);
@@ -67,13 +67,14 @@ var SERVICES = {
67
67
  chat: "https://chat.topolo.app",
68
68
  commerce: "https://topolo-commerce-api.topolo.workers.dev",
69
69
  crm: "https://crm-api.topolo.app",
70
+ feed: "https://topolo-feed-api.topolo.app",
70
71
  forecast: "https://forecast-worker-production.topolo.workers.dev",
71
72
  learn: "https://topololearn-api.topolo.workers.dev",
72
73
  mail: "https://mail.topolo.app",
73
74
  mdm: "https://topolo-mdm-api.topolo.app",
74
75
  messaging: "https://messages.topolo.app",
75
76
  nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
76
- one: "https://topoloone-worker.topolo.workers.dev",
77
+ one: "https://one.topolo.app",
77
78
  pay: "https://topolo-pay.topolo.workers.dev",
78
79
  "quro.api": "https://api.ol0.me",
79
80
  "quro.redirect": "https://ol0.me",
@@ -403,24 +404,34 @@ var APPLICATIONS = {
403
404
  "appDir": "TopoloFeed",
404
405
  "name": "TopoloFeed",
405
406
  "packageName": null,
406
- "productionUrl": null,
407
- "services": [],
407
+ "productionUrl": "https://topolo-feed-api.topolo.app",
408
+ "services": [
409
+ "feed"
410
+ ],
408
411
  "deployTargets": [
409
412
  {
410
413
  "name": "topolo-feed-analytics-api",
411
414
  "kind": "worker",
412
- "apiUrl": null,
413
- "domains": [],
414
- "routes": [],
415
+ "apiUrl": "https://topolo-feed-analytics-api.topolo.app",
416
+ "domains": [
417
+ "topolo-feed-analytics-api.topolo.app"
418
+ ],
419
+ "routes": [
420
+ "topolo-feed-analytics-api.topolo.app"
421
+ ],
415
422
  "serviceId": null
416
423
  },
417
424
  {
418
425
  "name": "topolo-feed-api",
419
426
  "kind": "worker",
420
- "apiUrl": null,
421
- "domains": [],
422
- "routes": [],
423
- "serviceId": null
427
+ "apiUrl": "https://topolo-feed-api.topolo.app",
428
+ "domains": [
429
+ "topolo-feed-api.topolo.app"
430
+ ],
431
+ "routes": [
432
+ "topolo-feed-api.topolo.app"
433
+ ],
434
+ "serviceId": "feed"
424
435
  }
425
436
  ]
426
437
  },
@@ -660,7 +671,7 @@ var APPLICATIONS = {
660
671
  {
661
672
  "name": "topoloone-worker",
662
673
  "kind": "worker",
663
- "apiUrl": "https://topoloone-worker.topolo.workers.dev",
674
+ "apiUrl": "https://one.topolo.app",
664
675
  "domains": [],
665
676
  "routes": [
666
677
  "one.topolo.app/*"
@@ -957,10 +968,12 @@ var APPLICATION_REQUIREMENTS = [
957
968
  evidence: [
958
969
  "@topolo/ui-kit is used for the platform shell where the app has authenticated UI",
959
970
  "The shared launcher/app switcher is reachable from authenticated app chrome",
960
- "Account menu and sign-out behavior use the shared platform affordance"
971
+ "Account menu and sign-out behavior use TopoloAppShell or TopoloAccountMenu"
961
972
  ],
962
973
  implementation: [
963
- "Use TopoloShell or the current shared shell contract for authenticated app layouts",
974
+ "Use TopoloAppShell for authenticated app layouts",
975
+ "Use TopoloAccountMenu when a partial-shell surface still needs account chrome",
976
+ "Pass app-specific account actions as additive menu items instead of forking dropdowns",
964
977
  "Use shared design tokens and platform UI primitives before creating local equivalents",
965
978
  "Keep mobile and desktop shell behavior aligned with the platform UI kit"
966
979
  ]
@@ -1064,8 +1077,9 @@ var APPLICATION_REQUIREMENTS = [
1064
1077
  ];
1065
1078
  function applicationRequirementScopes(application) {
1066
1079
  const scopes = /* @__PURE__ */ new Set(["all"]);
1067
- const hasBrowserSurface = Boolean(application.productionUrl) || application.deployTargets.some((target) => target.kind === "pages");
1068
- const hasApiSurface = application.services.length > 0 || application.deployTargets.some((target) => Boolean(target.apiUrl));
1080
+ const deployTargets = application.deployTargets;
1081
+ const hasBrowserSurface = Boolean(application.productionUrl) || deployTargets.some((target) => target.kind === "pages");
1082
+ const hasApiSurface = application.services.length > 0 || deployTargets.some((target) => Boolean(target.apiUrl));
1069
1083
  if (hasBrowserSurface) scopes.add("browser");
1070
1084
  if (hasApiSurface) scopes.add("api");
1071
1085
  if (application.id === "cli" || application.id === "mcp" || application.id === "cloudcontrol") {
@@ -1251,10 +1265,11 @@ function statusRank(status) {
1251
1265
  }
1252
1266
  var DEFAULT_SERVICE_URLS = SERVICES;
1253
1267
  function resolveServiceUrl(service, overrides) {
1254
- const override = overrides?.[service];
1268
+ var _a;
1269
+ const override = overrides == null ? void 0 : overrides[service];
1255
1270
  if (override) return override;
1256
1271
  const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
1257
- const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
1272
+ const envValue = typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a[envKey] : void 0;
1258
1273
  if (envValue) return envValue;
1259
1274
  return DEFAULT_SERVICE_URLS[service];
1260
1275
  }
@@ -1268,8 +1283,9 @@ var TopoloClient = class {
1268
1283
  fetchImpl;
1269
1284
  debug;
1270
1285
  constructor(options) {
1286
+ var _a;
1271
1287
  if (!options.credential) throw new TopoloAuthError("credential is required");
1272
- if (!options.agent?.clientName) throw new TopoloAuthError("agent.clientName is required");
1288
+ if (!((_a = options.agent) == null ? void 0 : _a.clientName)) throw new TopoloAuthError("agent.clientName is required");
1273
1289
  this.credential = options.credential;
1274
1290
  this.agent = options.agent;
1275
1291
  this.serviceUrls = options.serviceUrls;
@@ -1457,6 +1473,7 @@ var CrmModule = class {
1457
1473
  }
1458
1474
  client;
1459
1475
  async listContacts(options = {}) {
1476
+ var _a, _b, _c;
1460
1477
  const res = await this.client.request({
1461
1478
  service: "crm",
1462
1479
  path: "/api/contacts",
@@ -1466,12 +1483,12 @@ var CrmModule = class {
1466
1483
  pageSize: options.pageSize
1467
1484
  }
1468
1485
  });
1469
- const rows = Array.isArray(res?.contacts) ? res.contacts : Array.isArray(res?.data) ? res.data : [];
1486
+ const rows = Array.isArray(res == null ? void 0 : res.contacts) ? res.contacts : Array.isArray(res == null ? void 0 : res.data) ? res.data : [];
1470
1487
  return {
1471
1488
  contacts: rows.map(toSummary),
1472
- total: res?.total ?? res?.pagination?.total ?? rows.length,
1473
- page: res?.page ?? res?.pagination?.page ?? options.page ?? 1,
1474
- pageSize: res?.pageSize ?? res?.pagination?.pageSize ?? options.pageSize ?? rows.length
1489
+ total: (res == null ? void 0 : res.total) ?? ((_a = res == null ? void 0 : res.pagination) == null ? void 0 : _a.total) ?? rows.length,
1490
+ page: (res == null ? void 0 : res.page) ?? ((_b = res == null ? void 0 : res.pagination) == null ? void 0 : _b.page) ?? options.page ?? 1,
1491
+ pageSize: (res == null ? void 0 : res.pageSize) ?? ((_c = res == null ? void 0 : res.pagination) == null ? void 0 : _c.pageSize) ?? options.pageSize ?? rows.length
1475
1492
  };
1476
1493
  }
1477
1494
  async getContact(contactId) {
@@ -1544,8 +1561,11 @@ import {
1544
1561
  } from "@modelcontextprotocol/sdk/types.js";
1545
1562
 
1546
1563
  // src/gating.ts
1564
+ function hasPlatformAccess(set) {
1565
+ return (set.role === "platform_super_admin" || set.role === "platform_admin") && set.orgSlug === "admin";
1566
+ }
1547
1567
  function hasScope(set, required) {
1548
- if (set.role === "super_admin") return true;
1568
+ if (hasPlatformAccess(set)) return true;
1549
1569
  if (set.permissions.includes("*")) return true;
1550
1570
  const [servicePart, actionPart] = splitPermission(required);
1551
1571
  if (!servicePart) return set.permissions.includes(required);
@@ -1900,7 +1920,7 @@ function statusesAtOrWorse(threshold) {
1900
1920
  }
1901
1921
 
1902
1922
  // src/version.ts
1903
- var MCP_VERSION = "0.2.3";
1923
+ var MCP_VERSION = "0.2.5";
1904
1924
 
1905
1925
  // src/server.ts
1906
1926
  function buildServer(topolo, scopes, tools = TOOLS) {
@@ -1995,9 +2015,11 @@ async function main() {
1995
2015
  async function loadScopes(topolo) {
1996
2016
  try {
1997
2017
  const info = await topolo.identity.whoami();
2018
+ const userWithOrgSlug = info.user;
1998
2019
  return {
1999
2020
  permissions: info.user.permissions,
2000
- role: info.user.role
2021
+ role: info.user.role,
2022
+ orgSlug: info.organization?.slug || userWithOrgSlug.orgSlug || void 0
2001
2023
  };
2002
2024
  } catch (err) {
2003
2025
  if (err instanceof TopoloAuthError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topolo/mcp",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "@modelcontextprotocol/sdk": "^1.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@topolo/sdk": "latest",
24
+ "@topolo/sdk": "file:../packages/topolo-sdk",
25
25
  "@types/node": "^20.12.0",
26
26
  "tsup": "^8.0.0",
27
27
  "typescript": "^5.4.0",