@topolo/mcp 0.4.9 → 0.4.10
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 +11 -5
- package/dist/http.d.ts +63 -0
- package/dist/http.js +16462 -0
- package/dist/index.js +19 -10
- package/package.json +17 -13
package/dist/index.js
CHANGED
|
@@ -2360,8 +2360,9 @@ var TopoloClient = class _TopoloClient {
|
|
|
2360
2360
|
return entries;
|
|
2361
2361
|
}
|
|
2362
2362
|
/**
|
|
2363
|
-
* List callable actions from the live
|
|
2364
|
-
* the
|
|
2363
|
+
* List callable actions from the live registry-canonical catalog (definitions
|
|
2364
|
+
* from the Catalog registry, scoping from Auth). The response is scoped to the
|
|
2365
|
+
* caller's organization and effective permissions; no bundled/static app
|
|
2365
2366
|
* action list is used as an authorization source.
|
|
2366
2367
|
*/
|
|
2367
2368
|
async listActions(options = {}) {
|
|
@@ -2370,7 +2371,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
2370
2371
|
return this.actionCatalogCache.entries;
|
|
2371
2372
|
}
|
|
2372
2373
|
const res = await this.request({
|
|
2373
|
-
service: "
|
|
2374
|
+
service: "developers",
|
|
2374
2375
|
method: "GET",
|
|
2375
2376
|
path: "/api/actions/catalog",
|
|
2376
2377
|
...options.service ? { query: { service: options.service } } : {}
|
|
@@ -2605,6 +2606,7 @@ function normalizeActionCatalogEntry(item) {
|
|
|
2605
2606
|
readOnly: Boolean(a.read_only ?? a.readOnly),
|
|
2606
2607
|
destructive: Boolean(a.destructive),
|
|
2607
2608
|
requiresConfirmation: Boolean(a.requires_confirmation ?? a.requiresConfirmation),
|
|
2609
|
+
agentAccess: pickAgentAccess(a.agent_access ?? a.agentAccess),
|
|
2608
2610
|
status: pickActionString(a.status),
|
|
2609
2611
|
sourceRevision: pickActionString(a.source_revision) ?? pickActionString(a.sourceRevision)
|
|
2610
2612
|
};
|
|
@@ -2615,6 +2617,9 @@ function isHttpMethod(value) {
|
|
|
2615
2617
|
function pickActionString(value) {
|
|
2616
2618
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
2617
2619
|
}
|
|
2620
|
+
function pickAgentAccess(value) {
|
|
2621
|
+
return value === "auto" || value === "confirm" || value === "off" ? value : null;
|
|
2622
|
+
}
|
|
2618
2623
|
function plainObject(value) {
|
|
2619
2624
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2620
2625
|
}
|
|
@@ -2706,7 +2711,6 @@ var CrmModule = class {
|
|
|
2706
2711
|
constructor(client) {
|
|
2707
2712
|
this.client = client;
|
|
2708
2713
|
}
|
|
2709
|
-
client;
|
|
2710
2714
|
async listContacts(options = {}) {
|
|
2711
2715
|
const res = await this.client.request({
|
|
2712
2716
|
service: "crm",
|
|
@@ -2752,7 +2756,6 @@ var IdentityModule = class {
|
|
|
2752
2756
|
constructor(client) {
|
|
2753
2757
|
this.client = client;
|
|
2754
2758
|
}
|
|
2755
|
-
client;
|
|
2756
2759
|
/** Returns the resolved user, organization, and permission set for the
|
|
2757
2760
|
* current credential. Equivalent to `TopoloClient.introspect()` — exposed
|
|
2758
2761
|
* on this module for symmetry with the other domain modules. */
|
|
@@ -3128,14 +3131,20 @@ async function buildTopoloTools(topolo, scopes, tools = TOOLS) {
|
|
|
3128
3131
|
const actionTools = actionsToToolDefs(actions);
|
|
3129
3132
|
return filterToolsByScopes([...baseTools, ...actionTools], scopes);
|
|
3130
3133
|
}
|
|
3134
|
+
function effectiveAgentAccess(a) {
|
|
3135
|
+
if (a.agentAccess) return a.agentAccess;
|
|
3136
|
+
if (a.destructive) return "off";
|
|
3137
|
+
if (a.readOnly && !a.requiresConfirmation) return "auto";
|
|
3138
|
+
return "confirm";
|
|
3139
|
+
}
|
|
3131
3140
|
function actionsToToolDefs(actions) {
|
|
3132
|
-
return actions.map((action) => ({
|
|
3141
|
+
return actions.map((action) => ({ action, access: effectiveAgentAccess(action) })).filter(({ access }) => access !== "off").map(({ action, access }) => ({
|
|
3133
3142
|
name: action.toolName || toolNameForAction(action),
|
|
3134
3143
|
title: action.title,
|
|
3135
3144
|
description: action.description,
|
|
3136
3145
|
requiredScopes: action.requiredPermission ? [action.requiredPermission] : [],
|
|
3137
|
-
destructive:
|
|
3138
|
-
inputSchema: actionInputSchema(action),
|
|
3146
|
+
destructive: access === "confirm",
|
|
3147
|
+
inputSchema: actionInputSchema(action, access),
|
|
3139
3148
|
handler: async (topolo, args) => {
|
|
3140
3149
|
const confirm = Boolean(args["confirm"]);
|
|
3141
3150
|
const input = { ...args };
|
|
@@ -3149,7 +3158,7 @@ function toolNameForAction(action) {
|
|
|
3149
3158
|
const name = action.name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
3150
3159
|
return ["topolo", service, name].filter(Boolean).join("_").slice(0, 96);
|
|
3151
3160
|
}
|
|
3152
|
-
function actionInputSchema(action) {
|
|
3161
|
+
function actionInputSchema(action, access = "auto") {
|
|
3153
3162
|
const schema = {
|
|
3154
3163
|
type: "object",
|
|
3155
3164
|
properties: {},
|
|
@@ -3157,7 +3166,7 @@ function actionInputSchema(action) {
|
|
|
3157
3166
|
...action.inputSchema
|
|
3158
3167
|
};
|
|
3159
3168
|
const properties = schema.properties && typeof schema.properties === "object" && !Array.isArray(schema.properties) ? { ...schema.properties } : {};
|
|
3160
|
-
if (
|
|
3169
|
+
if (access === "confirm") {
|
|
3161
3170
|
properties.confirm = {
|
|
3162
3171
|
type: "boolean",
|
|
3163
3172
|
description: "Required for mutating actions. Explicit human-in-the-loop acknowledgement."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
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": {
|
|
@@ -10,32 +10,36 @@
|
|
|
10
10
|
"./dispatch": {
|
|
11
11
|
"types": "./dist/dispatch.d.ts",
|
|
12
12
|
"import": "./dist/dispatch.js"
|
|
13
|
+
},
|
|
14
|
+
"./http": {
|
|
15
|
+
"types": "./dist/http.d.ts",
|
|
16
|
+
"import": "./dist/http.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
16
20
|
"dist"
|
|
17
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"dev": "tsup --watch",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"start": "node dist/index.js",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"coverage": "vitest run --coverage"
|
|
30
|
+
},
|
|
18
31
|
"dependencies": {
|
|
19
32
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
20
33
|
},
|
|
21
34
|
"devDependencies": {
|
|
35
|
+
"@topolo/sdk": "workspace:*",
|
|
22
36
|
"@types/node": "^20.12.0",
|
|
23
37
|
"@vitest/coverage-v8": "^2.1.0",
|
|
24
38
|
"tsup": "^8.0.0",
|
|
25
39
|
"typescript": "^5.4.0",
|
|
26
|
-
"vitest": "^2.1.0"
|
|
27
|
-
"@topolo/sdk": "0.4.9"
|
|
40
|
+
"vitest": "^2.1.0"
|
|
28
41
|
},
|
|
29
42
|
"engines": {
|
|
30
43
|
"node": ">=20"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsup",
|
|
34
|
-
"dev": "tsup --watch",
|
|
35
|
-
"typecheck": "tsc --noEmit",
|
|
36
|
-
"start": "node dist/index.js",
|
|
37
|
-
"test": "vitest run",
|
|
38
|
-
"test:watch": "vitest",
|
|
39
|
-
"coverage": "vitest run --coverage"
|
|
40
44
|
}
|
|
41
|
-
}
|
|
45
|
+
}
|