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

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.cjs CHANGED
@@ -775,14 +775,15 @@ var RemoteTenantStore = class {
775
775
  did: tenant.sessionDid,
776
776
  callback: callback.toString(),
777
777
  host: this.#config.nodeHost,
778
- jwk: Buffer.from(JSON.stringify(publicJwk(tenant.jwk))).toString("base64url"),
778
+ jwk: Buffer.from(JSON.stringify((0, import_node_sdk2.publicJwk)(tenant.jwk))).toString("base64url"),
779
779
  permissions: Buffer.from(JSON.stringify({
780
780
  permissions: pending.permissions,
781
781
  reason: [
782
782
  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.",
783
783
  // Owner DIDs come from the verified OpenKey access token of the MCP
784
- // client that created this link, never from the link itself.
785
- ...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(", ")}.`]
786
787
  ].join(" ")
787
788
  })).toString("base64url"),
788
789
  expiry: this.#config.delegationExpiry
@@ -1390,11 +1391,6 @@ function sessionFromCallback(data, privateJwk) {
1390
1391
  signature: data.signature
1391
1392
  };
1392
1393
  }
1393
- function publicJwk(jwk) {
1394
- const copy = { ...jwk };
1395
- for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
1396
- return copy;
1397
- }
1398
1394
  function samePrincipal(left, right) {
1399
1395
  if (typeof left !== "string") return false;
1400
1396
  try {
@@ -1849,7 +1845,7 @@ var TOOL_BINDINGS = [
1849
1845
  operationVersion: 1,
1850
1846
  readOnlyHint: false,
1851
1847
  idempotentHint: true,
1852
- destructiveHint: true,
1848
+ destructiveHint: false,
1853
1849
  openWorldHint: false,
1854
1850
  surfaces: ["hosted", "public"]
1855
1851
  },
@@ -1879,7 +1875,7 @@ var TOOL_BINDINGS = [
1879
1875
  operationVersion: 1,
1880
1876
  readOnlyHint: false,
1881
1877
  idempotentHint: true,
1882
- destructiveHint: true,
1878
+ destructiveHint: false,
1883
1879
  openWorldHint: false,
1884
1880
  surfaces: ["hosted", "public"]
1885
1881
  }
@@ -1974,7 +1970,7 @@ function outcomeCode(result) {
1974
1970
  // package.json
1975
1971
  var package_default = {
1976
1972
  name: "@tinycloud/mcp",
1977
- version: "0.10.0-beta.3",
1973
+ version: "0.10.0-beta.31",
1978
1974
  description: "TinyCloud delegated operations MCP server",
1979
1975
  keywords: [
1980
1976
  "tinycloud",
@@ -2045,9 +2041,9 @@ var package_default = {
2045
2041
  dependencies: {
2046
2042
  "@modelcontextprotocol/node": "2.0.0-beta.5",
2047
2043
  "@modelcontextprotocol/server": "2.0.0-beta.5",
2048
- "@tinycloud/node-sdk": "3.12.0-beta.2",
2049
- "@tinycloud/node-sdk-wasm": "1.7.8",
2050
- "@tinycloud/operations": "0.9.0-beta.3",
2044
+ "@tinycloud/node-sdk": "3.12.0-beta.23",
2045
+ "@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
2046
+ "@tinycloud/operations": "0.9.0-beta.27",
2051
2047
  jose: "6.2.4"
2052
2048
  },
2053
2049
  devDependencies: {
@@ -2072,6 +2068,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
2072
2068
  // src/http.ts
2073
2069
  var REQUIRED_SCOPE = "tinycloud:mcp";
2074
2070
  var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
2071
+ var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
2075
2072
  var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
2076
2073
  var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
2077
2074
  function createHostedMcpApp(config) {
@@ -2369,10 +2366,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
2369
2366
  try {
2370
2367
  const destination = await store.approvalRedirect(requiredState(url));
2371
2368
  return Response.redirect(destination, 302);
2372
- } catch {
2369
+ } catch (error) {
2370
+ const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
2371
+ writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
2373
2372
  if (request.headers.get("accept")?.includes("text/html")) {
2374
2373
  return new Response(
2375
- '<!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>',
2374
+ '<!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>',
2376
2375
  {
2377
2376
  status: 400,
2378
2377
  headers: {
@@ -2583,7 +2582,7 @@ function mcpCors(response, request) {
2583
2582
  if (request.headers.has("origin")) {
2584
2583
  headers.set("access-control-allow-origin", "*");
2585
2584
  headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
2586
- headers.set("access-control-expose-headers", "WWW-Authenticate");
2585
+ headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
2587
2586
  if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
2588
2587
  }
2589
2588
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });