@tinycloud/mcp 0.10.1-beta.5 → 0.11.0-beta.10

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-cli.js CHANGED
@@ -4,7 +4,7 @@ import { isAbsolute, resolve } from "path";
4
4
  import { toNodeHandler } from "@modelcontextprotocol/node";
5
5
 
6
6
  // src/http.ts
7
- import { join as join3 } from "path";
7
+ import { join as join4 } from "path";
8
8
  import {
9
9
  McpServer as McpServer2,
10
10
  createMcpHandler,
@@ -16,6 +16,95 @@ import {
16
16
  } from "@modelcontextprotocol/server";
17
17
  import { RUNTIME_DELEGATION_REJECTIONS } from "@tinycloud/node-sdk";
18
18
 
19
+ // src/agent-discovery.ts
20
+ import { createHash } from "crypto";
21
+ import { readFileSync } from "fs";
22
+ import { dirname, join } from "path";
23
+ import { fileURLToPath } from "url";
24
+ var DOCUMENTATION_URL = "https://docs.tinycloud.xyz/cli/mcp";
25
+ var SKILL_NAME = "tinycloud-delegated-secrets";
26
+ var LOCAL_PACKAGES = [["@tinycloud", "cli"].join("/"), ["@tinycloud", "mcp"].join("/")];
27
+ var WEBMCP_SCRIPT_PATH = "/webmcp.js";
28
+ var WEBMCP_TOOL_NAME = "get_tinycloud_mcp_connection";
29
+ var A2A_AGENT_CARD_URL = "https://tinycloud.xyz/.well-known/agent-card.json";
30
+ var moduleDirectory = typeof __dirname === "string" ? __dirname : dirname(fileURLToPath(import.meta.url));
31
+ var skillPath = join(moduleDirectory, "..", "skills", SKILL_NAME, "SKILL.md");
32
+ function agentDiscoveryRoutes(resourceUrl, issuer, requiredScope) {
33
+ const at = (path) => new URL(path, resourceUrl).toString();
34
+ const serverCardUrl = at("/.well-known/mcp/server-card.json");
35
+ const skillUrlPath = `/.well-known/agent-skills/${SKILL_NAME}/SKILL.md`;
36
+ const skill = readFileSync(skillPath);
37
+ const apiCatalog = JSON.stringify({
38
+ linkset: [{
39
+ anchor: resourceUrl.toString(),
40
+ "service-desc": [{ href: serverCardUrl, type: "application/json" }],
41
+ "service-doc": [{ href: DOCUMENTATION_URL, type: "text/html" }],
42
+ status: [{ href: at("/healthz"), type: "application/json" }]
43
+ }]
44
+ });
45
+ const skillsIndex = JSON.stringify({
46
+ $schema: "https://schemas.agentskills.io/discovery/0.2.0/schema.json",
47
+ skills: [{
48
+ name: SKILL_NAME,
49
+ type: "skill-md",
50
+ description: skillDescription(skill.toString("utf8")),
51
+ url: at(skillUrlPath),
52
+ digest: `sha256:${createHash("sha256").update(skill).digest("hex")}`
53
+ }]
54
+ });
55
+ const connection = {
56
+ endpoint: resourceUrl.toString(),
57
+ transport: "streamable-http",
58
+ authorization: {
59
+ type: "oauth2",
60
+ authorizationServer: issuer,
61
+ protectedResourceMetadata: at(`/.well-known/oauth-protected-resource${resourceUrl.pathname}`),
62
+ scope: requiredScope
63
+ },
64
+ serverCard: serverCardUrl,
65
+ documentation: DOCUMENTATION_URL,
66
+ localAlternative: { packages: LOCAL_PACKAGES, stdioServer: "tinycloud-mcp" }
67
+ };
68
+ const webMcpScript = `(() => {
69
+ const modelContext = (typeof document !== "undefined" && document.modelContext) ||
70
+ (typeof navigator !== "undefined" && navigator.modelContext);
71
+ if (!modelContext || typeof modelContext.registerTool !== "function") return;
72
+ const connection = ${JSON.stringify(connection)};
73
+ modelContext.registerTool({
74
+ name: ${JSON.stringify(WEBMCP_TOOL_NAME)},
75
+ description: "Returns how to connect to TinyCloud MCP: the hosted endpoint, its transport, OAuth discovery, the documentation link and the local stdio option shown on this page.",
76
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
77
+ annotations: { readOnlyHint: true },
78
+ execute() {
79
+ return { content: [{ type: "text", text: JSON.stringify(connection) }], structuredContent: connection };
80
+ },
81
+ });
82
+ })();
83
+ `;
84
+ const cached = (body, contentType) => () => new Response(body, {
85
+ headers: {
86
+ "content-type": contentType,
87
+ "cache-control": "public, max-age=300",
88
+ "x-content-type-options": "nosniff"
89
+ }
90
+ });
91
+ return /* @__PURE__ */ new Map([
92
+ ["/.well-known/api-catalog", cached(apiCatalog, 'application/linkset+json; profile="https://www.rfc-editor.org/info/rfc9727"')],
93
+ ["/.well-known/agent-skills/index.json", cached(skillsIndex, "application/json; charset=utf-8")],
94
+ [skillUrlPath, cached(skill, "text/markdown; charset=utf-8")],
95
+ ["/.well-known/agent-card.json", () => new Response(null, {
96
+ status: 302,
97
+ headers: { location: A2A_AGENT_CARD_URL, "cache-control": "public, max-age=300" }
98
+ })],
99
+ [WEBMCP_SCRIPT_PATH, cached(webMcpScript, "text/javascript; charset=utf-8")]
100
+ ]);
101
+ }
102
+ function skillDescription(skill) {
103
+ const description = /^---\n(?:.*\n)*?description: (.+)\n(?:.*\n)*?---\n/.exec(skill)?.[1];
104
+ if (description === void 0) throw new Error(`${SKILL_NAME}/SKILL.md must declare a frontmatter description.`);
105
+ return description;
106
+ }
107
+
19
108
  // src/oauth.ts
20
109
  import {
21
110
  OAuthError,
@@ -121,7 +210,7 @@ function firstString(...values) {
121
210
  }
122
211
 
123
212
  // src/token-status.ts
124
- import { createHash } from "crypto";
213
+ import { createHash as createHash2 } from "crypto";
125
214
  import { decodeJwt } from "jose";
126
215
  var ACTIVE_CACHE_MS = 3e4;
127
216
  var UNKNOWN_TOLERANCE_MS = 6e4;
@@ -218,7 +307,7 @@ function createTokenStatusChecker(config) {
218
307
  }
219
308
  return {
220
309
  async tokenStatus(token) {
221
- const key = createHash("sha256").update(token).digest("hex");
310
+ const key = createHash2("sha256").update(token).digest("hex");
222
311
  const now = clock();
223
312
  const elapsed = monotonic();
224
313
  const inactiveUntil = inactive.get(key);
@@ -233,7 +322,7 @@ function createTokenStatusChecker(config) {
233
322
  },
234
323
  toleratesUnknown(token) {
235
324
  if (credentialsRefused) return false;
236
- const confirmed = confirmedActive.get(createHash("sha256").update(token).digest("hex"));
325
+ const confirmed = confirmedActive.get(createHash2("sha256").update(token).digest("hex"));
237
326
  if (confirmed === void 0) return false;
238
327
  return confirmed.expiresAt > clock() && monotonic() - confirmed.at < UNKNOWN_TOLERANCE_MS;
239
328
  }
@@ -280,7 +369,7 @@ function logToolCall(tool, code, startedAt, replayedGrants) {
280
369
  import { sameTinyCloudNode } from "@tinycloud/sdk-core";
281
370
  import { createHmac, randomBytes, timingSafeEqual as timingSafeEqual2 } from "crypto";
282
371
  import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "fs/promises";
283
- import { dirname, join } from "path";
372
+ import { dirname as dirname2, join as join2 } from "path";
284
373
  import {
285
374
  activateValidatedRuntimeDelegation,
286
375
  deserializeDelegation,
@@ -445,7 +534,7 @@ var RemoteTenantStore = class {
445
534
  const canonical = canonicalOwnerDid(ownerDid);
446
535
  if (canonical === void 0) throw new NativeGrantValidationError("rejected");
447
536
  const tenant = createHmac("sha256", this.#config.stateSecret).update(`native-tenant:${canonical}`).digest("hex");
448
- return join(this.#config.stateDir, "native-tenants", tenant);
537
+ return join2(this.#config.stateDir, "native-tenants", tenant);
449
538
  }
450
539
  async acceptNativeGrant(serializedDelegation) {
451
540
  if (Buffer.byteLength(serializedDelegation) > MAX_CALLBACK_BYTES) {
@@ -613,7 +702,7 @@ var RemoteTenantStore = class {
613
702
  if (Date.parse(stored.expiresAt) <= Date.now()) throw new NativeGrantValidationError("expired");
614
703
  }
615
704
  tenantStateRoot(subject) {
616
- return join(this.#config.stateDir, "tenants", this.#tenantId(subject));
705
+ return join2(this.#config.stateDir, "tenants", this.#tenantId(subject));
617
706
  }
618
707
  /** Prepare only this authenticated account's profile before its first operation. */
619
708
  async initializeTenant(subject) {
@@ -826,7 +915,7 @@ var RemoteTenantStore = class {
826
915
  }
827
916
  if (!isRecord(data)) throw new ApprovalRequestError("body_invalid", "Callback body is invalid.");
828
917
  const pending = await this.#readPending(state, true);
829
- const stateRoot = join(this.#config.stateDir, "tenants", pending.tenantId);
918
+ const stateRoot = join2(this.#config.stateDir, "tenants", pending.tenantId);
830
919
  const prior = this.#approvalProcessing.get(stateRoot);
831
920
  const processing = (async () => {
832
921
  if (prior) await prior.catch(() => void 0);
@@ -1064,7 +1153,7 @@ var RemoteTenantStore = class {
1064
1153
  approvalEpoch: this.#approvalEpochs.get(tenant.stateRoot)
1065
1154
  });
1066
1155
  await rm(this.#additionalPath(tenant.stateRoot), { force: true });
1067
- await rm(join(tenant.stateRoot, ".tinycloud", "profiles", PROFILE, "auth-requests.json"), { force: true });
1156
+ await rm(join2(tenant.stateRoot, ".tinycloud", "profiles", PROFILE, "auth-requests.json"), { force: true });
1068
1157
  await rm(this.#pendingDirectory(tenant.stateRoot), { recursive: true, force: true });
1069
1158
  await rm(this.#sessionPath(tenant.stateRoot), { force: true });
1070
1159
  })().finally(() => this.#clearing.delete(tenant.stateRoot));
@@ -1072,9 +1161,9 @@ var RemoteTenantStore = class {
1072
1161
  await clearing;
1073
1162
  }
1074
1163
  async #initializeTenant(tenantId) {
1075
- const stateRoot = join(this.#config.stateDir, "tenants", tenantId);
1164
+ const stateRoot = join2(this.#config.stateDir, "tenants", tenantId);
1076
1165
  const keyPath = this.#keyPath(stateRoot);
1077
- await secureDirectory(join(stateRoot, ".tinycloud", "profiles", PROFILE));
1166
+ await secureDirectory(join2(stateRoot, ".tinycloud", "profiles", PROFILE));
1078
1167
  let jwk = await readJson(keyPath);
1079
1168
  let sessionDid;
1080
1169
  if (jwk === null) {
@@ -1114,7 +1203,7 @@ var RemoteTenantStore = class {
1114
1203
  }
1115
1204
  async #readTenant(tenantId) {
1116
1205
  if (!/^[a-f0-9]{64}$/.test(tenantId)) throw new ApprovalRequestError("state_invalid", "Approval state is invalid.");
1117
- const stateRoot = join(this.#config.stateDir, "tenants", tenantId);
1206
+ const stateRoot = join2(this.#config.stateDir, "tenants", tenantId);
1118
1207
  const jwk = await readJson(this.#keyPath(stateRoot));
1119
1208
  if (jwk === null) throw new ApprovalRequestError("tenant_missing", "The TinyCloud delegate no longer exists.");
1120
1209
  const profile = await readJson(this.#profilePath(stateRoot));
@@ -1168,7 +1257,7 @@ var RemoteTenantStore = class {
1168
1257
  if (supplied.length !== expectedBytes.length || !timingSafeEqual2(supplied, expectedBytes)) {
1169
1258
  throw new ApprovalRequestError("state_invalid", "Approval state is invalid.");
1170
1259
  }
1171
- const stateRoot = join(this.#config.stateDir, "tenants", tenantId);
1260
+ const stateRoot = join2(this.#config.stateDir, "tenants", tenantId);
1172
1261
  const path = this.#pendingPath(stateRoot, nonce);
1173
1262
  const claimed = `${path}.processing`;
1174
1263
  if (consume) {
@@ -1207,7 +1296,7 @@ var RemoteTenantStore = class {
1207
1296
  }
1208
1297
  }
1209
1298
  async #restorePending(pending) {
1210
- const stateRoot = join(this.#config.stateDir, "tenants", pending.tenantId);
1299
+ const stateRoot = join2(this.#config.stateDir, "tenants", pending.tenantId);
1211
1300
  const path = this.#pendingPath(stateRoot, pending.nonce);
1212
1301
  await rename(`${path}.processing`, path);
1213
1302
  }
@@ -1242,8 +1331,8 @@ var RemoteTenantStore = class {
1242
1331
  return this.#nativeIdentity;
1243
1332
  }
1244
1333
  async #readOrCreateNativeServiceKey() {
1245
- const path = join(this.#config.stateDir, ".tinycloud", "native-service-key.json");
1246
- await secureDirectory(dirname(path));
1334
+ const path = join2(this.#config.stateDir, ".tinycloud", "native-service-key.json");
1335
+ await secureDirectory(dirname2(path));
1247
1336
  let stored = await readJson(path);
1248
1337
  if (stored === null) {
1249
1338
  const generated = generateSessionKey();
@@ -1331,7 +1420,7 @@ var RemoteTenantStore = class {
1331
1420
  }
1332
1421
  }
1333
1422
  #nativeGrantPath(stateRoot) {
1334
- return join(stateRoot, ".tinycloud", "native-grant.json");
1423
+ return join2(stateRoot, ".tinycloud", "native-grant.json");
1335
1424
  }
1336
1425
  #tenantId(subject) {
1337
1426
  return createHmac("sha256", this.#config.stateSecret).update(`tenant:${subject}`).digest("hex");
@@ -1340,22 +1429,22 @@ var RemoteTenantStore = class {
1340
1429
  return createHmac("sha256", this.#config.stateSecret).update(`approval:${tenantId}:${nonce}`).digest("base64url");
1341
1430
  }
1342
1431
  #profilePath(stateRoot) {
1343
- return join(stateRoot, ".tinycloud", "profiles", PROFILE, "profile.json");
1432
+ return join2(stateRoot, ".tinycloud", "profiles", PROFILE, "profile.json");
1344
1433
  }
1345
1434
  #keyPath(stateRoot) {
1346
- return join(stateRoot, ".tinycloud", "profiles", PROFILE, "key.json");
1435
+ return join2(stateRoot, ".tinycloud", "profiles", PROFILE, "key.json");
1347
1436
  }
1348
1437
  #sessionPath(stateRoot) {
1349
- return join(stateRoot, ".tinycloud", "profiles", PROFILE, "session.json");
1438
+ return join2(stateRoot, ".tinycloud", "profiles", PROFILE, "session.json");
1350
1439
  }
1351
1440
  #additionalPath(stateRoot) {
1352
- return join(stateRoot, ".tinycloud", "profiles", PROFILE, "additional-delegations.json");
1441
+ return join2(stateRoot, ".tinycloud", "profiles", PROFILE, "additional-delegations.json");
1353
1442
  }
1354
1443
  #pendingPath(stateRoot, nonce) {
1355
- return join(this.#pendingDirectory(stateRoot), `${nonce}.json`);
1444
+ return join2(this.#pendingDirectory(stateRoot), `${nonce}.json`);
1356
1445
  }
1357
1446
  #pendingDirectory(stateRoot) {
1358
- return join(stateRoot, ".tinycloud", "profiles", PROFILE, "pending");
1447
+ return join2(stateRoot, ".tinycloud", "profiles", PROFILE, "pending");
1359
1448
  }
1360
1449
  };
1361
1450
  var wasmInitialized = false;
@@ -1448,7 +1537,7 @@ async function secureDirectory(path) {
1448
1537
  await chmod(path, 448);
1449
1538
  }
1450
1539
  async function secureWrite(path, value) {
1451
- const directory = dirname(path);
1540
+ const directory = dirname2(path);
1452
1541
  await secureDirectory(directory);
1453
1542
  const temporary = `${path}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
1454
1543
  await writeFile(temporary, `${JSON.stringify(value, jsonReplacer, 2)}
@@ -1480,7 +1569,7 @@ async function restoreOptionalText(path, contents) {
1480
1569
  await rm(path, { force: true });
1481
1570
  return;
1482
1571
  }
1483
- await secureDirectory(dirname(path));
1572
+ await secureDirectory(dirname2(path));
1484
1573
  await writeFile(path, contents, { mode: 384 });
1485
1574
  await chmod(path, 384);
1486
1575
  }
@@ -1495,7 +1584,7 @@ async function reusablePending(directory, expected) {
1495
1584
  const active = [];
1496
1585
  for (const name of names) {
1497
1586
  if (!name.endsWith(".json")) continue;
1498
- const path = join(directory, name);
1587
+ const path = join2(directory, name);
1499
1588
  const pending = await readJson(path).catch(() => null);
1500
1589
  if (pending === null || new Date(pending.expiresAt).getTime() <= Date.now()) {
1501
1590
  await rm(path, { force: true });
@@ -1506,7 +1595,7 @@ async function reusablePending(directory, expected) {
1506
1595
  }
1507
1596
  if (active.length >= 64) {
1508
1597
  active.sort((left, right) => Date.parse(left.createdAt) - Date.parse(right.createdAt));
1509
- await rm(join(directory, `${active[0].nonce}.json`), { force: true });
1598
+ await rm(join2(directory, `${active[0].nonce}.json`), { force: true });
1510
1599
  }
1511
1600
  return void 0;
1512
1601
  }
@@ -1520,7 +1609,7 @@ import { serveStdio } from "@modelcontextprotocol/server/stdio";
1520
1609
 
1521
1610
  // src/tools.ts
1522
1611
  import { createRequire } from "module";
1523
- import { join as join2 } from "path";
1612
+ import { join as join3 } from "path";
1524
1613
  import { fromJsonSchema } from "@modelcontextprotocol/server";
1525
1614
  import { AjvJsonSchemaValidator } from "@modelcontextprotocol/server/validators/ajv";
1526
1615
  import { invokeOperation as invokeOperation2 } from "@tinycloud/operations";
@@ -1651,7 +1740,7 @@ function invocationTargetForMcp(selection) {
1651
1740
  };
1652
1741
  }
1653
1742
  var packageRequire = createRequire(
1654
- typeof __dirname === "string" ? join2(__dirname, "tools.cjs") : import.meta.url
1743
+ typeof __dirname === "string" ? join3(__dirname, "tools.cjs") : import.meta.url
1655
1744
  );
1656
1745
  var generatedCatalog = packageRequire(
1657
1746
  "@tinycloud/operations/operations.json"
@@ -2026,7 +2115,7 @@ function outcomeCode(result) {
2026
2115
  // package.json
2027
2116
  var package_default = {
2028
2117
  name: "@tinycloud/mcp",
2029
- version: "0.10.1-beta.5",
2118
+ version: "0.11.0-beta.10",
2030
2119
  description: "TinyCloud delegated operations MCP server",
2031
2120
  keywords: [
2032
2121
  "tinycloud",
@@ -2097,10 +2186,10 @@ var package_default = {
2097
2186
  dependencies: {
2098
2187
  "@modelcontextprotocol/node": "2.0.0-beta.5",
2099
2188
  "@modelcontextprotocol/server": "2.0.0-beta.5",
2100
- "@tinycloud/node-sdk": "3.13.0-beta.4",
2101
- "@tinycloud/sdk-core": "3.13.0-beta.4",
2189
+ "@tinycloud/node-sdk": "3.13.0-beta.9",
2190
+ "@tinycloud/sdk-core": "3.13.0-beta.9",
2102
2191
  "@tinycloud/node-sdk-wasm": "1.7.9",
2103
- "@tinycloud/operations": "0.9.1-beta.5",
2192
+ "@tinycloud/operations": "0.9.1-beta.10",
2104
2193
  jose: "6.2.4"
2105
2194
  },
2106
2195
  devDependencies: {
@@ -2145,7 +2234,7 @@ function createHostedMcpApp(config) {
2145
2234
  const restricted = createHostedSurface({
2146
2235
  ...config,
2147
2236
  nativeServiceCredential: void 0,
2148
- stateDir: join3(config.stateDir, prefix),
2237
+ stateDir: join4(config.stateDir, prefix),
2149
2238
  approvalPath: connectUrl.pathname
2150
2239
  }, restrictedUrl, "public", statusFor(restrictedUrl), ANNOTATION_TITLE_PREFIXES.has(prefix));
2151
2240
  surfaces.push(restricted);
@@ -2227,6 +2316,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus, annotati
2227
2316
  scopesSupported: [REQUIRED_SCOPE],
2228
2317
  resourceName: surface === "public" ? "TinyCloud personal records" : "TinyCloud hosted MCP"
2229
2318
  };
2319
+ const discoveryRoutes = surface === "hosted" ? agentDiscoveryRoutes(resourceUrl, issuer, REQUIRED_SCOPE) : /* @__PURE__ */ new Map();
2230
2320
  const allowedHosts = [resourceUrl.hostname];
2231
2321
  return {
2232
2322
  async fetch(request) {
@@ -2333,9 +2423,22 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus, annotati
2333
2423
  ].join("\n") + "\n";
2334
2424
  return publicMetadataCors(publicText(authDoc, "text/markdown; charset=utf-8"), request);
2335
2425
  }
2426
+ const discoveryRoute = discoveryRoutes.get(url.pathname);
2427
+ if (discoveryRoute !== void 0) {
2428
+ if (request.method === "OPTIONS") {
2429
+ return publicMetadataCors(new Response(null, { status: 204 }), request);
2430
+ }
2431
+ if (request.method !== "GET" && request.method !== "HEAD") return methodNotAllowed("GET, HEAD");
2432
+ const response = discoveryRoute();
2433
+ return publicMetadataCors(
2434
+ request.method === "HEAD" ? new Response(null, { status: response.status, headers: response.headers }) : response,
2435
+ request
2436
+ );
2437
+ }
2336
2438
  if (url.pathname === "/robots.txt" && surface === "hosted") {
2337
2439
  return request.method === "GET" ? publicText(`User-agent: *
2338
2440
  Allow: /
2441
+ Content-Signal: search=yes, ai-input=yes, ai-train=no
2339
2442
  Sitemap: ${new URL("/sitemap.xml", resourceUrl)}
2340
2443
  Agentmap: ${new URL("/.well-known/ai-catalog.json", resourceUrl)}
2341
2444
  `, "text/plain; charset=utf-8") : methodNotAllowed("GET");
@@ -2412,17 +2515,17 @@ Hosted endpoint: <https://mcp.tinycloud.xyz/mcp> (Streamable HTTP, OpenKey OAuth
2412
2515
  [Connection documentation](https://docs.tinycloud.xyz/cli/mcp).
2413
2516
 
2414
2517
  Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\` and connect the \`tinycloud-mcp\` stdio server.
2415
- ` : `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="ai-catalog" href="/.well-known/ai-catalog.json"><title>TinyCloud MCP</title></head><main><h1>TinyCloud MCP</h1><p>Hosted MCP endpoint: <code>https://mcp.tinycloud.xyz/mcp</code> (Streamable HTTP, OpenKey OAuth).</p><p><a href="https://docs.tinycloud.xyz/cli/mcp">Connection documentation</a></p><p>Local alternative: install <code>${LOCAL_CLI_PACKAGE}</code> and <code>${LOCAL_MCP_PACKAGE}</code> and connect the <code>tinycloud-mcp</code> stdio server.</p></main></html>`;
2518
+ ` : `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="ai-catalog" href="/.well-known/ai-catalog.json"><script src="${WEBMCP_SCRIPT_PATH}" defer></script><title>TinyCloud MCP</title></head><main><h1>TinyCloud MCP</h1><p>Hosted MCP endpoint: <code>https://mcp.tinycloud.xyz/mcp</code> (Streamable HTTP, OpenKey OAuth).</p><p><a href="https://docs.tinycloud.xyz/cli/mcp">Connection documentation</a></p><p>Local alternative: install <code>${LOCAL_CLI_PACKAGE}</code> and <code>${LOCAL_MCP_PACKAGE}</code> and connect the <code>tinycloud-mcp</code> stdio server.</p></main></html>`;
2416
2519
  const headers = new Headers({
2417
2520
  "content-type": markdown ? "text/markdown; charset=utf-8" : "text/html; charset=utf-8",
2418
2521
  "cache-control": "public, max-age=300",
2419
- "content-security-policy": "default-src 'none'; base-uri 'none'; frame-ancestors 'none'",
2522
+ "content-security-policy": "default-src 'none'; script-src 'self'; base-uri 'none'; frame-ancestors 'none'",
2420
2523
  "x-content-type-options": "nosniff",
2421
2524
  vary: "Accept"
2422
2525
  });
2423
2526
  headers.set(
2424
2527
  "link",
2425
- `<${new URL("/mcp/server-card", resourceUrl)}>; rel="describedby"; type="application/json", <https://docs.tinycloud.xyz/cli/mcp>; rel="service-doc"`
2528
+ `<${new URL("/mcp/server-card", resourceUrl)}>; rel="describedby"; type="application/json", <https://docs.tinycloud.xyz/cli/mcp>; rel="service-doc", <${new URL("/.well-known/api-catalog", resourceUrl)}>; rel="api-catalog"`
2426
2529
  );
2427
2530
  return new Response(request.method === "HEAD" ? null : content, { headers });
2428
2531
  }
@@ -2764,7 +2867,7 @@ async function main() {
2764
2867
  publicUrl,
2765
2868
  stateDir,
2766
2869
  stateSecret,
2767
- nodeHost: process.env.TC_HOST ?? "https://tee.node.tinycloud.xyz",
2870
+ nodeHost: process.env.TC_HOST ?? "https://node.tinycloud.xyz",
2768
2871
  openkeyHost,
2769
2872
  approvalTtlSeconds: positiveInteger(process.env.TC_MCP_APPROVAL_TTL_SECONDS, 300),
2770
2873
  delegationExpiry: process.env.TC_MCP_DELEGATION_EXPIRY ?? "1h",