@tinycloud/mcp 0.10.0-beta.5 → 0.10.0-beta.51
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 +51 -31
- package/dist/cli.cjs +58 -30
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +58 -30
- package/dist/cli.js.map +1 -1
- package/dist/http-cli.cjs +106 -63
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +106 -62
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +106 -63
- package/dist/http.cjs.map +1 -1
- package/dist/http.js +106 -62
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +111 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +107 -64
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +58 -30
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +58 -30
- package/dist/server.js.map +1 -1
- package/dist/tools.cjs +54 -28
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +3 -1
- package/dist/tools.d.ts +3 -1
- package/dist/tools.js +54 -28
- 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/http-cli.js
CHANGED
|
@@ -277,6 +277,7 @@ function logToolCall(tool, code, startedAt, replayedGrants) {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// src/remote-store.ts
|
|
280
|
+
import { sameTinyCloudNode } from "@tinycloud/sdk-core";
|
|
280
281
|
import { createHmac, randomBytes, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
281
282
|
import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "fs/promises";
|
|
282
283
|
import { dirname, join } from "path";
|
|
@@ -290,6 +291,7 @@ import {
|
|
|
290
291
|
UnsupportedSessionRestoreError,
|
|
291
292
|
isCapabilitySubset,
|
|
292
293
|
principalDidEquals,
|
|
294
|
+
publicJwk,
|
|
293
295
|
siweRuntimeDelegation,
|
|
294
296
|
signedCompactUcanExpiry
|
|
295
297
|
} from "@tinycloud/node-sdk";
|
|
@@ -368,7 +370,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
368
370
|
"DELEGATION_HOST_MISMATCH",
|
|
369
371
|
"DELEGATION_REJECTED"
|
|
370
372
|
]);
|
|
371
|
-
var
|
|
373
|
+
var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
|
|
372
374
|
var BOOTSTRAP_PERMISSIONS = [
|
|
373
375
|
{
|
|
374
376
|
service: "tinycloud.kv",
|
|
@@ -791,14 +793,16 @@ var RemoteTenantStore = class {
|
|
|
791
793
|
did: tenant.sessionDid,
|
|
792
794
|
callback: callback.toString(),
|
|
793
795
|
host: this.#config.nodeHost,
|
|
796
|
+
requesterOrigin: this.#config.publicUrl.origin,
|
|
794
797
|
jwk: Buffer.from(JSON.stringify(publicJwk(tenant.jwk))).toString("base64url"),
|
|
795
798
|
permissions: Buffer.from(JSON.stringify({
|
|
796
799
|
permissions: pending.permissions,
|
|
797
800
|
reason: [
|
|
798
801
|
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
802
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
800
|
-
// client that created this link, never from the link itself.
|
|
801
|
-
|
|
803
|
+
// client that created this link, never from the link itself. The
|
|
804
|
+
// callback refuses a signer outside them, so the approver isn't asked to check.
|
|
805
|
+
...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
|
|
802
806
|
].join(" ")
|
|
803
807
|
})).toString("base64url"),
|
|
804
808
|
expiry: this.#config.delegationExpiry
|
|
@@ -1097,10 +1101,10 @@ var RemoteTenantStore = class {
|
|
|
1097
1101
|
authMethod: "openkey",
|
|
1098
1102
|
openkeyHost: this.#config.openkeyHost
|
|
1099
1103
|
});
|
|
1100
|
-
} else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "")
|
|
1104
|
+
} 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(/\/+$/, "")) {
|
|
1101
1105
|
await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
|
|
1102
1106
|
process.stderr.write(
|
|
1103
|
-
`[tinycloud-mcp-http] tenant node host migrated: from=${
|
|
1107
|
+
`[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
|
|
1104
1108
|
`
|
|
1105
1109
|
);
|
|
1106
1110
|
}
|
|
@@ -1406,11 +1410,6 @@ function sessionFromCallback(data, privateJwk) {
|
|
|
1406
1410
|
signature: data.signature
|
|
1407
1411
|
};
|
|
1408
1412
|
}
|
|
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
1413
|
function samePrincipal(left, right) {
|
|
1415
1414
|
if (typeof left !== "string") return false;
|
|
1416
1415
|
try {
|
|
@@ -1423,6 +1422,7 @@ function normalizeDid(value) {
|
|
|
1423
1422
|
return value.split("#", 1)[0];
|
|
1424
1423
|
}
|
|
1425
1424
|
function sameNodeHost(left, right) {
|
|
1425
|
+
if (PRODUCTION_NODE_HOSTS.has(left) && sameTinyCloudNode(left, right)) return true;
|
|
1426
1426
|
try {
|
|
1427
1427
|
const normalize = (value) => {
|
|
1428
1428
|
const url = new URL(value);
|
|
@@ -1524,6 +1524,7 @@ import { join as join2 } from "path";
|
|
|
1524
1524
|
import { fromJsonSchema } from "@modelcontextprotocol/server";
|
|
1525
1525
|
import { AjvJsonSchemaValidator } from "@modelcontextprotocol/server/validators/ajv";
|
|
1526
1526
|
import { invokeOperation as invokeOperation2 } from "@tinycloud/operations";
|
|
1527
|
+
import { TC_APPS_CATALOG_APPS } from "@tinycloud/operations/tc-apps";
|
|
1527
1528
|
|
|
1528
1529
|
// src/results.ts
|
|
1529
1530
|
function toMcpToolResult(result, bindings = [], options = {}) {
|
|
@@ -1864,7 +1865,7 @@ var TOOL_BINDINGS = [
|
|
|
1864
1865
|
operationVersion: 1,
|
|
1865
1866
|
readOnlyHint: false,
|
|
1866
1867
|
idempotentHint: true,
|
|
1867
|
-
destructiveHint:
|
|
1868
|
+
destructiveHint: false,
|
|
1868
1869
|
openWorldHint: false,
|
|
1869
1870
|
surfaces: ["hosted", "public"]
|
|
1870
1871
|
},
|
|
@@ -1894,19 +1895,9 @@ var TOOL_BINDINGS = [
|
|
|
1894
1895
|
operationVersion: 1,
|
|
1895
1896
|
readOnlyHint: false,
|
|
1896
1897
|
idempotentHint: true,
|
|
1897
|
-
destructiveHint: true,
|
|
1898
|
-
openWorldHint: false,
|
|
1899
|
-
surfaces: ["hosted", "public"]
|
|
1900
|
-
},
|
|
1901
|
-
{
|
|
1902
|
-
name: "tinycloud_apps_move",
|
|
1903
|
-
operationId: "tinycloud.apps.move",
|
|
1904
|
-
operationVersion: 1,
|
|
1905
|
-
readOnlyHint: false,
|
|
1906
|
-
idempotentHint: true,
|
|
1907
1898
|
destructiveHint: false,
|
|
1908
1899
|
openWorldHint: false,
|
|
1909
|
-
surfaces: ["hosted"]
|
|
1900
|
+
surfaces: ["hosted", "public"]
|
|
1910
1901
|
}
|
|
1911
1902
|
];
|
|
1912
1903
|
var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
@@ -1917,18 +1908,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
|
1917
1908
|
result: toMcpJsonSchema(operation.result)
|
|
1918
1909
|
}
|
|
1919
1910
|
]));
|
|
1911
|
+
var CATALOG_APP_TOOLS = [
|
|
1912
|
+
"tinycloud_knowledge_list",
|
|
1913
|
+
"tinycloud_knowledge_read",
|
|
1914
|
+
"tinycloud_sql_query",
|
|
1915
|
+
"tinycloud_sql_execute"
|
|
1916
|
+
];
|
|
1917
|
+
var APP_WITHOUT_CATALOG_APPS = "Pass one existing personal app id to request its task access together.";
|
|
1918
|
+
function withPropertyDescription(schema, property, description) {
|
|
1919
|
+
const properties = schema.properties;
|
|
1920
|
+
const current = properties?.[property];
|
|
1921
|
+
if (current === void 0) throw new Error(`Generated operations catalog has no ${property} input to describe.`);
|
|
1922
|
+
return { ...schema, properties: { ...properties, [property]: { ...current, description } } };
|
|
1923
|
+
}
|
|
1924
|
+
function catalogAppRefusal(binding, profile, input) {
|
|
1925
|
+
const app = typeof input === "object" && input !== null ? input.app : void 0;
|
|
1926
|
+
if (typeof app !== "string" || !Object.hasOwn(TC_APPS_CATALOG_APPS, app)) return void 0;
|
|
1927
|
+
const { title, link } = TC_APPS_CATALOG_APPS[app];
|
|
1928
|
+
return {
|
|
1929
|
+
status: "error",
|
|
1930
|
+
operation: { operationId: binding.operationId, operationVersion: binding.operationVersion },
|
|
1931
|
+
context: { profile, host: "unresolved", posture: "unauthenticated" },
|
|
1932
|
+
error: {
|
|
1933
|
+
code: "INPUT_INVALID",
|
|
1934
|
+
message: `${title} is not available through this connector. Its page is ${link}. If the user asked for ${title}, tell them so and give them that link. For any other personal records, call tinycloud_apps_context without app.`,
|
|
1935
|
+
retryable: false,
|
|
1936
|
+
details: { reason: "catalog_app_unavailable", app, link }
|
|
1937
|
+
}
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1920
1940
|
function createJsonSchemaValidator() {
|
|
1921
1941
|
return new AjvJsonSchemaValidator();
|
|
1922
1942
|
}
|
|
1923
1943
|
function registerTinyCloudTools(server, selection, validator) {
|
|
1924
1944
|
const bindings = TOOL_BINDINGS.filter((binding) => bindingSurfaces(binding).includes(selection.surface) && (selection.allowedTools === void 0 || selection.allowedTools.includes(binding.name)));
|
|
1945
|
+
const servesCatalogApps = CATALOG_APP_TOOLS.every((name) => bindings.some((binding) => binding.name === name));
|
|
1925
1946
|
for (const binding of bindings) {
|
|
1926
1947
|
const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
|
|
1927
1948
|
if (operation === void 0) {
|
|
1928
1949
|
throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
|
|
1929
1950
|
}
|
|
1951
|
+
const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
|
|
1952
|
+
const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
|
|
1930
1953
|
const inputSchema = fromJsonSchema(
|
|
1931
|
-
|
|
1954
|
+
inputJsonSchema,
|
|
1932
1955
|
validator
|
|
1933
1956
|
);
|
|
1934
1957
|
const outputSchema = fromJsonSchema(
|
|
@@ -1936,6 +1959,7 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
1936
1959
|
validator
|
|
1937
1960
|
);
|
|
1938
1961
|
const annotations = {
|
|
1962
|
+
...selection.annotationTitles === true ? { title: operation.title } : {},
|
|
1939
1963
|
readOnlyHint: binding.readOnlyHint,
|
|
1940
1964
|
idempotentHint: binding.idempotentHint,
|
|
1941
1965
|
destructiveHint: binding.destructiveHint,
|
|
@@ -1955,19 +1979,22 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
1955
1979
|
const metrics = { replayedGrants: 0 };
|
|
1956
1980
|
let code = "INTERNAL_ERROR";
|
|
1957
1981
|
try {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1982
|
+
let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
|
|
1983
|
+
if (projected === void 0) {
|
|
1984
|
+
await selection.beforeOperation?.();
|
|
1985
|
+
const result = await invokeOperation2(
|
|
1986
|
+
binding.operationId,
|
|
1987
|
+
binding.operationVersion,
|
|
1988
|
+
invocationTargetForMcp(selection),
|
|
1989
|
+
input,
|
|
1990
|
+
metrics
|
|
1991
|
+
);
|
|
1992
|
+
projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
|
|
1993
|
+
operationId: binding.operationId,
|
|
1994
|
+
operationVersion: binding.operationVersion,
|
|
1995
|
+
input
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1971
1998
|
const response = toMcpToolResult(projected, bindings, {
|
|
1972
1999
|
surface: selection.surface === "local" ? "local" : "hosted",
|
|
1973
2000
|
readOnly: binding.readOnlyHint,
|
|
@@ -1999,7 +2026,7 @@ function outcomeCode(result) {
|
|
|
1999
2026
|
// package.json
|
|
2000
2027
|
var package_default = {
|
|
2001
2028
|
name: "@tinycloud/mcp",
|
|
2002
|
-
version: "0.10.0-beta.
|
|
2029
|
+
version: "0.10.0-beta.51",
|
|
2003
2030
|
description: "TinyCloud delegated operations MCP server",
|
|
2004
2031
|
keywords: [
|
|
2005
2032
|
"tinycloud",
|
|
@@ -2070,9 +2097,10 @@ var package_default = {
|
|
|
2070
2097
|
dependencies: {
|
|
2071
2098
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
2072
2099
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
2073
|
-
"@tinycloud/node-sdk": "3.12.0-beta.
|
|
2074
|
-
"@tinycloud/
|
|
2075
|
-
"@tinycloud/
|
|
2100
|
+
"@tinycloud/node-sdk": "3.12.0-beta.38",
|
|
2101
|
+
"@tinycloud/sdk-core": "3.12.0-beta.37",
|
|
2102
|
+
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
2103
|
+
"@tinycloud/operations": "0.9.0-beta.45",
|
|
2076
2104
|
jose: "6.2.4"
|
|
2077
2105
|
},
|
|
2078
2106
|
devDependencies: {
|
|
@@ -2097,36 +2125,47 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
|
|
|
2097
2125
|
// src/http.ts
|
|
2098
2126
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2099
2127
|
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2128
|
+
var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
|
|
2100
2129
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2101
2130
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2131
|
+
var RESTRICTED_ADDRESS_PREFIXES = ["chatgpt", "claude", "grok", "muse"];
|
|
2132
|
+
var ANNOTATION_TITLE_PREFIXES = /* @__PURE__ */ new Set(["claude"]);
|
|
2102
2133
|
function createHostedMcpApp(config) {
|
|
2103
2134
|
if (config.nativeServiceCredential !== void 0 && Buffer.byteLength(config.nativeServiceCredential, "utf8") < 32) {
|
|
2104
2135
|
throw new Error("TC_MCP_NATIVE_SERVICE_CREDENTIAL must contain at least 32 bytes.");
|
|
2105
2136
|
}
|
|
2106
2137
|
const resourceUrl = canonicalResourceUrl(config.publicUrl);
|
|
2107
|
-
const pluginUrl = new URL("./chatgpt/mcp", resourceUrl);
|
|
2108
2138
|
const statusFor = (resource) => config.introspection === void 0 ? void 0 : createTokenStatusChecker({ ...config.introspection, resourceUrl: resource.toString() });
|
|
2109
2139
|
const hosted = createHostedSurface(config, resourceUrl, "hosted", statusFor(resourceUrl));
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2140
|
+
const surfaces = [hosted];
|
|
2141
|
+
const restrictedByPath = /* @__PURE__ */ new Map();
|
|
2142
|
+
for (const prefix of RESTRICTED_ADDRESS_PREFIXES) {
|
|
2143
|
+
const restrictedUrl = new URL(`./${prefix}/mcp`, resourceUrl);
|
|
2144
|
+
const connectUrl = new URL("./connect", restrictedUrl);
|
|
2145
|
+
const restricted = createHostedSurface({
|
|
2146
|
+
...config,
|
|
2147
|
+
nativeServiceCredential: void 0,
|
|
2148
|
+
stateDir: join3(config.stateDir, prefix),
|
|
2149
|
+
approvalPath: connectUrl.pathname
|
|
2150
|
+
}, restrictedUrl, "public", statusFor(restrictedUrl), ANNOTATION_TITLE_PREFIXES.has(prefix));
|
|
2151
|
+
surfaces.push(restricted);
|
|
2152
|
+
for (const owned of [
|
|
2153
|
+
restrictedUrl,
|
|
2154
|
+
connectUrl,
|
|
2155
|
+
new URL("./connect/callback", restrictedUrl),
|
|
2156
|
+
new URL(getOAuthProtectedResourceMetadataUrl(restrictedUrl))
|
|
2157
|
+
]) {
|
|
2158
|
+
restrictedByPath.set(owned.pathname, restricted);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2122
2161
|
return {
|
|
2123
|
-
fetch: (request) => (
|
|
2162
|
+
fetch: (request) => (restrictedByPath.get(new URL(request.url).pathname) ?? hosted).fetch(request),
|
|
2124
2163
|
close: async () => {
|
|
2125
|
-
await Promise.all(
|
|
2164
|
+
await Promise.all(surfaces.map((surface) => surface.close()));
|
|
2126
2165
|
}
|
|
2127
2166
|
};
|
|
2128
2167
|
}
|
|
2129
|
-
function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
2168
|
+
function createHostedSurface(config, resourceUrl, surface, tokenStatus, annotationTitles = false) {
|
|
2130
2169
|
const connectPath = config.approvalPath ?? "/connect";
|
|
2131
2170
|
const callbackPath = `${connectPath}/callback`;
|
|
2132
2171
|
const issuer = String(config.oauthMetadata.issuer);
|
|
@@ -2166,6 +2205,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
|
2166
2205
|
explicitProfile: true,
|
|
2167
2206
|
allowOwnerProfile: false,
|
|
2168
2207
|
stateRoot,
|
|
2208
|
+
annotationTitles,
|
|
2169
2209
|
...nativeOwner === void 0 ? {} : {
|
|
2170
2210
|
allowedTools: ["tinycloud_sql_query", "tinycloud_kv_get", "tinycloud_read"]
|
|
2171
2211
|
},
|
|
@@ -2174,7 +2214,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
|
2174
2214
|
transformOperationResult: (result, invocation) => store.decorateAuthorityResult(subject, ownerDids, result, invocation)
|
|
2175
2215
|
} : {}
|
|
2176
2216
|
}, validator);
|
|
2177
|
-
if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface);
|
|
2217
|
+
if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface, annotationTitles);
|
|
2178
2218
|
return server;
|
|
2179
2219
|
}, {
|
|
2180
2220
|
legacy: "stateless",
|
|
@@ -2394,10 +2434,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2394
2434
|
try {
|
|
2395
2435
|
const destination = await store.approvalRedirect(requiredState(url));
|
|
2396
2436
|
return Response.redirect(destination, 302);
|
|
2397
|
-
} catch {
|
|
2437
|
+
} catch (error) {
|
|
2438
|
+
const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
|
|
2439
|
+
writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
|
|
2398
2440
|
if (request.headers.get("accept")?.includes("text/html")) {
|
|
2399
2441
|
return new Response(
|
|
2400
|
-
'<!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.
|
|
2442
|
+
'<!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>',
|
|
2401
2443
|
{
|
|
2402
2444
|
status: 400,
|
|
2403
2445
|
headers: {
|
|
@@ -2519,7 +2561,8 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2519
2561
|
close: () => handler.close()
|
|
2520
2562
|
};
|
|
2521
2563
|
}
|
|
2522
|
-
function registerConnectTool(server, validator, store, identity, surface) {
|
|
2564
|
+
function registerConnectTool(server, validator, store, identity, surface, annotationTitles) {
|
|
2565
|
+
const title = "Connect TinyCloud";
|
|
2523
2566
|
const inputSchema = fromJsonSchema2({ type: "object", properties: {}, additionalProperties: false }, validator);
|
|
2524
2567
|
const outputSchema = fromJsonSchema2({
|
|
2525
2568
|
type: "object",
|
|
@@ -2535,11 +2578,12 @@ function registerConnectTool(server, validator, store, identity, surface) {
|
|
|
2535
2578
|
server.registerTool(
|
|
2536
2579
|
"tinycloud_connect",
|
|
2537
2580
|
{
|
|
2538
|
-
title
|
|
2581
|
+
title,
|
|
2539
2582
|
description: "Check the hosted delegate connection and return a one-time OpenKey approval URL when setup is required.",
|
|
2540
2583
|
inputSchema,
|
|
2541
2584
|
outputSchema,
|
|
2542
2585
|
annotations: {
|
|
2586
|
+
...annotationTitles ? { title } : {},
|
|
2543
2587
|
readOnlyHint: false,
|
|
2544
2588
|
idempotentHint: true,
|
|
2545
2589
|
destructiveHint: false,
|
|
@@ -2608,7 +2652,7 @@ function mcpCors(response, request) {
|
|
|
2608
2652
|
if (request.headers.has("origin")) {
|
|
2609
2653
|
headers.set("access-control-allow-origin", "*");
|
|
2610
2654
|
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2611
|
-
headers.set("access-control-expose-headers",
|
|
2655
|
+
headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
|
|
2612
2656
|
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2613
2657
|
}
|
|
2614
2658
|
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|