@topolo/mcp 0.13.0 → 0.13.2
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 +81 -30
- package/package.json +3 -3
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/.pnpm/@topolo+sdk@0.21.
|
|
6
|
+
// node_modules/.pnpm/@topolo+sdk@0.21.2/node_modules/@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);
|
|
@@ -3254,7 +3254,7 @@ function createTopolo(options) {
|
|
|
3254
3254
|
};
|
|
3255
3255
|
}
|
|
3256
3256
|
|
|
3257
|
-
// node_modules/.pnpm/@topolo+sdk@0.21.
|
|
3257
|
+
// node_modules/.pnpm/@topolo+sdk@0.21.2/node_modules/@topolo/sdk/dist/node/credential-store.js
|
|
3258
3258
|
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
|
|
3259
3259
|
import { existsSync as existsSync2 } from "fs";
|
|
3260
3260
|
import { homedir as homedir2, platform } from "os";
|
|
@@ -3671,6 +3671,24 @@ function topoloServiceOrigins2(serviceUrls, environment) {
|
|
|
3671
3671
|
);
|
|
3672
3672
|
}
|
|
3673
3673
|
var KEYCHAIN_SERVICE = "topolo-external-agent-installation";
|
|
3674
|
+
var MACOS_KEYCHAIN_CHUNK_SIZE = 96;
|
|
3675
|
+
var MACOS_KEYCHAIN_CHUNK_PREFIX = "topolo-keychain-chunks:v1:";
|
|
3676
|
+
var MACOS_KEYCHAIN_WRITE_SCRIPT = [
|
|
3677
|
+
"log_user 0",
|
|
3678
|
+
"set timeout 10",
|
|
3679
|
+
"set secret [gets stdin]",
|
|
3680
|
+
"spawn -noecho /usr/bin/security add-generic-password -U -a $env(TOPOLO_KEYCHAIN_ACCOUNT) -s $env(TOPOLO_KEYCHAIN_SERVICE) -w",
|
|
3681
|
+
"for {set prompt 0} {$prompt < 2} {incr prompt} {",
|
|
3682
|
+
" expect {",
|
|
3683
|
+
' -re {(?i)password} { send -- "$secret\\r" }',
|
|
3684
|
+
" timeout { exit 70 }",
|
|
3685
|
+
" eof { exit 71 }",
|
|
3686
|
+
" }",
|
|
3687
|
+
"}",
|
|
3688
|
+
"expect eof",
|
|
3689
|
+
"set result [wait]",
|
|
3690
|
+
"exit [lindex $result 3]"
|
|
3691
|
+
].join("\n");
|
|
3674
3692
|
function installationStorePath() {
|
|
3675
3693
|
const override = process.env.TOPOLO_INSTALLATIONS_PATH?.trim();
|
|
3676
3694
|
if (override) return override;
|
|
@@ -3695,40 +3713,73 @@ function createPlatformInstallationSecretBackend(options = {}) {
|
|
|
3695
3713
|
const spawn = options.spawn ?? ((command, args, spawnOptions) => spawnSync(command, args, spawnOptions));
|
|
3696
3714
|
const root = options.root ?? installationStorePath();
|
|
3697
3715
|
if (platform2 === "darwin") {
|
|
3716
|
+
const write = (account, value) => runOrThrow(spawn("/usr/bin/expect", ["-c", MACOS_KEYCHAIN_WRITE_SCRIPT], {
|
|
3717
|
+
input: `${value}
|
|
3718
|
+
`,
|
|
3719
|
+
encoding: "utf8",
|
|
3720
|
+
env: {
|
|
3721
|
+
...process.env,
|
|
3722
|
+
TOPOLO_KEYCHAIN_ACCOUNT: account,
|
|
3723
|
+
TOPOLO_KEYCHAIN_SERVICE: KEYCHAIN_SERVICE
|
|
3724
|
+
}
|
|
3725
|
+
}), "macOS Keychain write");
|
|
3726
|
+
const read = (account) => {
|
|
3727
|
+
const result = spawn("security", [
|
|
3728
|
+
"find-generic-password",
|
|
3729
|
+
"-a",
|
|
3730
|
+
account,
|
|
3731
|
+
"-s",
|
|
3732
|
+
KEYCHAIN_SERVICE,
|
|
3733
|
+
"-w"
|
|
3734
|
+
], { encoding: "utf8" });
|
|
3735
|
+
if (result.status === 44) return null;
|
|
3736
|
+
return runOrThrow(result, "macOS Keychain read");
|
|
3737
|
+
};
|
|
3738
|
+
const remove = (account) => {
|
|
3739
|
+
const result = spawn("security", [
|
|
3740
|
+
"delete-generic-password",
|
|
3741
|
+
"-a",
|
|
3742
|
+
account,
|
|
3743
|
+
"-s",
|
|
3744
|
+
KEYCHAIN_SERVICE
|
|
3745
|
+
], { encoding: "utf8" });
|
|
3746
|
+
if (result.status !== 44) runOrThrow(result, "macOS Keychain delete");
|
|
3747
|
+
};
|
|
3748
|
+
const chunkAccount = (account, index) => `${account}:chunk:${index}`;
|
|
3749
|
+
const chunkCount = (value) => {
|
|
3750
|
+
if (!value?.startsWith(MACOS_KEYCHAIN_CHUNK_PREFIX)) return 0;
|
|
3751
|
+
const count = Number(value.slice(MACOS_KEYCHAIN_CHUNK_PREFIX.length));
|
|
3752
|
+
if (!Number.isSafeInteger(count) || count < 1) throw new Error("macOS Keychain chunk manifest is invalid.");
|
|
3753
|
+
return count;
|
|
3754
|
+
};
|
|
3698
3755
|
return {
|
|
3699
3756
|
async set(account, value) {
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3757
|
+
const previousCount = chunkCount(read(account));
|
|
3758
|
+
const chunks = Array.from(
|
|
3759
|
+
{ length: Math.max(1, Math.ceil(value.length / MACOS_KEYCHAIN_CHUNK_SIZE)) },
|
|
3760
|
+
(_, index) => value.slice(index * MACOS_KEYCHAIN_CHUNK_SIZE, (index + 1) * MACOS_KEYCHAIN_CHUNK_SIZE)
|
|
3761
|
+
);
|
|
3762
|
+
try {
|
|
3763
|
+
chunks.forEach((chunk, index) => write(chunkAccount(account, index), chunk));
|
|
3764
|
+
write(account, `${MACOS_KEYCHAIN_CHUNK_PREFIX}${chunks.length}`);
|
|
3765
|
+
for (let index = chunks.length; index < previousCount; index += 1) remove(chunkAccount(account, index));
|
|
3766
|
+
} catch (error) {
|
|
3767
|
+
chunks.forEach((_, index) => remove(chunkAccount(account, index)));
|
|
3768
|
+
throw error;
|
|
3769
|
+
}
|
|
3710
3770
|
},
|
|
3711
3771
|
async get(account) {
|
|
3712
|
-
const
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
"-w"
|
|
3719
|
-
], { encoding: "utf8" });
|
|
3720
|
-
if (result.status === 44) return null;
|
|
3721
|
-
return runOrThrow(result, "macOS Keychain read");
|
|
3772
|
+
const manifest = read(account);
|
|
3773
|
+
const count = chunkCount(manifest);
|
|
3774
|
+
if (!count) return manifest;
|
|
3775
|
+
const chunks = Array.from({ length: count }, (_, index) => read(chunkAccount(account, index)));
|
|
3776
|
+
if (chunks.some((chunk) => chunk === null)) throw new Error("macOS Keychain installation secret is incomplete.");
|
|
3777
|
+
return chunks.join("");
|
|
3722
3778
|
},
|
|
3723
3779
|
async delete(account) {
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
account,
|
|
3728
|
-
"-s",
|
|
3729
|
-
KEYCHAIN_SERVICE
|
|
3730
|
-
], { encoding: "utf8" });
|
|
3731
|
-
if (result.status !== 44) runOrThrow(result, "macOS Keychain delete");
|
|
3780
|
+
const count = chunkCount(read(account));
|
|
3781
|
+
for (let index = 0; index < count; index += 1) remove(chunkAccount(account, index));
|
|
3782
|
+
remove(account);
|
|
3732
3783
|
}
|
|
3733
3784
|
};
|
|
3734
3785
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/mcp",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.13.
|
|
5
|
-
"topoloPublishedVersion": "0.13.
|
|
4
|
+
"version": "0.13.2",
|
|
5
|
+
"topoloPublishedVersion": "0.13.2",
|
|
6
6
|
"description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
39
|
-
"@topolo/sdk": "0.21.
|
|
39
|
+
"@topolo/sdk": "0.21.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^20.12.0",
|