@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-cli.js CHANGED
@@ -290,6 +290,7 @@ import {
290
290
  UnsupportedSessionRestoreError,
291
291
  isCapabilitySubset,
292
292
  principalDidEquals,
293
+ publicJwk,
293
294
  siweRuntimeDelegation,
294
295
  signedCompactUcanExpiry
295
296
  } from "@tinycloud/node-sdk";
@@ -797,8 +798,9 @@ var RemoteTenantStore = class {
797
798
  reason: [
798
799
  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
800
  // Owner DIDs come from the verified OpenKey access token of the MCP
800
- // client that created this link, never from the link itself.
801
- ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}; approve only if that is you.`]
801
+ // client that created this link, never from the link itself. The
802
+ // callback refuses a signer outside them, so the approver isn't asked to check.
803
+ ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
802
804
  ].join(" ")
803
805
  })).toString("base64url"),
804
806
  expiry: this.#config.delegationExpiry
@@ -1406,11 +1408,6 @@ function sessionFromCallback(data, privateJwk) {
1406
1408
  signature: data.signature
1407
1409
  };
1408
1410
  }
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
1411
  function samePrincipal(left, right) {
1415
1412
  if (typeof left !== "string") return false;
1416
1413
  try {
@@ -1864,7 +1861,7 @@ var TOOL_BINDINGS = [
1864
1861
  operationVersion: 1,
1865
1862
  readOnlyHint: false,
1866
1863
  idempotentHint: true,
1867
- destructiveHint: true,
1864
+ destructiveHint: false,
1868
1865
  openWorldHint: false,
1869
1866
  surfaces: ["hosted", "public"]
1870
1867
  },
@@ -1894,7 +1891,7 @@ var TOOL_BINDINGS = [
1894
1891
  operationVersion: 1,
1895
1892
  readOnlyHint: false,
1896
1893
  idempotentHint: true,
1897
- destructiveHint: true,
1894
+ destructiveHint: false,
1898
1895
  openWorldHint: false,
1899
1896
  surfaces: ["hosted", "public"]
1900
1897
  }
@@ -1989,7 +1986,7 @@ function outcomeCode(result) {
1989
1986
  // package.json
1990
1987
  var package_default = {
1991
1988
  name: "@tinycloud/mcp",
1992
- version: "0.10.0-beta.3",
1989
+ version: "0.10.0-beta.31",
1993
1990
  description: "TinyCloud delegated operations MCP server",
1994
1991
  keywords: [
1995
1992
  "tinycloud",
@@ -2060,9 +2057,9 @@ var package_default = {
2060
2057
  dependencies: {
2061
2058
  "@modelcontextprotocol/node": "2.0.0-beta.5",
2062
2059
  "@modelcontextprotocol/server": "2.0.0-beta.5",
2063
- "@tinycloud/node-sdk": "3.12.0-beta.2",
2064
- "@tinycloud/node-sdk-wasm": "1.7.8",
2065
- "@tinycloud/operations": "0.9.0-beta.3",
2060
+ "@tinycloud/node-sdk": "3.12.0-beta.23",
2061
+ "@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
2062
+ "@tinycloud/operations": "0.9.0-beta.27",
2066
2063
  jose: "6.2.4"
2067
2064
  },
2068
2065
  devDependencies: {
@@ -2087,6 +2084,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
2087
2084
  // src/http.ts
2088
2085
  var REQUIRED_SCOPE = "tinycloud:mcp";
2089
2086
  var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
2087
+ var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
2090
2088
  var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
2091
2089
  var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
2092
2090
  function createHostedMcpApp(config) {
@@ -2384,10 +2382,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
2384
2382
  try {
2385
2383
  const destination = await store.approvalRedirect(requiredState(url));
2386
2384
  return Response.redirect(destination, 302);
2387
- } catch {
2385
+ } catch (error) {
2386
+ const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
2387
+ writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
2388
2388
  if (request.headers.get("accept")?.includes("text/html")) {
2389
2389
  return new Response(
2390
- '<!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>',
2390
+ '<!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>',
2391
2391
  {
2392
2392
  status: 400,
2393
2393
  headers: {
@@ -2598,7 +2598,7 @@ function mcpCors(response, request) {
2598
2598
  if (request.headers.has("origin")) {
2599
2599
  headers.set("access-control-allow-origin", "*");
2600
2600
  headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
2601
- headers.set("access-control-expose-headers", "WWW-Authenticate");
2601
+ headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
2602
2602
  if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
2603
2603
  }
2604
2604
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });