@topolo/mcp 0.1.2 → 0.2.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/dist/index.js +95 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -58,17 +58,38 @@ var TopoloHttpError = class extends TopoloSdkError {
|
|
|
58
58
|
this.path = path;
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
var
|
|
61
|
+
var SERVICES = {
|
|
62
|
+
agent: "https://topolo-agent-worker.topolo.workers.dev",
|
|
62
63
|
auth: "https://auth.topolo.app",
|
|
63
|
-
|
|
64
|
+
bugfix: "https://bugfix.topolo.app",
|
|
65
|
+
bytes: "https://r2-media-manager-worker.topolo.workers.dev",
|
|
66
|
+
chat: "https://chat.topolo.app",
|
|
67
|
+
commerce: "https://topolo-commerce-api.topolo.workers.dev",
|
|
68
|
+
crm: "https://crm-api.topolo.app",
|
|
69
|
+
forecast: "https://forecast-worker-production.topolo.workers.dev",
|
|
70
|
+
learn: "https://topololearn-api.topolo.workers.dev",
|
|
71
|
+
mdm: "https://nodo-mdm-api.topolo.app",
|
|
72
|
+
messaging: "https://messages.topolo.app",
|
|
73
|
+
nexus: "https://topolo-nexus-gateway.topolo.workers.dev",
|
|
74
|
+
one: "https://topoloone-worker.topolo.workers.dev",
|
|
75
|
+
pay: "https://topolo-pay.topolo.workers.dev",
|
|
76
|
+
"quro.api": "https://api.ol0.me",
|
|
77
|
+
"quro.redirect": "https://ol0.me",
|
|
78
|
+
roadmapper: "https://roadmapper-api.topolo.app",
|
|
79
|
+
social_studio: "https://topolo-social-studio-api.topolo.workers.dev",
|
|
80
|
+
socialize: "https://socialize-prod-api.topolo.workers.dev",
|
|
81
|
+
support: "https://support.topolo.app",
|
|
82
|
+
"web.api": "https://web-api.topolo.app",
|
|
83
|
+
"web.runtime": "https://sites.topolo.app"
|
|
64
84
|
};
|
|
65
85
|
var PLATFORM_SERVICE_IDS = {
|
|
66
86
|
crm: "srv_iCwM4jGXcwlj"
|
|
67
87
|
};
|
|
88
|
+
var DEFAULT_SERVICE_URLS = SERVICES;
|
|
68
89
|
function resolveServiceUrl(service, overrides) {
|
|
69
90
|
const override = overrides?.[service];
|
|
70
91
|
if (override) return override;
|
|
71
|
-
const envKey = `TOPOLO_SERVICE_URL_${service.toUpperCase()}`;
|
|
92
|
+
const envKey = `TOPOLO_SERVICE_URL_${service.replace(/\./g, "_").toUpperCase()}`;
|
|
72
93
|
const envValue = typeof process !== "undefined" ? process.env?.[envKey] : void 0;
|
|
73
94
|
if (envValue) return envValue;
|
|
74
95
|
return DEFAULT_SERVICE_URLS[service];
|
|
@@ -390,6 +411,8 @@ function splitService(servicePart) {
|
|
|
390
411
|
}
|
|
391
412
|
|
|
392
413
|
// src/tools.ts
|
|
414
|
+
var SERVICE_IDS = Object.keys(DEFAULT_SERVICE_URLS).sort();
|
|
415
|
+
var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
393
416
|
var TOOLS = [
|
|
394
417
|
{
|
|
395
418
|
name: "topolo_whoami",
|
|
@@ -427,6 +450,75 @@ var TOOLS = [
|
|
|
427
450
|
});
|
|
428
451
|
}
|
|
429
452
|
},
|
|
453
|
+
{
|
|
454
|
+
name: "topolo_api_call",
|
|
455
|
+
title: "Call any Topolo platform service",
|
|
456
|
+
description: `Low-level passthrough to any Topolo service. Use when no domain-specific tool exists for the operation you need. The request is signed with the current credential and scoped to the caller's organization \u2014 the target service will return 403 if your scopes do not permit the operation, even though this tool is advertised. Mutating calls (non-GET methods) require confirm:true. Known services: ${SERVICE_IDS.join(", ")}.`,
|
|
457
|
+
requiredScopes: [],
|
|
458
|
+
destructive: true,
|
|
459
|
+
inputSchema: {
|
|
460
|
+
type: "object",
|
|
461
|
+
properties: {
|
|
462
|
+
service: {
|
|
463
|
+
type: "string",
|
|
464
|
+
enum: SERVICE_IDS,
|
|
465
|
+
description: "Target service ID from the platform registry."
|
|
466
|
+
},
|
|
467
|
+
method: {
|
|
468
|
+
type: "string",
|
|
469
|
+
enum: HTTP_METHODS,
|
|
470
|
+
default: "GET",
|
|
471
|
+
description: "HTTP method. Defaults to GET."
|
|
472
|
+
},
|
|
473
|
+
path: {
|
|
474
|
+
type: "string",
|
|
475
|
+
minLength: 1,
|
|
476
|
+
description: 'Request path including any leading slash, e.g. "/api/contacts".'
|
|
477
|
+
},
|
|
478
|
+
body: {
|
|
479
|
+
description: "JSON request body. Ignored for GET."
|
|
480
|
+
},
|
|
481
|
+
query: {
|
|
482
|
+
type: "object",
|
|
483
|
+
additionalProperties: { type: "string" },
|
|
484
|
+
description: "Query string parameters as string values."
|
|
485
|
+
},
|
|
486
|
+
confirm: {
|
|
487
|
+
type: "boolean",
|
|
488
|
+
description: "Required for non-GET methods. Explicit human-in-the-loop acknowledgement for writes."
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
required: ["service", "path"],
|
|
492
|
+
additionalProperties: false
|
|
493
|
+
},
|
|
494
|
+
handler: async (topolo, args) => {
|
|
495
|
+
const service = args["service"];
|
|
496
|
+
const path = args["path"];
|
|
497
|
+
if (typeof service !== "string" || !SERVICE_IDS.includes(service)) {
|
|
498
|
+
throw new Error(`Unknown service "${String(service)}". Known: ${SERVICE_IDS.join(", ")}`);
|
|
499
|
+
}
|
|
500
|
+
if (typeof path !== "string" || !path) {
|
|
501
|
+
throw new Error("path is required");
|
|
502
|
+
}
|
|
503
|
+
const methodRaw = args["method"] ?? "GET";
|
|
504
|
+
if (typeof methodRaw !== "string" || !HTTP_METHODS.includes(methodRaw)) {
|
|
505
|
+
throw new Error(`Unknown HTTP method "${String(methodRaw)}"`);
|
|
506
|
+
}
|
|
507
|
+
const method = methodRaw;
|
|
508
|
+
const query = args["query"];
|
|
509
|
+
const normalisedQuery = query && typeof query === "object" && !Array.isArray(query) ? Object.fromEntries(
|
|
510
|
+
Object.entries(query).map(([k, v]) => [k, String(v)])
|
|
511
|
+
) : void 0;
|
|
512
|
+
return topolo.client.request({
|
|
513
|
+
service,
|
|
514
|
+
method,
|
|
515
|
+
path,
|
|
516
|
+
body: args["body"],
|
|
517
|
+
...normalisedQuery ? { query: normalisedQuery } : {},
|
|
518
|
+
confirm: Boolean(args["confirm"])
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
},
|
|
430
522
|
{
|
|
431
523
|
name: "topolo_crm_get_contact",
|
|
432
524
|
title: "Fetch a single CRM contact",
|
package/package.json
CHANGED