@tinycloud/mcp 0.10.0-beta.4 → 0.10.0-beta.41
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/README.md +40 -29
- package/dist/cli.cjs +7 -16
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7 -16
- package/dist/cli.js.map +1 -1
- package/dist/http-cli.cjs +23 -30
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +23 -29
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +23 -30
- package/dist/http.cjs.map +1 -1
- package/dist/http.js +23 -29
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +24 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -31
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +7 -16
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +7 -16
- package/dist/server.js.map +1 -1
- package/dist/tools.cjs +3 -14
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +3 -14
- package/dist/tools.js.map +1 -1
- package/generated/mcp-facts.json +16 -18
- package/package.json +5 -4
- package/skills/tinycloud-delegated-secrets/SKILL.md +4 -3
package/dist/http.js
CHANGED
|
@@ -260,6 +260,7 @@ function logToolCall(tool, code, startedAt, replayedGrants) {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// src/remote-store.ts
|
|
263
|
+
import { sameTinyCloudNode } from "@tinycloud/sdk-core";
|
|
263
264
|
import { createHmac, randomBytes, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
264
265
|
import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "fs/promises";
|
|
265
266
|
import { dirname, join } from "path";
|
|
@@ -273,6 +274,7 @@ import {
|
|
|
273
274
|
UnsupportedSessionRestoreError,
|
|
274
275
|
isCapabilitySubset,
|
|
275
276
|
principalDidEquals,
|
|
277
|
+
publicJwk,
|
|
276
278
|
siweRuntimeDelegation,
|
|
277
279
|
signedCompactUcanExpiry
|
|
278
280
|
} from "@tinycloud/node-sdk";
|
|
@@ -351,7 +353,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
351
353
|
"DELEGATION_HOST_MISMATCH",
|
|
352
354
|
"DELEGATION_REJECTED"
|
|
353
355
|
]);
|
|
354
|
-
var
|
|
356
|
+
var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
|
|
355
357
|
var BOOTSTRAP_PERMISSIONS = [
|
|
356
358
|
{
|
|
357
359
|
service: "tinycloud.kv",
|
|
@@ -774,14 +776,16 @@ var RemoteTenantStore = class {
|
|
|
774
776
|
did: tenant.sessionDid,
|
|
775
777
|
callback: callback.toString(),
|
|
776
778
|
host: this.#config.nodeHost,
|
|
779
|
+
requesterOrigin: this.#config.publicUrl.origin,
|
|
777
780
|
jwk: Buffer.from(JSON.stringify(publicJwk(tenant.jwk))).toString("base64url"),
|
|
778
781
|
permissions: Buffer.from(JSON.stringify({
|
|
779
782
|
permissions: pending.permissions,
|
|
780
783
|
reason: [
|
|
781
784
|
pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : tcAppsApprovalReason(pending.permissions) ?? "Approve the exact capabilities requested by the TinyCloud MCP operation.",
|
|
782
785
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
783
|
-
// client that created this link, never from the link itself.
|
|
784
|
-
|
|
786
|
+
// client that created this link, never from the link itself. The
|
|
787
|
+
// callback refuses a signer outside them, so the approver isn't asked to check.
|
|
788
|
+
...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
|
|
785
789
|
].join(" ")
|
|
786
790
|
})).toString("base64url"),
|
|
787
791
|
expiry: this.#config.delegationExpiry
|
|
@@ -1080,10 +1084,10 @@ var RemoteTenantStore = class {
|
|
|
1080
1084
|
authMethod: "openkey",
|
|
1081
1085
|
openkeyHost: this.#config.openkeyHost
|
|
1082
1086
|
});
|
|
1083
|
-
} else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "")
|
|
1087
|
+
} else if (typeof profile.host === "string" && PRODUCTION_NODE_HOSTS.has(profile.host.replace(/\/+$/, "")) && PRODUCTION_NODE_HOSTS.has(this.#config.nodeHost.replace(/\/+$/, "")) && profile.host.replace(/\/+$/, "") !== this.#config.nodeHost.replace(/\/+$/, "")) {
|
|
1084
1088
|
await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
|
|
1085
1089
|
process.stderr.write(
|
|
1086
|
-
`[tinycloud-mcp-http] tenant node host migrated: from=${
|
|
1090
|
+
`[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
|
|
1087
1091
|
`
|
|
1088
1092
|
);
|
|
1089
1093
|
}
|
|
@@ -1389,11 +1393,6 @@ function sessionFromCallback(data, privateJwk) {
|
|
|
1389
1393
|
signature: data.signature
|
|
1390
1394
|
};
|
|
1391
1395
|
}
|
|
1392
|
-
function publicJwk(jwk) {
|
|
1393
|
-
const copy = { ...jwk };
|
|
1394
|
-
for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
|
|
1395
|
-
return copy;
|
|
1396
|
-
}
|
|
1397
1396
|
function samePrincipal(left, right) {
|
|
1398
1397
|
if (typeof left !== "string") return false;
|
|
1399
1398
|
try {
|
|
@@ -1406,6 +1405,7 @@ function normalizeDid(value) {
|
|
|
1406
1405
|
return value.split("#", 1)[0];
|
|
1407
1406
|
}
|
|
1408
1407
|
function sameNodeHost(left, right) {
|
|
1408
|
+
if (PRODUCTION_NODE_HOSTS.has(left) && sameTinyCloudNode(left, right)) return true;
|
|
1409
1409
|
try {
|
|
1410
1410
|
const normalize = (value) => {
|
|
1411
1411
|
const url = new URL(value);
|
|
@@ -1847,7 +1847,7 @@ var TOOL_BINDINGS = [
|
|
|
1847
1847
|
operationVersion: 1,
|
|
1848
1848
|
readOnlyHint: false,
|
|
1849
1849
|
idempotentHint: true,
|
|
1850
|
-
destructiveHint:
|
|
1850
|
+
destructiveHint: false,
|
|
1851
1851
|
openWorldHint: false,
|
|
1852
1852
|
surfaces: ["hosted", "public"]
|
|
1853
1853
|
},
|
|
@@ -1877,19 +1877,9 @@ var TOOL_BINDINGS = [
|
|
|
1877
1877
|
operationVersion: 1,
|
|
1878
1878
|
readOnlyHint: false,
|
|
1879
1879
|
idempotentHint: true,
|
|
1880
|
-
destructiveHint: true,
|
|
1881
|
-
openWorldHint: false,
|
|
1882
|
-
surfaces: ["hosted", "public"]
|
|
1883
|
-
},
|
|
1884
|
-
{
|
|
1885
|
-
name: "tinycloud_apps_move",
|
|
1886
|
-
operationId: "tinycloud.apps.move",
|
|
1887
|
-
operationVersion: 1,
|
|
1888
|
-
readOnlyHint: false,
|
|
1889
|
-
idempotentHint: true,
|
|
1890
1880
|
destructiveHint: false,
|
|
1891
1881
|
openWorldHint: false,
|
|
1892
|
-
surfaces: ["hosted"]
|
|
1882
|
+
surfaces: ["hosted", "public"]
|
|
1893
1883
|
}
|
|
1894
1884
|
];
|
|
1895
1885
|
var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
@@ -1982,7 +1972,7 @@ function outcomeCode(result) {
|
|
|
1982
1972
|
// package.json
|
|
1983
1973
|
var package_default = {
|
|
1984
1974
|
name: "@tinycloud/mcp",
|
|
1985
|
-
version: "0.10.0-beta.
|
|
1975
|
+
version: "0.10.0-beta.41",
|
|
1986
1976
|
description: "TinyCloud delegated operations MCP server",
|
|
1987
1977
|
keywords: [
|
|
1988
1978
|
"tinycloud",
|
|
@@ -2053,9 +2043,10 @@ var package_default = {
|
|
|
2053
2043
|
dependencies: {
|
|
2054
2044
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
2055
2045
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
2056
|
-
"@tinycloud/node-sdk": "3.12.0-beta.
|
|
2057
|
-
"@tinycloud/
|
|
2058
|
-
"@tinycloud/
|
|
2046
|
+
"@tinycloud/node-sdk": "3.12.0-beta.34",
|
|
2047
|
+
"@tinycloud/sdk-core": "3.12.0-beta.34",
|
|
2048
|
+
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
2049
|
+
"@tinycloud/operations": "0.9.0-beta.37",
|
|
2059
2050
|
jose: "6.2.4"
|
|
2060
2051
|
},
|
|
2061
2052
|
devDependencies: {
|
|
@@ -2080,6 +2071,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
|
|
|
2080
2071
|
// src/http.ts
|
|
2081
2072
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2082
2073
|
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2074
|
+
var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
|
|
2083
2075
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2084
2076
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2085
2077
|
function createHostedMcpApp(config) {
|
|
@@ -2377,10 +2369,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2377
2369
|
try {
|
|
2378
2370
|
const destination = await store.approvalRedirect(requiredState(url));
|
|
2379
2371
|
return Response.redirect(destination, 302);
|
|
2380
|
-
} catch {
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
|
|
2374
|
+
writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
|
|
2381
2375
|
if (request.headers.get("accept")?.includes("text/html")) {
|
|
2382
2376
|
return new Response(
|
|
2383
|
-
'<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>TinyCloud approval unavailable</title><main><h1>This approval link is unavailable</h1><p>It may have expired or already been used.
|
|
2377
|
+
'<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>TinyCloud approval unavailable</title><main><h1>This approval link is unavailable</h1><p>It may have expired or already been used. Go back to the assistant that sent it and ask it to connect TinyCloud again.</p><p>If you declined access, no further approval is required. Never paste passwords, codes or approval links into support messages.</p></main></html>',
|
|
2384
2378
|
{
|
|
2385
2379
|
status: 400,
|
|
2386
2380
|
headers: {
|
|
@@ -2591,7 +2585,7 @@ function mcpCors(response, request) {
|
|
|
2591
2585
|
if (request.headers.has("origin")) {
|
|
2592
2586
|
headers.set("access-control-allow-origin", "*");
|
|
2593
2587
|
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2594
|
-
headers.set("access-control-expose-headers",
|
|
2588
|
+
headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
|
|
2595
2589
|
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2596
2590
|
}
|
|
2597
2591
|
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|