@topolo/mcp 0.4.5 → 0.4.7
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/dispatch.js +4 -6
- package/dist/index.js +34 -46
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
auditAllApplicationRequirements,
|
|
11
11
|
applicationRequirementScopes,
|
|
12
12
|
requirementsForApplication,
|
|
13
|
-
resolveCatalogServiceUrl
|
|
14
|
-
resolveServiceUrl
|
|
13
|
+
resolveCatalogServiceUrl
|
|
15
14
|
} from "@topolo/sdk";
|
|
16
15
|
|
|
17
16
|
// src/gating.ts
|
|
@@ -71,7 +70,7 @@ var TOOLS = [
|
|
|
71
70
|
{
|
|
72
71
|
name: "topolo_list_services",
|
|
73
72
|
title: "List every Topolo service the agent can reach",
|
|
74
|
-
description: "Returns the credential-scoped service registry: one entry per platform service the current credential can use in its organization, with granted permissions and
|
|
73
|
+
description: "Returns the credential-scoped service registry: one entry per platform service the current credential can use in its organization, with granted permissions, API URL, and launch URL. Use this to discover what `topolo_api_call` can address. This is not the global platform catalog.",
|
|
75
74
|
requiredScopes: [],
|
|
76
75
|
destructive: false,
|
|
77
76
|
inputSchema: {
|
|
@@ -87,10 +86,9 @@ var TOOLS = [
|
|
|
87
86
|
serviceId: entry.serviceId,
|
|
88
87
|
slug: entry.slug,
|
|
89
88
|
name: entry.name,
|
|
90
|
-
baseUrl: entry.baseUrl,
|
|
91
89
|
apiBaseUrl: entry.apiBaseUrl,
|
|
92
90
|
launchUrl: entry.launchUrl,
|
|
93
|
-
effectiveUrl: resolveCatalogServiceUrl(entry, { serviceKey: id })
|
|
91
|
+
effectiveUrl: resolveCatalogServiceUrl(entry, { serviceKey: id }),
|
|
94
92
|
surfaceKind: entry.surfaceKind,
|
|
95
93
|
launchable: entry.launchable,
|
|
96
94
|
permissions: [...entry.permissions]
|
|
@@ -139,7 +137,7 @@ var TOOLS = [
|
|
|
139
137
|
{
|
|
140
138
|
name: "topolo_get_application",
|
|
141
139
|
title: "Describe one Topolo platform application",
|
|
142
|
-
description: "Returns one live application catalog entry (service id, slug, name,
|
|
140
|
+
description: "Returns one live application catalog entry (service id, slug, name, API URL, launch URL, status). Accepts the service id, slug, or name. Resolved against the live registry so newly-registered apps work without a client rebuild.",
|
|
143
141
|
requiredScopes: [],
|
|
144
142
|
destructive: false,
|
|
145
143
|
inputSchema: {
|
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ var SERVICES = {
|
|
|
83
83
|
inventory: "https://inventory.topolo.app",
|
|
84
84
|
learn: "https://learn-api.topolo.app",
|
|
85
85
|
localize: "https://localize.topolo.app",
|
|
86
|
-
mail: "https://mail.topolo.app",
|
|
86
|
+
mail: "https://mail-api.topolo.app",
|
|
87
87
|
mdm: "https://mdm-api.topolo.app",
|
|
88
88
|
messages: "https://messages.topolo.app",
|
|
89
89
|
nexus: "https://nexus-api.topolo.app",
|
|
@@ -919,15 +919,17 @@ var APPLICATIONS = {
|
|
|
919
919
|
"mail.topolo.app"
|
|
920
920
|
],
|
|
921
921
|
"routes": [],
|
|
922
|
-
"serviceId":
|
|
922
|
+
"serviceId": null
|
|
923
923
|
},
|
|
924
924
|
{
|
|
925
925
|
"name": "topolo-mail-api",
|
|
926
926
|
"kind": "worker",
|
|
927
|
-
"apiUrl":
|
|
928
|
-
"domains": [
|
|
927
|
+
"apiUrl": "https://mail-api.topolo.app",
|
|
928
|
+
"domains": [
|
|
929
|
+
"mail-api.topolo.app"
|
|
930
|
+
],
|
|
929
931
|
"routes": [],
|
|
930
|
-
"serviceId":
|
|
932
|
+
"serviceId": "mail"
|
|
931
933
|
}
|
|
932
934
|
]
|
|
933
935
|
},
|
|
@@ -2046,10 +2048,7 @@ function resolveCatalogServiceUrl(entry, options = {}) {
|
|
|
2046
2048
|
if (override) return override;
|
|
2047
2049
|
const apiBaseUrl = firstString(entry.apiBaseUrl, entry.api_base_url);
|
|
2048
2050
|
if (apiBaseUrl) return apiBaseUrl;
|
|
2049
|
-
|
|
2050
|
-
const liveUrl = firstString(entry.baseUrl);
|
|
2051
|
-
if (bundledUrl && (!liveUrl || sameUrlEnvironment(bundledUrl, liveUrl))) return bundledUrl;
|
|
2052
|
-
return liveUrl ?? bundledUrl ?? null;
|
|
2051
|
+
return null;
|
|
2053
2052
|
}
|
|
2054
2053
|
function resolveServiceUrl(service, overrides) {
|
|
2055
2054
|
const override = resolveServiceUrlOverride([service], overrides);
|
|
@@ -2091,34 +2090,12 @@ function resolveServiceUrlOverride(keys, overrides) {
|
|
|
2091
2090
|
}
|
|
2092
2091
|
return null;
|
|
2093
2092
|
}
|
|
2094
|
-
function firstBundledServiceUrl(keys) {
|
|
2095
|
-
for (const key of keys) {
|
|
2096
|
-
const url = DEFAULT_SERVICE_URLS[key];
|
|
2097
|
-
if (url) return url;
|
|
2098
|
-
}
|
|
2099
|
-
return null;
|
|
2100
|
-
}
|
|
2101
2093
|
function firstString(...values) {
|
|
2102
2094
|
for (const value of values) {
|
|
2103
2095
|
if (typeof value === "string" && value.trim()) return value.trim();
|
|
2104
2096
|
}
|
|
2105
2097
|
return null;
|
|
2106
2098
|
}
|
|
2107
|
-
function sameUrlEnvironment(left, right) {
|
|
2108
|
-
return urlEnvironment(left) === urlEnvironment(right);
|
|
2109
|
-
}
|
|
2110
|
-
function urlEnvironment(value) {
|
|
2111
|
-
try {
|
|
2112
|
-
const url = new URL(value);
|
|
2113
|
-
const host = url.hostname.toLowerCase();
|
|
2114
|
-
if (host === "localhost" || host === "127.0.0.1") return "local";
|
|
2115
|
-
if (host.endsWith(".stg.topolo.us") || host.includes("topolo-staging")) return "staging";
|
|
2116
|
-
if (host.endsWith(".topolo.app") || host.endsWith(".topolo.us")) return "production";
|
|
2117
|
-
return "external";
|
|
2118
|
-
} catch {
|
|
2119
|
-
return "external";
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
2099
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
2123
2100
|
var TOPOLO_ACTION_ID_HEADER = "X-Topolo-Action-Id";
|
|
2124
2101
|
var TOPOLO_ACTION_NAME_HEADER = "X-Topolo-Action-Name";
|
|
@@ -2289,7 +2266,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
2289
2266
|
async resolveLiveCallableService(serviceKey) {
|
|
2290
2267
|
const catalog = await this.listServices();
|
|
2291
2268
|
const match = catalog.find((entry) => catalogEntryMatches(entry, serviceKey));
|
|
2292
|
-
if (!match
|
|
2269
|
+
if (!match) return null;
|
|
2293
2270
|
const baseUrl = resolveCatalogServiceUrl(match, {
|
|
2294
2271
|
serviceKey,
|
|
2295
2272
|
overrides: this.serviceUrls
|
|
@@ -2387,7 +2364,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
2387
2364
|
slug: typeof s.app_slug === "string" ? s.app_slug : null,
|
|
2388
2365
|
name: typeof s.name === "string" ? s.name : null,
|
|
2389
2366
|
description: typeof s.description === "string" ? s.description : null,
|
|
2390
|
-
baseUrl: typeof s.base_url === "string" ? s.base_url : null,
|
|
2391
2367
|
apiBaseUrl: typeof s.api_base_url === "string" ? s.api_base_url : typeof s.apiBaseUrl === "string" ? s.apiBaseUrl : null,
|
|
2392
2368
|
launchUrl: typeof s.launch_url === "string" ? s.launch_url : typeof s.launchUrl === "string" ? s.launchUrl : null,
|
|
2393
2369
|
status: typeof s.status === "string" ? s.status : null,
|
|
@@ -2474,7 +2450,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
2474
2450
|
slug: app.id,
|
|
2475
2451
|
name: app.name ?? app.id,
|
|
2476
2452
|
description: null,
|
|
2477
|
-
baseUrl: app.productionUrl ?? null,
|
|
2478
2453
|
apiBaseUrl: null,
|
|
2479
2454
|
launchUrl: app.productionUrl ?? null,
|
|
2480
2455
|
status: "bundled",
|
|
@@ -2567,13 +2542,6 @@ function catalogEntryLookupKeys(entry) {
|
|
|
2567
2542
|
}
|
|
2568
2543
|
return [...keys];
|
|
2569
2544
|
}
|
|
2570
|
-
function isCallableCatalogEntry(entry) {
|
|
2571
|
-
const kind = normalizeLookupKey(entry.surfaceKind || "");
|
|
2572
|
-
if (kind === "api" || kind === "technical_service" || kind === "service") return true;
|
|
2573
|
-
return Boolean(
|
|
2574
|
-
(entry.baseUrl || entry.apiBaseUrl) && catalogEntryLookupKeys(entry).some((key) => Object.prototype.hasOwnProperty.call(DEFAULT_SERVICE_URLS, key))
|
|
2575
|
-
);
|
|
2576
|
-
}
|
|
2577
2545
|
function normalizeActionCatalogEntry(item) {
|
|
2578
2546
|
if (!item || typeof item !== "object" || Array.isArray(item)) return null;
|
|
2579
2547
|
const a = item;
|
|
@@ -2849,7 +2817,7 @@ var TOOLS = [
|
|
|
2849
2817
|
{
|
|
2850
2818
|
name: "topolo_list_services",
|
|
2851
2819
|
title: "List every Topolo service the agent can reach",
|
|
2852
|
-
description: "Returns the credential-scoped service registry: one entry per platform service the current credential can use in its organization, with granted permissions and
|
|
2820
|
+
description: "Returns the credential-scoped service registry: one entry per platform service the current credential can use in its organization, with granted permissions, API URL, and launch URL. Use this to discover what `topolo_api_call` can address. This is not the global platform catalog.",
|
|
2853
2821
|
requiredScopes: [],
|
|
2854
2822
|
destructive: false,
|
|
2855
2823
|
inputSchema: {
|
|
@@ -2865,10 +2833,9 @@ var TOOLS = [
|
|
|
2865
2833
|
serviceId: entry.serviceId,
|
|
2866
2834
|
slug: entry.slug,
|
|
2867
2835
|
name: entry.name,
|
|
2868
|
-
baseUrl: entry.baseUrl,
|
|
2869
2836
|
apiBaseUrl: entry.apiBaseUrl,
|
|
2870
2837
|
launchUrl: entry.launchUrl,
|
|
2871
|
-
effectiveUrl: resolveCatalogServiceUrl(entry, { serviceKey: id })
|
|
2838
|
+
effectiveUrl: resolveCatalogServiceUrl(entry, { serviceKey: id }),
|
|
2872
2839
|
surfaceKind: entry.surfaceKind,
|
|
2873
2840
|
launchable: entry.launchable,
|
|
2874
2841
|
permissions: [...entry.permissions]
|
|
@@ -2917,7 +2884,7 @@ var TOOLS = [
|
|
|
2917
2884
|
{
|
|
2918
2885
|
name: "topolo_get_application",
|
|
2919
2886
|
title: "Describe one Topolo platform application",
|
|
2920
|
-
description: "Returns one live application catalog entry (service id, slug, name,
|
|
2887
|
+
description: "Returns one live application catalog entry (service id, slug, name, API URL, launch URL, status). Accepts the service id, slug, or name. Resolved against the live registry so newly-registered apps work without a client rebuild.",
|
|
2921
2888
|
requiredScopes: [],
|
|
2922
2889
|
destructive: false,
|
|
2923
2890
|
inputSchema: {
|
|
@@ -3217,7 +3184,28 @@ function formatKnownValues(values, label) {
|
|
|
3217
3184
|
}
|
|
3218
3185
|
|
|
3219
3186
|
// src/version.ts
|
|
3220
|
-
|
|
3187
|
+
import { readFileSync } from "fs";
|
|
3188
|
+
import { dirname, join } from "path";
|
|
3189
|
+
import { fileURLToPath } from "url";
|
|
3190
|
+
function readMcpVersion() {
|
|
3191
|
+
try {
|
|
3192
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
3193
|
+
const candidates = [
|
|
3194
|
+
join(here, "package.json"),
|
|
3195
|
+
join(here, "..", "package.json")
|
|
3196
|
+
];
|
|
3197
|
+
for (const path of candidates) {
|
|
3198
|
+
try {
|
|
3199
|
+
const pkg = JSON.parse(readFileSync(path, "utf8"));
|
|
3200
|
+
if (typeof pkg.version === "string" && pkg.version) return pkg.version;
|
|
3201
|
+
} catch {
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
} catch {
|
|
3205
|
+
}
|
|
3206
|
+
return "0.0.0";
|
|
3207
|
+
}
|
|
3208
|
+
var MCP_VERSION = readMcpVersion();
|
|
3221
3209
|
|
|
3222
3210
|
// src/server.ts
|
|
3223
3211
|
function buildServer(topolo, scopes, tools = TOOLS) {
|
package/package.json
CHANGED