@topolo/mcp 0.9.1 → 0.9.3

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.ts
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
 
6
- // ../../../topolo-platform/packages/topolo-sdk/dist/index.js
6
+ // ../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);
@@ -69,6 +69,7 @@ var APP_API_URLS = {
69
69
  auth: "https://auth.topolo.app",
70
70
  backup: "https://backup.topolo.app",
71
71
  books: "https://books.topolo.app",
72
+ brand: "https://brand.topolo.app",
72
73
  bugfix: "https://bugfix.topolo.app",
73
74
  bytes: "https://bytes.topolo.app",
74
75
  calendar: "https://calendar.topolo.app",
@@ -130,7 +131,9 @@ var APPLICATIONS = {
130
131
  "domains": [
131
132
  "admin.topolo.app"
132
133
  ],
133
- "routes": [],
134
+ "routes": [
135
+ "admin.topolo.app"
136
+ ],
134
137
  "appId": null
135
138
  },
136
139
  {
@@ -178,7 +181,7 @@ var APPLICATIONS = {
178
181
  "appDir": "TopoloAuth",
179
182
  "name": "topolo-auth",
180
183
  "packageName": "topolo-auth",
181
- "productionUrl": "https://auth.topolo.app/login",
184
+ "productionUrl": "https://auth.topolo.app",
182
185
  "services": [
183
186
  "auth"
184
187
  ],
@@ -214,7 +217,9 @@ var APPLICATIONS = {
214
217
  "domains": [
215
218
  "backup.topolo.app"
216
219
  ],
217
- "routes": [],
220
+ "routes": [
221
+ "backup.topolo.app"
222
+ ],
218
223
  "appId": "backup"
219
224
  }
220
225
  ]
@@ -249,6 +254,36 @@ var APPLICATIONS = {
249
254
  }
250
255
  ]
251
256
  },
257
+ "brand": {
258
+ "id": "brand",
259
+ "appDir": "TopoloBrand",
260
+ "name": "topolo-brand",
261
+ "packageName": "@topolo/topolo-brand",
262
+ "productionUrl": "https://brand.topolo.app",
263
+ "services": [
264
+ "brand"
265
+ ],
266
+ "deployTargets": [
267
+ {
268
+ "name": "topolo-brand",
269
+ "kind": "worker",
270
+ "apiUrl": "https://brand.topolo.app",
271
+ "domains": [
272
+ "brand.topolo.app"
273
+ ],
274
+ "routes": [],
275
+ "appId": "brand"
276
+ },
277
+ {
278
+ "name": "topolo-brand-api",
279
+ "kind": "worker",
280
+ "apiUrl": null,
281
+ "domains": [],
282
+ "routes": [],
283
+ "appId": null
284
+ }
285
+ ]
286
+ },
252
287
  "bugfix": {
253
288
  "id": "bugfix",
254
289
  "appDir": "TopoloBugFix",
@@ -288,7 +323,9 @@ var APPLICATIONS = {
288
323
  "domains": [
289
324
  "bytes.topolo.app"
290
325
  ],
291
- "routes": [],
326
+ "routes": [
327
+ "bytes.topolo.app"
328
+ ],
292
329
  "appId": "bytes"
293
330
  },
294
331
  {
@@ -318,7 +355,9 @@ var APPLICATIONS = {
318
355
  "domains": [
319
356
  "calendar.topolo.app"
320
357
  ],
321
- "routes": [],
358
+ "routes": [
359
+ "calendar.topolo.app"
360
+ ],
322
361
  "appId": "calendar"
323
362
  },
324
363
  {
@@ -348,9 +387,7 @@ var APPLICATIONS = {
348
387
  "domains": [
349
388
  "campaigns.topolo.app"
350
389
  ],
351
- "routes": [
352
- "campaigns.topolo.app"
353
- ],
390
+ "routes": [],
354
391
  "appId": "campaigns"
355
392
  },
356
393
  {
@@ -440,7 +477,9 @@ var APPLICATIONS = {
440
477
  "domains": [
441
478
  "guest.topolo.app"
442
479
  ],
443
- "routes": [],
480
+ "routes": [
481
+ "guest.topolo.app"
482
+ ],
444
483
  "appId": null
445
484
  },
446
485
  {
@@ -450,7 +489,9 @@ var APPLICATIONS = {
450
489
  "domains": [
451
490
  "commerce.topolo.app"
452
491
  ],
453
- "routes": [],
492
+ "routes": [
493
+ "commerce.topolo.app"
494
+ ],
454
495
  "appId": "commerce"
455
496
  },
456
497
  {
@@ -460,7 +501,9 @@ var APPLICATIONS = {
460
501
  "domains": [
461
502
  "station-commerce.topolo.app"
462
503
  ],
463
- "routes": [],
504
+ "routes": [
505
+ "station-commerce.topolo.app"
506
+ ],
464
507
  "appId": null
465
508
  }
466
509
  ]
@@ -638,7 +681,9 @@ var APPLICATIONS = {
638
681
  "domains": [
639
682
  "docs.topolo.app"
640
683
  ],
641
- "routes": [],
684
+ "routes": [
685
+ "docs.topolo.app"
686
+ ],
642
687
  "appId": null
643
688
  },
644
689
  {
@@ -668,7 +713,9 @@ var APPLICATIONS = {
668
713
  "domains": [
669
714
  "feed-analytics-api.topolo.app"
670
715
  ],
671
- "routes": [],
716
+ "routes": [
717
+ "feed-analytics-api.topolo.app"
718
+ ],
672
719
  "appId": null
673
720
  },
674
721
  {
@@ -678,7 +725,9 @@ var APPLICATIONS = {
678
725
  "domains": [
679
726
  "feed-api.topolo.app"
680
727
  ],
681
- "routes": [],
728
+ "routes": [
729
+ "feed-api.topolo.app"
730
+ ],
682
731
  "appId": null
683
732
  },
684
733
  {
@@ -688,7 +737,9 @@ var APPLICATIONS = {
688
737
  "domains": [
689
738
  "feed.topolo.app"
690
739
  ],
691
- "routes": [],
740
+ "routes": [
741
+ "feed.topolo.app"
742
+ ],
692
743
  "appId": "feed"
693
744
  }
694
745
  ]
@@ -800,7 +851,9 @@ var APPLICATIONS = {
800
851
  "domains": [
801
852
  "home.topolo.app"
802
853
  ],
803
- "routes": [],
854
+ "routes": [
855
+ "home.topolo.app"
856
+ ],
804
857
  "appId": "home"
805
858
  },
806
859
  {
@@ -890,7 +943,9 @@ var APPLICATIONS = {
890
943
  "domains": [
891
944
  "learn.topolo.app"
892
945
  ],
893
- "routes": [],
946
+ "routes": [
947
+ "learn.topolo.app"
948
+ ],
894
949
  "appId": "learn"
895
950
  },
896
951
  {
@@ -982,7 +1037,9 @@ var APPLICATIONS = {
982
1037
  "domains": [
983
1038
  "mdm.topolo.app"
984
1039
  ],
985
- "routes": [],
1040
+ "routes": [
1041
+ "mdm.topolo.app"
1042
+ ],
986
1043
  "appId": "mdm"
987
1044
  }
988
1045
  ]
@@ -1004,7 +1061,9 @@ var APPLICATIONS = {
1004
1061
  "domains": [
1005
1062
  "messages.topolo.app"
1006
1063
  ],
1007
- "routes": [],
1064
+ "routes": [
1065
+ "messages.topolo.app"
1066
+ ],
1008
1067
  "appId": "messages"
1009
1068
  },
1010
1069
  {
@@ -1038,11 +1097,13 @@ var APPLICATIONS = {
1038
1097
  {
1039
1098
  "name": "topolo-nexus-dashboard",
1040
1099
  "kind": "worker",
1041
- "apiUrl": null,
1100
+ "apiUrl": "https://nexus.topolo.app",
1042
1101
  "domains": [
1043
1102
  "nexus.topolo.app"
1044
1103
  ],
1045
- "routes": [],
1104
+ "routes": [
1105
+ "nexus.topolo.app"
1106
+ ],
1046
1107
  "appId": null
1047
1108
  },
1048
1109
  {
@@ -1170,7 +1231,9 @@ var APPLICATIONS = {
1170
1231
  "domains": [
1171
1232
  "p2p.topolo.app"
1172
1233
  ],
1173
- "routes": [],
1234
+ "routes": [
1235
+ "p2p.topolo.app"
1236
+ ],
1174
1237
  "appId": "p2p"
1175
1238
  },
1176
1239
  {
@@ -1367,7 +1430,9 @@ var APPLICATIONS = {
1367
1430
  "domains": [
1368
1431
  "studio.topolo.app"
1369
1432
  ],
1370
- "routes": [],
1433
+ "routes": [
1434
+ "studio.topolo.app"
1435
+ ],
1371
1436
  "appId": "social_studio"
1372
1437
  },
1373
1438
  {
@@ -1405,7 +1470,9 @@ var APPLICATIONS = {
1405
1470
  "domains": [
1406
1471
  "socialize.topolo.app"
1407
1472
  ],
1408
- "routes": [],
1473
+ "routes": [
1474
+ "socialize.topolo.app"
1475
+ ],
1409
1476
  "appId": "socialize"
1410
1477
  },
1411
1478
  {
@@ -1415,7 +1482,9 @@ var APPLICATIONS = {
1415
1482
  "domains": [
1416
1483
  "socialize-api.topolo.app"
1417
1484
  ],
1418
- "routes": [],
1485
+ "routes": [
1486
+ "socialize-api.topolo.app"
1487
+ ],
1419
1488
  "appId": null
1420
1489
  },
1421
1490
  {
@@ -1475,7 +1544,9 @@ var APPLICATIONS = {
1475
1544
  "domains": [
1476
1545
  "status.topolo.app"
1477
1546
  ],
1478
- "routes": [],
1547
+ "routes": [
1548
+ "status.topolo.app"
1549
+ ],
1479
1550
  "appId": "status"
1480
1551
  }
1481
1552
  ]
@@ -1591,7 +1662,9 @@ var APPLICATIONS = {
1591
1662
  "domains": [
1592
1663
  "voice.topolo.app"
1593
1664
  ],
1594
- "routes": [],
1665
+ "routes": [
1666
+ "voice.topolo.app"
1667
+ ],
1595
1668
  "appId": "voice"
1596
1669
  },
1597
1670
  {
@@ -1642,7 +1715,9 @@ var APPLICATIONS = {
1642
1715
  "domains": [
1643
1716
  "web.topolo.app"
1644
1717
  ],
1645
- "routes": [],
1718
+ "routes": [
1719
+ "web.topolo.app"
1720
+ ],
1646
1721
  "appId": "web"
1647
1722
  }
1648
1723
  ]
@@ -1719,7 +1794,7 @@ var APPLICATION_REQUIREMENTS = [
1719
1794
  "Use TopoloAppMetricCard, TopoloAppEmptyState, TopoloAppStatusBadge, TopoloAppGrid, and TopoloAppSection for repeated app body patterns",
1720
1795
  "Keep visual QA fixtures available through visualQa=1 or __devpreview=1 so screenshot checks do not depend on live API state",
1721
1796
  "Keep mobile and desktop shell behavior aligned with the platform UI kit",
1722
- "Constrain app-owned workspace wrappers with min-width: 0, width: auto, and viewport-aware max-width so shell padding cannot create page-level horizontal overflow"
1797
+ "Constrain the app workspace-view layout wrappers with min-width: 0, width: auto, and viewport-aware max-width so shell padding cannot create page-level horizontal overflow"
1723
1798
  ]
1724
1799
  },
1725
1800
  {
@@ -2363,6 +2438,8 @@ var TopoloClient = class _TopoloClient {
2363
2438
  requireConfirmForWrites;
2364
2439
  timeoutMs;
2365
2440
  fetchImpl;
2441
+ credentialProvider;
2442
+ credentialLoadInFlight = null;
2366
2443
  refreshCredential;
2367
2444
  refreshInFlight = null;
2368
2445
  debug;
@@ -2390,6 +2467,7 @@ var TopoloClient = class _TopoloClient {
2390
2467
  this.requireConfirmForWrites = options.requireConfirmForWrites !== false;
2391
2468
  this.timeoutMs = options.timeoutMs ?? 3e4;
2392
2469
  this.fetchImpl = options.fetch ?? fetch;
2470
+ this.credentialProvider = options.credentialProvider;
2393
2471
  this.refreshCredential = options.refreshCredential;
2394
2472
  this.debug = options.debug;
2395
2473
  }
@@ -2412,6 +2490,7 @@ var TopoloClient = class _TopoloClient {
2412
2490
  `Mutating ${method} requests require { confirm: true }. This guardrail prevents agents from issuing writes without an explicit human-in-the-loop acknowledgement.`
2413
2491
  );
2414
2492
  }
2493
+ await this.loadCurrentCredential();
2415
2494
  const resolvedService = opts.baseUrl ? { serviceKey: normalizeLookupKey(opts.service), baseUrl: requireHttpOrigin(opts.baseUrl) } : await this.resolveRequestService(opts.service);
2416
2495
  const baseUrl = resolvedService.baseUrl;
2417
2496
  const url = new URL(opts.path, baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`);
@@ -2523,6 +2602,19 @@ var TopoloClient = class _TopoloClient {
2523
2602
  });
2524
2603
  return parsed;
2525
2604
  }
2605
+ async loadCurrentCredential() {
2606
+ if (!this.credentialProvider) return;
2607
+ this.credentialLoadInFlight ??= this.credentialProvider().then((credential) => {
2608
+ if (!credential) {
2609
+ throw new TopoloAuthError("The configured Topolo credential is no longer available.");
2610
+ }
2611
+ this.credential = credential;
2612
+ return credential;
2613
+ }).finally(() => {
2614
+ this.credentialLoadInFlight = null;
2615
+ });
2616
+ await this.credentialLoadInFlight;
2617
+ }
2526
2618
  async refreshRejectedAccessToken(attemptedAccessToken) {
2527
2619
  if (this.credential.kind === "access_token" && this.credential.accessToken !== attemptedAccessToken) {
2528
2620
  return this.credential;
@@ -3191,6 +3283,7 @@ function normalizeActionCatalogEntry(item) {
3191
3283
  permissionName: pickActionString(a.permission_name) ?? pickActionString(a.permissionName) ?? "",
3192
3284
  requiredPermission: pickActionString(a.required_permission) ?? pickActionString(a.requiredPermission) ?? "",
3193
3285
  authorizationMode: pickAuthorizationMode(a.authorization_mode ?? a.authorizationMode),
3286
+ allowedServices: stringArray(a.allowed_services ?? a.allowedServices),
3194
3287
  inputSchema: plainObject(a.input_schema ?? a.inputSchema),
3195
3288
  outputSchema: plainObject(a.output_schema ?? a.outputSchema),
3196
3289
  agentContract: plainObject(a.agent_contract ?? a.agentContract),
@@ -3212,7 +3305,7 @@ function pickAgentAccess(value) {
3212
3305
  return value === "auto" || value === "confirm" || value === "off" ? value : null;
3213
3306
  }
3214
3307
  function pickAuthorizationMode(value) {
3215
- return value === "runtime" ? "runtime" : "static";
3308
+ return value === "runtime" || value === "public" || value === "service" ? value : "static";
3216
3309
  }
3217
3310
  function plainObject(value) {
3218
3311
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -3369,7 +3462,7 @@ function createTopolo(options) {
3369
3462
  };
3370
3463
  }
3371
3464
 
3372
- // ../../../topolo-platform/packages/topolo-sdk/dist/node/credential-store.js
3465
+ // ../topolo-sdk/dist/node/credential-store.js
3373
3466
  import { mkdir, readFile, writeFile, chmod } from "fs/promises";
3374
3467
  import { existsSync } from "fs";
3375
3468
  import { homedir, platform } from "os";
@@ -3407,6 +3500,7 @@ var APP_API_URLS2 = {
3407
3500
  auth: "https://auth.topolo.app",
3408
3501
  backup: "https://backup.topolo.app",
3409
3502
  books: "https://books.topolo.app",
3503
+ brand: "https://brand.topolo.app",
3410
3504
  bugfix: "https://bugfix.topolo.app",
3411
3505
  bytes: "https://bytes.topolo.app",
3412
3506
  calendar: "https://calendar.topolo.app",
@@ -3663,9 +3757,9 @@ async function refreshCredentialIfNeeded(environment = selectedEnvironment(), op
3663
3757
  const profile = profileForEnvironment(config, environment);
3664
3758
  const cred = profile.credential;
3665
3759
  if (!cred || cred.kind !== "access_token") return cred ?? null;
3666
- if (!cred.refreshToken || !cred.expiresAt || !profile.oauthClientId) return cred;
3760
+ if (!cred.refreshToken || !profile.oauthClientId) return cred;
3667
3761
  const now = Math.floor(Date.now() / 1e3);
3668
- if (!options.force && cred.expiresAt - REFRESH_SKEW_SECONDS > now) return cred;
3762
+ if (!options.force && cred.expiresAt && cred.expiresAt - REFRESH_SKEW_SECONDS > now) return cred;
3669
3763
  try {
3670
3764
  const oauth = new TopoloOAuth({
3671
3765
  serviceUrls: resolveServiceUrls(profile.serviceUrls, environment)
@@ -3706,9 +3800,9 @@ async function refreshContextCredentialIfNeeded(environment, key, options = {})
3706
3800
  const credential = context?.credential;
3707
3801
  if (!credential || credential.kind !== "access_token") return credential ?? null;
3708
3802
  const oauthClientId = context.oauthClientId ?? profile.oauthClientId;
3709
- if (!credential.refreshToken || !credential.expiresAt || !oauthClientId) return credential;
3803
+ if (!credential.refreshToken || !oauthClientId) return credential;
3710
3804
  const now = Math.floor(Date.now() / 1e3);
3711
- if (!options.force && credential.expiresAt - REFRESH_SKEW_SECONDS > now) return credential;
3805
+ if (!options.force && credential.expiresAt && credential.expiresAt - REFRESH_SKEW_SECONDS > now) return credential;
3712
3806
  try {
3713
3807
  const oauth = new TopoloOAuth({
3714
3808
  serviceUrls: resolveServiceUrls(profile.serviceUrls, environment)
@@ -3958,7 +4052,7 @@ var TOOLS = [
3958
4052
  properties: {
3959
4053
  actionId: { type: "string", minLength: 1 },
3960
4054
  input: { type: "object", additionalProperties: true },
3961
- resourceType: { type: "string", description: "Optional app-local resource alias, such as workspace." },
4055
+ resourceType: { type: "string", description: "Optional resource-scoping alias published in the app resource catalog (e.g. workspace, brand, merchant)." },
3962
4056
  resourceId: { type: "string", description: "Resource id. Required when resourceType is provided." }
3963
4057
  },
3964
4058
  required: ["actionId"],
@@ -3990,7 +4084,7 @@ var TOOLS = [
3990
4084
  properties: {
3991
4085
  actionId: { type: "string", minLength: 1 },
3992
4086
  input: { type: "object", additionalProperties: true },
3993
- resourceType: { type: "string", description: "Optional app-local resource alias, such as workspace." },
4087
+ resourceType: { type: "string", description: "Optional resource-scoping alias published in the app resource catalog (e.g. workspace, brand, merchant)." },
3994
4088
  resourceId: { type: "string", description: "Resource id. Required when resourceType is provided." },
3995
4089
  confirm: { type: "boolean" }
3996
4090
  },
@@ -4051,7 +4145,7 @@ var TOOLS = [
4051
4145
  properties: {
4052
4146
  actionId: { type: "string", minLength: 1 },
4053
4147
  input: { type: "object", additionalProperties: true },
4054
- resourceType: { type: "string", description: "Optional app-local resource alias, such as workspace." },
4148
+ resourceType: { type: "string", description: "Optional resource-scoping alias published in the app resource catalog (e.g. workspace, brand, merchant)." },
4055
4149
  resourceId: { type: "string", description: "Resource id. Required when resourceType is provided." },
4056
4150
  confirm: { type: "boolean", description: "Include confirmation in the plan without executing the action." }
4057
4151
  },
@@ -4529,6 +4623,10 @@ async function resolveMcpCredential(environment, selector = process.env.TOPOLO_C
4529
4623
  return {
4530
4624
  credential,
4531
4625
  contextKey,
4626
+ credentialProvider: () => dependencies.refreshContextCredentialIfNeeded(
4627
+ environment,
4628
+ contextKey
4629
+ ),
4532
4630
  refreshCredential: () => dependencies.refreshContextCredentialIfNeeded(
4533
4631
  environment,
4534
4632
  contextKey,
@@ -4539,6 +4637,7 @@ async function resolveMcpCredential(environment, selector = process.env.TOPOLO_C
4539
4637
  return {
4540
4638
  credential: await dependencies.refreshCredentialIfNeeded(environment),
4541
4639
  contextKey: null,
4640
+ credentialProvider: () => dependencies.refreshCredentialIfNeeded(environment),
4542
4641
  refreshCredential: () => dependencies.refreshCredentialIfNeeded(environment, { force: true })
4543
4642
  };
4544
4643
  }
@@ -4567,6 +4666,7 @@ async function main() {
4567
4666
  },
4568
4667
  serviceUrls,
4569
4668
  requireConfirmForWrites: true,
4669
+ ...resolvedCredential.credentialProvider ? { credentialProvider: resolvedCredential.credentialProvider } : {},
4570
4670
  ...resolvedCredential.refreshCredential ? { refreshCredential: resolvedCredential.refreshCredential } : {}
4571
4671
  });
4572
4672
  const scopes = await loadScopes(topolo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topolo/mcp",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
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": {
@@ -36,7 +36,7 @@
36
36
  "@modelcontextprotocol/sdk": "^1.0.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@topolo/sdk": "^0.9.1"
39
+ "@topolo/sdk": "^0.9.4"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@topolo/sdk": "file:../topolo-sdk",