@topolo/mcp 0.11.1 → 0.11.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/http.js +220 -667
- package/dist/index.js +37 -3
- package/package.json +5 -5
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
|
-
//
|
|
6
|
+
// ../../../package-topolo-sdk-0.11.2/packages/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);
|
|
@@ -758,6 +758,18 @@ function prepareTopoloUrlSessionUploadInput(contractValue, byteLength, input, op
|
|
|
758
758
|
function topoloUploadResponseValue(response, path) {
|
|
759
759
|
return path.split(".").reduce((value, segment) => isRecord2(value) ? value[segment] : void 0, response);
|
|
760
760
|
}
|
|
761
|
+
function redactTopoloUrlSessionResult(response, uploadUrlPath) {
|
|
762
|
+
const redacted = cloneUploadValue(response);
|
|
763
|
+
let target = redacted;
|
|
764
|
+
const segments = uploadUrlPath.split(".");
|
|
765
|
+
for (const segment of segments.slice(0, -1)) {
|
|
766
|
+
target = isRecord2(target) ? target[segment] : void 0;
|
|
767
|
+
}
|
|
768
|
+
const finalSegment = segments.at(-1);
|
|
769
|
+
if (finalSegment && isRecord2(target) && finalSegment in target) target[finalSegment] = "[REDACTED]";
|
|
770
|
+
redactUploadHeaders(redacted);
|
|
771
|
+
return redacted;
|
|
772
|
+
}
|
|
761
773
|
function decodeTopoloActionBase64(contentBase64) {
|
|
762
774
|
if (!isCanonicalBase64(contentBase64)) {
|
|
763
775
|
throw new TopoloSdkError("invalid_upload_content", "Upload content must be canonical base64.");
|
|
@@ -776,6 +788,28 @@ function mapUploadInput(contract, contentBase64, input, options) {
|
|
|
776
788
|
[contract.fileNameField]: fileName
|
|
777
789
|
};
|
|
778
790
|
}
|
|
791
|
+
function cloneUploadValue(value) {
|
|
792
|
+
if (Array.isArray(value)) return value.map(cloneUploadValue);
|
|
793
|
+
if (!isRecord2(value)) return value;
|
|
794
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cloneUploadValue(item)]));
|
|
795
|
+
}
|
|
796
|
+
function redactUploadHeaders(value) {
|
|
797
|
+
if (Array.isArray(value)) {
|
|
798
|
+
value.forEach(redactUploadHeaders);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
if (!isRecord2(value)) return;
|
|
802
|
+
for (const [key, item] of Object.entries(value)) {
|
|
803
|
+
if (key.toLowerCase() === "headers" && isRecord2(item)) {
|
|
804
|
+
for (const header of Object.keys(item)) {
|
|
805
|
+
if (["authorization", "cookie", "set-cookie", "proxy-authorization", "x-api-key"].includes(header.toLowerCase())) {
|
|
806
|
+
item[header] = "[REDACTED]";
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
redactUploadHeaders(item);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
779
813
|
function validateUploadMetadata(contract, byteLength, options) {
|
|
780
814
|
const fileName = options.fileName.trim();
|
|
781
815
|
const contentType = options.contentType.trim().toLowerCase();
|
|
@@ -1417,7 +1451,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1417
1451
|
throw new TopoloSdkError("invalid_upload_response", `Upload action response is missing ${contract.uploadUrlPath}.`);
|
|
1418
1452
|
}
|
|
1419
1453
|
await this.putUrlSessionContent(entry, uploadUrl, contract.uploadMethod, bytes, options);
|
|
1420
|
-
if (!contract.complete) return initiation;
|
|
1454
|
+
if (!contract.complete) return redactTopoloUrlSessionResult(initiation, contract.uploadUrlPath);
|
|
1421
1455
|
const completionValue = topoloUploadResponseValue(initiation, contract.complete.responsePath);
|
|
1422
1456
|
if (typeof completionValue !== "string" || !completionValue.trim()) {
|
|
1423
1457
|
throw new TopoloSdkError("invalid_upload_response", `Upload action response is missing ${contract.complete.responsePath}.`);
|
|
@@ -2169,7 +2203,7 @@ function createTopolo(options) {
|
|
|
2169
2203
|
};
|
|
2170
2204
|
}
|
|
2171
2205
|
|
|
2172
|
-
//
|
|
2206
|
+
// ../../../package-topolo-sdk-0.11.2/packages/topolo-sdk/dist/node/credential-store.js
|
|
2173
2207
|
import { mkdir, readFile, writeFile, chmod, rm, stat } from "fs/promises";
|
|
2174
2208
|
import { existsSync } from "fs";
|
|
2175
2209
|
import { homedir, platform } from "os";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/mcp",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"topoloPublishedVersion": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
|
+
"topoloPublishedVersion": "0.11.2",
|
|
5
5
|
"description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Topolo",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"dev": "tsup --watch",
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
31
|
"start": "node dist/index.js",
|
|
32
|
-
"test": "vitest run",
|
|
32
|
+
"test": "if test \"$TOPOLO_BUILD_READY\" = 1; then vitest run; else python3 ../../tooling/with-resource-lock.py ../topolo-sdk -- sh -c 'pnpm --dir ../topolo-sdk build && exec vitest run'; fi",
|
|
33
33
|
"test:watch": "vitest",
|
|
34
|
-
"coverage": "vitest run --coverage"
|
|
34
|
+
"coverage": "if test \"$TOPOLO_BUILD_READY\" = 1; then vitest run --coverage; else python3 ../../tooling/with-resource-lock.py ../topolo-sdk -- sh -c 'pnpm --dir ../topolo-sdk build && exec vitest run --coverage'; fi"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
38
|
-
"@topolo/sdk": "0.11.
|
|
38
|
+
"@topolo/sdk": "0.11.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^20.12.0",
|