@tinycloud/mcp 0.10.0-beta.3 → 0.10.0-beta.30

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 CHANGED
@@ -273,6 +273,7 @@ import {
273
273
  UnsupportedSessionRestoreError,
274
274
  isCapabilitySubset,
275
275
  principalDidEquals,
276
+ publicJwk,
276
277
  siweRuntimeDelegation,
277
278
  signedCompactUcanExpiry
278
279
  } from "@tinycloud/node-sdk";
@@ -780,8 +781,9 @@ var RemoteTenantStore = class {
780
781
  reason: [
781
782
  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
783
  // Owner DIDs come from the verified OpenKey access token of the MCP
783
- // client that created this link, never from the link itself.
784
- ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}; approve only if that is you.`]
784
+ // client that created this link, never from the link itself. The
785
+ // callback refuses a signer outside them, so the approver isn't asked to check.
786
+ ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
785
787
  ].join(" ")
786
788
  })).toString("base64url"),
787
789
  expiry: this.#config.delegationExpiry
@@ -1389,11 +1391,6 @@ function sessionFromCallback(data, privateJwk) {
1389
1391
  signature: data.signature
1390
1392
  };
1391
1393
  }
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
1394
  function samePrincipal(left, right) {
1398
1395
  if (typeof left !== "string") return false;
1399
1396
  try {
@@ -1847,7 +1844,7 @@ var TOOL_BINDINGS = [
1847
1844
  operationVersion: 1,
1848
1845
  readOnlyHint: false,
1849
1846
  idempotentHint: true,
1850
- destructiveHint: true,
1847
+ destructiveHint: false,
1851
1848
  openWorldHint: false,
1852
1849
  surfaces: ["hosted", "public"]
1853
1850
  },
@@ -1877,7 +1874,7 @@ var TOOL_BINDINGS = [
1877
1874
  operationVersion: 1,
1878
1875
  readOnlyHint: false,
1879
1876
  idempotentHint: true,
1880
- destructiveHint: true,
1877
+ destructiveHint: false,
1881
1878
  openWorldHint: false,
1882
1879
  surfaces: ["hosted", "public"]
1883
1880
  }
@@ -1972,7 +1969,7 @@ function outcomeCode(result) {
1972
1969
  // package.json
1973
1970
  var package_default = {
1974
1971
  name: "@tinycloud/mcp",
1975
- version: "0.10.0-beta.3",
1972
+ version: "0.10.0-beta.30",
1976
1973
  description: "TinyCloud delegated operations MCP server",
1977
1974
  keywords: [
1978
1975
  "tinycloud",
@@ -2043,9 +2040,9 @@ var package_default = {
2043
2040
  dependencies: {
2044
2041
  "@modelcontextprotocol/node": "2.0.0-beta.5",
2045
2042
  "@modelcontextprotocol/server": "2.0.0-beta.5",
2046
- "@tinycloud/node-sdk": "3.12.0-beta.2",
2047
- "@tinycloud/node-sdk-wasm": "1.7.8",
2048
- "@tinycloud/operations": "0.9.0-beta.3",
2043
+ "@tinycloud/node-sdk": "3.12.0-beta.22",
2044
+ "@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
2045
+ "@tinycloud/operations": "0.9.0-beta.26",
2049
2046
  jose: "6.2.4"
2050
2047
  },
2051
2048
  devDependencies: {
@@ -2070,6 +2067,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
2070
2067
  // src/http.ts
2071
2068
  var REQUIRED_SCOPE = "tinycloud:mcp";
2072
2069
  var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
2070
+ var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
2073
2071
  var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
2074
2072
  var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
2075
2073
  function createHostedMcpApp(config) {
@@ -2367,10 +2365,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
2367
2365
  try {
2368
2366
  const destination = await store.approvalRedirect(requiredState(url));
2369
2367
  return Response.redirect(destination, 302);
2370
- } catch {
2368
+ } catch (error) {
2369
+ const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
2370
+ writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
2371
2371
  if (request.headers.get("accept")?.includes("text/html")) {
2372
2372
  return new Response(
2373
- '<!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. No new approval was accepted through this link.</p><p>Return to the conversation that requested access. In ChatGPT, select @TinyCloud and ask it to continue your original request. If access is still needed, it can provide a fresh approval link.</p><p>If you declined access, no further approval is required. Never paste passwords, codes or approval links into support messages.</p></main></html>',
2373
+ '<!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>',
2374
2374
  {
2375
2375
  status: 400,
2376
2376
  headers: {
@@ -2581,7 +2581,7 @@ function mcpCors(response, request) {
2581
2581
  if (request.headers.has("origin")) {
2582
2582
  headers.set("access-control-allow-origin", "*");
2583
2583
  headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
2584
- headers.set("access-control-expose-headers", "WWW-Authenticate");
2584
+ headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
2585
2585
  if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
2586
2586
  }
2587
2587
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });