@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-cli.js
CHANGED
|
@@ -277,6 +277,7 @@ function logToolCall(tool, code, startedAt, replayedGrants) {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// src/remote-store.ts
|
|
280
|
+
import { sameTinyCloudNode } from "@tinycloud/sdk-core";
|
|
280
281
|
import { createHmac, randomBytes, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
281
282
|
import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "fs/promises";
|
|
282
283
|
import { dirname, join } from "path";
|
|
@@ -290,6 +291,7 @@ import {
|
|
|
290
291
|
UnsupportedSessionRestoreError,
|
|
291
292
|
isCapabilitySubset,
|
|
292
293
|
principalDidEquals,
|
|
294
|
+
publicJwk,
|
|
293
295
|
siweRuntimeDelegation,
|
|
294
296
|
signedCompactUcanExpiry
|
|
295
297
|
} from "@tinycloud/node-sdk";
|
|
@@ -368,7 +370,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
368
370
|
"DELEGATION_HOST_MISMATCH",
|
|
369
371
|
"DELEGATION_REJECTED"
|
|
370
372
|
]);
|
|
371
|
-
var
|
|
373
|
+
var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
|
|
372
374
|
var BOOTSTRAP_PERMISSIONS = [
|
|
373
375
|
{
|
|
374
376
|
service: "tinycloud.kv",
|
|
@@ -791,14 +793,16 @@ var RemoteTenantStore = class {
|
|
|
791
793
|
did: tenant.sessionDid,
|
|
792
794
|
callback: callback.toString(),
|
|
793
795
|
host: this.#config.nodeHost,
|
|
796
|
+
requesterOrigin: this.#config.publicUrl.origin,
|
|
794
797
|
jwk: Buffer.from(JSON.stringify(publicJwk(tenant.jwk))).toString("base64url"),
|
|
795
798
|
permissions: Buffer.from(JSON.stringify({
|
|
796
799
|
permissions: pending.permissions,
|
|
797
800
|
reason: [
|
|
798
801
|
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.",
|
|
799
802
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
800
|
-
// client that created this link, never from the link itself.
|
|
801
|
-
|
|
803
|
+
// client that created this link, never from the link itself. The
|
|
804
|
+
// callback refuses a signer outside them, so the approver isn't asked to check.
|
|
805
|
+
...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
|
|
802
806
|
].join(" ")
|
|
803
807
|
})).toString("base64url"),
|
|
804
808
|
expiry: this.#config.delegationExpiry
|
|
@@ -1097,10 +1101,10 @@ var RemoteTenantStore = class {
|
|
|
1097
1101
|
authMethod: "openkey",
|
|
1098
1102
|
openkeyHost: this.#config.openkeyHost
|
|
1099
1103
|
});
|
|
1100
|
-
} else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "")
|
|
1104
|
+
} 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(/\/+$/, "")) {
|
|
1101
1105
|
await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
|
|
1102
1106
|
process.stderr.write(
|
|
1103
|
-
`[tinycloud-mcp-http] tenant node host migrated: from=${
|
|
1107
|
+
`[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
|
|
1104
1108
|
`
|
|
1105
1109
|
);
|
|
1106
1110
|
}
|
|
@@ -1406,11 +1410,6 @@ function sessionFromCallback(data, privateJwk) {
|
|
|
1406
1410
|
signature: data.signature
|
|
1407
1411
|
};
|
|
1408
1412
|
}
|
|
1409
|
-
function publicJwk(jwk) {
|
|
1410
|
-
const copy = { ...jwk };
|
|
1411
|
-
for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
|
|
1412
|
-
return copy;
|
|
1413
|
-
}
|
|
1414
1413
|
function samePrincipal(left, right) {
|
|
1415
1414
|
if (typeof left !== "string") return false;
|
|
1416
1415
|
try {
|
|
@@ -1423,6 +1422,7 @@ function normalizeDid(value) {
|
|
|
1423
1422
|
return value.split("#", 1)[0];
|
|
1424
1423
|
}
|
|
1425
1424
|
function sameNodeHost(left, right) {
|
|
1425
|
+
if (PRODUCTION_NODE_HOSTS.has(left) && sameTinyCloudNode(left, right)) return true;
|
|
1426
1426
|
try {
|
|
1427
1427
|
const normalize = (value) => {
|
|
1428
1428
|
const url = new URL(value);
|
|
@@ -1864,7 +1864,7 @@ var TOOL_BINDINGS = [
|
|
|
1864
1864
|
operationVersion: 1,
|
|
1865
1865
|
readOnlyHint: false,
|
|
1866
1866
|
idempotentHint: true,
|
|
1867
|
-
destructiveHint:
|
|
1867
|
+
destructiveHint: false,
|
|
1868
1868
|
openWorldHint: false,
|
|
1869
1869
|
surfaces: ["hosted", "public"]
|
|
1870
1870
|
},
|
|
@@ -1894,19 +1894,9 @@ var TOOL_BINDINGS = [
|
|
|
1894
1894
|
operationVersion: 1,
|
|
1895
1895
|
readOnlyHint: false,
|
|
1896
1896
|
idempotentHint: true,
|
|
1897
|
-
destructiveHint: true,
|
|
1898
|
-
openWorldHint: false,
|
|
1899
|
-
surfaces: ["hosted", "public"]
|
|
1900
|
-
},
|
|
1901
|
-
{
|
|
1902
|
-
name: "tinycloud_apps_move",
|
|
1903
|
-
operationId: "tinycloud.apps.move",
|
|
1904
|
-
operationVersion: 1,
|
|
1905
|
-
readOnlyHint: false,
|
|
1906
|
-
idempotentHint: true,
|
|
1907
1897
|
destructiveHint: false,
|
|
1908
1898
|
openWorldHint: false,
|
|
1909
|
-
surfaces: ["hosted"]
|
|
1899
|
+
surfaces: ["hosted", "public"]
|
|
1910
1900
|
}
|
|
1911
1901
|
];
|
|
1912
1902
|
var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
@@ -1999,7 +1989,7 @@ function outcomeCode(result) {
|
|
|
1999
1989
|
// package.json
|
|
2000
1990
|
var package_default = {
|
|
2001
1991
|
name: "@tinycloud/mcp",
|
|
2002
|
-
version: "0.10.0-beta.
|
|
1992
|
+
version: "0.10.0-beta.41",
|
|
2003
1993
|
description: "TinyCloud delegated operations MCP server",
|
|
2004
1994
|
keywords: [
|
|
2005
1995
|
"tinycloud",
|
|
@@ -2070,9 +2060,10 @@ var package_default = {
|
|
|
2070
2060
|
dependencies: {
|
|
2071
2061
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
2072
2062
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
2073
|
-
"@tinycloud/node-sdk": "3.12.0-beta.
|
|
2074
|
-
"@tinycloud/
|
|
2075
|
-
"@tinycloud/
|
|
2063
|
+
"@tinycloud/node-sdk": "3.12.0-beta.34",
|
|
2064
|
+
"@tinycloud/sdk-core": "3.12.0-beta.34",
|
|
2065
|
+
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
2066
|
+
"@tinycloud/operations": "0.9.0-beta.37",
|
|
2076
2067
|
jose: "6.2.4"
|
|
2077
2068
|
},
|
|
2078
2069
|
devDependencies: {
|
|
@@ -2097,6 +2088,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
|
|
|
2097
2088
|
// src/http.ts
|
|
2098
2089
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2099
2090
|
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2091
|
+
var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
|
|
2100
2092
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2101
2093
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2102
2094
|
function createHostedMcpApp(config) {
|
|
@@ -2394,10 +2386,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2394
2386
|
try {
|
|
2395
2387
|
const destination = await store.approvalRedirect(requiredState(url));
|
|
2396
2388
|
return Response.redirect(destination, 302);
|
|
2397
|
-
} catch {
|
|
2389
|
+
} catch (error) {
|
|
2390
|
+
const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
|
|
2391
|
+
writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
|
|
2398
2392
|
if (request.headers.get("accept")?.includes("text/html")) {
|
|
2399
2393
|
return new Response(
|
|
2400
|
-
'<!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.
|
|
2394
|
+
'<!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>',
|
|
2401
2395
|
{
|
|
2402
2396
|
status: 400,
|
|
2403
2397
|
headers: {
|
|
@@ -2608,7 +2602,7 @@ function mcpCors(response, request) {
|
|
|
2608
2602
|
if (request.headers.has("origin")) {
|
|
2609
2603
|
headers.set("access-control-allow-origin", "*");
|
|
2610
2604
|
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2611
|
-
headers.set("access-control-expose-headers",
|
|
2605
|
+
headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
|
|
2612
2606
|
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2613
2607
|
}
|
|
2614
2608
|
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|