@tinycloud/mcp 0.10.0-beta.4 → 0.10.0-beta.40
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/index.cjs
CHANGED
|
@@ -206,8 +206,7 @@ var TOOL_NAMES = [
|
|
|
206
206
|
"tinycloud_apps_context",
|
|
207
207
|
"tinycloud_apps_read",
|
|
208
208
|
"tinycloud_apps_write",
|
|
209
|
-
"tinycloud_apps_query"
|
|
210
|
-
"tinycloud_apps_move"
|
|
209
|
+
"tinycloud_apps_query"
|
|
211
210
|
];
|
|
212
211
|
function invocationTargetForMcp(selection) {
|
|
213
212
|
return {
|
|
@@ -431,7 +430,7 @@ var TOOL_BINDINGS = [
|
|
|
431
430
|
operationVersion: 1,
|
|
432
431
|
readOnlyHint: false,
|
|
433
432
|
idempotentHint: true,
|
|
434
|
-
destructiveHint:
|
|
433
|
+
destructiveHint: false,
|
|
435
434
|
openWorldHint: false,
|
|
436
435
|
surfaces: ["hosted", "public"]
|
|
437
436
|
},
|
|
@@ -461,19 +460,9 @@ var TOOL_BINDINGS = [
|
|
|
461
460
|
operationVersion: 1,
|
|
462
461
|
readOnlyHint: false,
|
|
463
462
|
idempotentHint: true,
|
|
464
|
-
destructiveHint: true,
|
|
465
|
-
openWorldHint: false,
|
|
466
|
-
surfaces: ["hosted", "public"]
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
name: "tinycloud_apps_move",
|
|
470
|
-
operationId: "tinycloud.apps.move",
|
|
471
|
-
operationVersion: 1,
|
|
472
|
-
readOnlyHint: false,
|
|
473
|
-
idempotentHint: true,
|
|
474
463
|
destructiveHint: false,
|
|
475
464
|
openWorldHint: false,
|
|
476
|
-
surfaces: ["hosted"]
|
|
465
|
+
surfaces: ["hosted", "public"]
|
|
477
466
|
}
|
|
478
467
|
];
|
|
479
468
|
var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
@@ -566,7 +555,7 @@ function outcomeCode(result) {
|
|
|
566
555
|
// package.json
|
|
567
556
|
var package_default = {
|
|
568
557
|
name: "@tinycloud/mcp",
|
|
569
|
-
version: "0.10.0-beta.
|
|
558
|
+
version: "0.10.0-beta.40",
|
|
570
559
|
description: "TinyCloud delegated operations MCP server",
|
|
571
560
|
keywords: [
|
|
572
561
|
"tinycloud",
|
|
@@ -637,9 +626,10 @@ var package_default = {
|
|
|
637
626
|
dependencies: {
|
|
638
627
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
639
628
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
640
|
-
"@tinycloud/node-sdk": "3.12.0-beta.
|
|
641
|
-
"@tinycloud/
|
|
642
|
-
"@tinycloud/
|
|
629
|
+
"@tinycloud/node-sdk": "3.12.0-beta.33",
|
|
630
|
+
"@tinycloud/sdk-core": "3.12.0-beta.33",
|
|
631
|
+
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
632
|
+
"@tinycloud/operations": "0.9.0-beta.36",
|
|
643
633
|
jose: "6.2.4"
|
|
644
634
|
},
|
|
645
635
|
devDependencies: {
|
|
@@ -1017,6 +1007,7 @@ function claims(token) {
|
|
|
1017
1007
|
}
|
|
1018
1008
|
|
|
1019
1009
|
// src/remote-store.ts
|
|
1010
|
+
var import_sdk_core = require("@tinycloud/sdk-core");
|
|
1020
1011
|
var import_node_crypto3 = require("crypto");
|
|
1021
1012
|
var import_promises = require("fs/promises");
|
|
1022
1013
|
var import_node_path3 = require("path");
|
|
@@ -1096,7 +1087,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
1096
1087
|
"DELEGATION_HOST_MISMATCH",
|
|
1097
1088
|
"DELEGATION_REJECTED"
|
|
1098
1089
|
]);
|
|
1099
|
-
var
|
|
1090
|
+
var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
|
|
1100
1091
|
var BOOTSTRAP_PERMISSIONS = [
|
|
1101
1092
|
{
|
|
1102
1093
|
service: "tinycloud.kv",
|
|
@@ -1519,14 +1510,16 @@ var RemoteTenantStore = class {
|
|
|
1519
1510
|
did: tenant.sessionDid,
|
|
1520
1511
|
callback: callback.toString(),
|
|
1521
1512
|
host: this.#config.nodeHost,
|
|
1522
|
-
|
|
1513
|
+
requesterOrigin: this.#config.publicUrl.origin,
|
|
1514
|
+
jwk: Buffer.from(JSON.stringify((0, import_node_sdk2.publicJwk)(tenant.jwk))).toString("base64url"),
|
|
1523
1515
|
permissions: Buffer.from(JSON.stringify({
|
|
1524
1516
|
permissions: pending.permissions,
|
|
1525
1517
|
reason: [
|
|
1526
1518
|
pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0, import_tc_apps.tcAppsApprovalReason)(pending.permissions) ?? "Approve the exact capabilities requested by the TinyCloud MCP operation.",
|
|
1527
1519
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
1528
|
-
// client that created this link, never from the link itself.
|
|
1529
|
-
|
|
1520
|
+
// client that created this link, never from the link itself. The
|
|
1521
|
+
// callback refuses a signer outside them, so the approver isn't asked to check.
|
|
1522
|
+
...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
|
|
1530
1523
|
].join(" ")
|
|
1531
1524
|
})).toString("base64url"),
|
|
1532
1525
|
expiry: this.#config.delegationExpiry
|
|
@@ -1825,10 +1818,10 @@ var RemoteTenantStore = class {
|
|
|
1825
1818
|
authMethod: "openkey",
|
|
1826
1819
|
openkeyHost: this.#config.openkeyHost
|
|
1827
1820
|
});
|
|
1828
|
-
} else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "")
|
|
1821
|
+
} 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(/\/+$/, "")) {
|
|
1829
1822
|
await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
|
|
1830
1823
|
process.stderr.write(
|
|
1831
|
-
`[tinycloud-mcp-http] tenant node host migrated: from=${
|
|
1824
|
+
`[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
|
|
1832
1825
|
`
|
|
1833
1826
|
);
|
|
1834
1827
|
}
|
|
@@ -2134,11 +2127,6 @@ function sessionFromCallback(data, privateJwk) {
|
|
|
2134
2127
|
signature: data.signature
|
|
2135
2128
|
};
|
|
2136
2129
|
}
|
|
2137
|
-
function publicJwk(jwk) {
|
|
2138
|
-
const copy = { ...jwk };
|
|
2139
|
-
for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
|
|
2140
|
-
return copy;
|
|
2141
|
-
}
|
|
2142
2130
|
function samePrincipal(left, right) {
|
|
2143
2131
|
if (typeof left !== "string") return false;
|
|
2144
2132
|
try {
|
|
@@ -2151,6 +2139,7 @@ function normalizeDid(value) {
|
|
|
2151
2139
|
return value.split("#", 1)[0];
|
|
2152
2140
|
}
|
|
2153
2141
|
function sameNodeHost(left, right) {
|
|
2142
|
+
if (PRODUCTION_NODE_HOSTS.has(left) && (0, import_sdk_core.sameTinyCloudNode)(left, right)) return true;
|
|
2154
2143
|
try {
|
|
2155
2144
|
const normalize = (value) => {
|
|
2156
2145
|
const url = new URL(value);
|
|
@@ -2245,6 +2234,7 @@ function samePendingRequest(pending, expected) {
|
|
|
2245
2234
|
// src/http.ts
|
|
2246
2235
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2247
2236
|
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2237
|
+
var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
|
|
2248
2238
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2249
2239
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2250
2240
|
function createHostedMcpApp(config) {
|
|
@@ -2542,10 +2532,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2542
2532
|
try {
|
|
2543
2533
|
const destination = await store.approvalRedirect(requiredState(url));
|
|
2544
2534
|
return Response.redirect(destination, 302);
|
|
2545
|
-
} catch {
|
|
2535
|
+
} catch (error) {
|
|
2536
|
+
const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
|
|
2537
|
+
writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
|
|
2546
2538
|
if (request.headers.get("accept")?.includes("text/html")) {
|
|
2547
2539
|
return new Response(
|
|
2548
|
-
'<!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.
|
|
2540
|
+
'<!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>',
|
|
2549
2541
|
{
|
|
2550
2542
|
status: 400,
|
|
2551
2543
|
headers: {
|
|
@@ -2756,7 +2748,7 @@ function mcpCors(response, request) {
|
|
|
2756
2748
|
if (request.headers.has("origin")) {
|
|
2757
2749
|
headers.set("access-control-allow-origin", "*");
|
|
2758
2750
|
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2759
|
-
headers.set("access-control-expose-headers",
|
|
2751
|
+
headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
|
|
2760
2752
|
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2761
2753
|
}
|
|
2762
2754
|
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|