@tinycloud/mcp 0.10.0-beta.8 → 0.10.0
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 +99 -59
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +99 -58
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +99 -59
- package/dist/http.cjs.map +1 -1
- package/dist/http.js +99 -58
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +104 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +100 -60
- 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 +0 -18
- package/package.json +5 -4
- package/skills/tinycloud-delegated-secrets/SKILL.md +2 -3
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ var import_node_path = require("path");
|
|
|
48
48
|
var import_server = require("@modelcontextprotocol/server");
|
|
49
49
|
var import_ajv = require("@modelcontextprotocol/server/validators/ajv");
|
|
50
50
|
var import_operations = require("@tinycloud/operations");
|
|
51
|
+
var import_tc_apps = require("@tinycloud/operations/tc-apps");
|
|
51
52
|
|
|
52
53
|
// src/results.ts
|
|
53
54
|
function toMcpToolResult(result, bindings = [], options = {}) {
|
|
@@ -206,8 +207,7 @@ var TOOL_NAMES = [
|
|
|
206
207
|
"tinycloud_apps_context",
|
|
207
208
|
"tinycloud_apps_read",
|
|
208
209
|
"tinycloud_apps_write",
|
|
209
|
-
"tinycloud_apps_query"
|
|
210
|
-
"tinycloud_apps_move"
|
|
210
|
+
"tinycloud_apps_query"
|
|
211
211
|
];
|
|
212
212
|
function invocationTargetForMcp(selection) {
|
|
213
213
|
return {
|
|
@@ -431,7 +431,7 @@ var TOOL_BINDINGS = [
|
|
|
431
431
|
operationVersion: 1,
|
|
432
432
|
readOnlyHint: false,
|
|
433
433
|
idempotentHint: true,
|
|
434
|
-
destructiveHint:
|
|
434
|
+
destructiveHint: false,
|
|
435
435
|
openWorldHint: false,
|
|
436
436
|
surfaces: ["hosted", "public"]
|
|
437
437
|
},
|
|
@@ -461,19 +461,9 @@ var TOOL_BINDINGS = [
|
|
|
461
461
|
operationVersion: 1,
|
|
462
462
|
readOnlyHint: false,
|
|
463
463
|
idempotentHint: true,
|
|
464
|
-
destructiveHint: true,
|
|
465
|
-
openWorldHint: false,
|
|
466
|
-
surfaces: ["hosted", "public"]
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
name: "tinycloud_apps_move",
|
|
470
|
-
operationId: "tinycloud.apps.move",
|
|
471
|
-
operationVersion: 1,
|
|
472
|
-
readOnlyHint: false,
|
|
473
|
-
idempotentHint: true,
|
|
474
464
|
destructiveHint: false,
|
|
475
465
|
openWorldHint: false,
|
|
476
|
-
surfaces: ["hosted"]
|
|
466
|
+
surfaces: ["hosted", "public"]
|
|
477
467
|
}
|
|
478
468
|
];
|
|
479
469
|
var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
@@ -484,18 +474,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
|
484
474
|
result: toMcpJsonSchema(operation.result)
|
|
485
475
|
}
|
|
486
476
|
]));
|
|
477
|
+
var CATALOG_APP_TOOLS = [
|
|
478
|
+
"tinycloud_knowledge_list",
|
|
479
|
+
"tinycloud_knowledge_read",
|
|
480
|
+
"tinycloud_sql_query",
|
|
481
|
+
"tinycloud_sql_execute"
|
|
482
|
+
];
|
|
483
|
+
var APP_WITHOUT_CATALOG_APPS = "Pass one existing personal app id to request its task access together.";
|
|
484
|
+
function withPropertyDescription(schema, property, description) {
|
|
485
|
+
const properties = schema.properties;
|
|
486
|
+
const current = properties?.[property];
|
|
487
|
+
if (current === void 0) throw new Error(`Generated operations catalog has no ${property} input to describe.`);
|
|
488
|
+
return { ...schema, properties: { ...properties, [property]: { ...current, description } } };
|
|
489
|
+
}
|
|
490
|
+
function catalogAppRefusal(binding, profile, input) {
|
|
491
|
+
const app = typeof input === "object" && input !== null ? input.app : void 0;
|
|
492
|
+
if (typeof app !== "string" || !Object.hasOwn(import_tc_apps.TC_APPS_CATALOG_APPS, app)) return void 0;
|
|
493
|
+
const { title, link } = import_tc_apps.TC_APPS_CATALOG_APPS[app];
|
|
494
|
+
return {
|
|
495
|
+
status: "error",
|
|
496
|
+
operation: { operationId: binding.operationId, operationVersion: binding.operationVersion },
|
|
497
|
+
context: { profile, host: "unresolved", posture: "unauthenticated" },
|
|
498
|
+
error: {
|
|
499
|
+
code: "INPUT_INVALID",
|
|
500
|
+
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.`,
|
|
501
|
+
retryable: false,
|
|
502
|
+
details: { reason: "catalog_app_unavailable", app, link }
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
487
506
|
function createJsonSchemaValidator() {
|
|
488
507
|
return new import_ajv.AjvJsonSchemaValidator();
|
|
489
508
|
}
|
|
490
509
|
function registerTinyCloudTools(server, selection, validator) {
|
|
491
510
|
const bindings = TOOL_BINDINGS.filter((binding) => bindingSurfaces(binding).includes(selection.surface) && (selection.allowedTools === void 0 || selection.allowedTools.includes(binding.name)));
|
|
511
|
+
const servesCatalogApps = CATALOG_APP_TOOLS.every((name) => bindings.some((binding) => binding.name === name));
|
|
492
512
|
for (const binding of bindings) {
|
|
493
513
|
const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
|
|
494
514
|
if (operation === void 0) {
|
|
495
515
|
throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
|
|
496
516
|
}
|
|
517
|
+
const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
|
|
518
|
+
const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
|
|
497
519
|
const inputSchema = (0, import_server.fromJsonSchema)(
|
|
498
|
-
|
|
520
|
+
inputJsonSchema,
|
|
499
521
|
validator
|
|
500
522
|
);
|
|
501
523
|
const outputSchema = (0, import_server.fromJsonSchema)(
|
|
@@ -503,6 +525,7 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
503
525
|
validator
|
|
504
526
|
);
|
|
505
527
|
const annotations = {
|
|
528
|
+
...selection.annotationTitles === true ? { title: operation.title } : {},
|
|
506
529
|
readOnlyHint: binding.readOnlyHint,
|
|
507
530
|
idempotentHint: binding.idempotentHint,
|
|
508
531
|
destructiveHint: binding.destructiveHint,
|
|
@@ -522,19 +545,22 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
522
545
|
const metrics = { replayedGrants: 0 };
|
|
523
546
|
let code = "INTERNAL_ERROR";
|
|
524
547
|
try {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
548
|
+
let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
|
|
549
|
+
if (projected === void 0) {
|
|
550
|
+
await selection.beforeOperation?.();
|
|
551
|
+
const result = await (0, import_operations.invokeOperation)(
|
|
552
|
+
binding.operationId,
|
|
553
|
+
binding.operationVersion,
|
|
554
|
+
invocationTargetForMcp(selection),
|
|
555
|
+
input,
|
|
556
|
+
metrics
|
|
557
|
+
);
|
|
558
|
+
projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
|
|
559
|
+
operationId: binding.operationId,
|
|
560
|
+
operationVersion: binding.operationVersion,
|
|
561
|
+
input
|
|
562
|
+
});
|
|
563
|
+
}
|
|
538
564
|
const response = toMcpToolResult(projected, bindings, {
|
|
539
565
|
surface: selection.surface === "local" ? "local" : "hosted",
|
|
540
566
|
readOnly: binding.readOnlyHint,
|
|
@@ -566,7 +592,7 @@ function outcomeCode(result) {
|
|
|
566
592
|
// package.json
|
|
567
593
|
var package_default = {
|
|
568
594
|
name: "@tinycloud/mcp",
|
|
569
|
-
version: "0.10.0
|
|
595
|
+
version: "0.10.0",
|
|
570
596
|
description: "TinyCloud delegated operations MCP server",
|
|
571
597
|
keywords: [
|
|
572
598
|
"tinycloud",
|
|
@@ -637,9 +663,10 @@ var package_default = {
|
|
|
637
663
|
dependencies: {
|
|
638
664
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
639
665
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
640
|
-
"@tinycloud/node-sdk": "3.12.0
|
|
641
|
-
"@tinycloud/
|
|
642
|
-
"@tinycloud/
|
|
666
|
+
"@tinycloud/node-sdk": "3.12.0",
|
|
667
|
+
"@tinycloud/sdk-core": "3.12.0",
|
|
668
|
+
"@tinycloud/node-sdk-wasm": "1.7.9",
|
|
669
|
+
"@tinycloud/operations": "0.9.0",
|
|
643
670
|
jose: "6.2.4"
|
|
644
671
|
},
|
|
645
672
|
devDependencies: {
|
|
@@ -1017,6 +1044,7 @@ function claims(token) {
|
|
|
1017
1044
|
}
|
|
1018
1045
|
|
|
1019
1046
|
// src/remote-store.ts
|
|
1047
|
+
var import_sdk_core = require("@tinycloud/sdk-core");
|
|
1020
1048
|
var import_node_crypto3 = require("crypto");
|
|
1021
1049
|
var import_promises = require("fs/promises");
|
|
1022
1050
|
var import_node_path3 = require("path");
|
|
@@ -1026,7 +1054,7 @@ var import_artifacts = require("@tinycloud/operations/artifacts");
|
|
|
1026
1054
|
var import_state = require("@tinycloud/operations/state");
|
|
1027
1055
|
var import_operations2 = require("@tinycloud/operations");
|
|
1028
1056
|
var import_mcp_authority = require("@tinycloud/operations/mcp-authority");
|
|
1029
|
-
var
|
|
1057
|
+
var import_tc_apps2 = require("@tinycloud/operations/tc-apps");
|
|
1030
1058
|
|
|
1031
1059
|
// src/native-auth.ts
|
|
1032
1060
|
var import_node_crypto2 = require("crypto");
|
|
@@ -1096,7 +1124,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
1096
1124
|
"DELEGATION_HOST_MISMATCH",
|
|
1097
1125
|
"DELEGATION_REJECTED"
|
|
1098
1126
|
]);
|
|
1099
|
-
var
|
|
1127
|
+
var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
|
|
1100
1128
|
var BOOTSTRAP_PERMISSIONS = [
|
|
1101
1129
|
{
|
|
1102
1130
|
service: "tinycloud.kv",
|
|
@@ -1422,7 +1450,7 @@ var RemoteTenantStore = class {
|
|
|
1422
1450
|
kind: "openkey",
|
|
1423
1451
|
requestId,
|
|
1424
1452
|
url: this.#connectUrl(pending),
|
|
1425
|
-
fallback: (0,
|
|
1453
|
+
fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
|
|
1426
1454
|
}
|
|
1427
1455
|
};
|
|
1428
1456
|
}
|
|
@@ -1457,7 +1485,7 @@ var RemoteTenantStore = class {
|
|
|
1457
1485
|
kind: "openkey",
|
|
1458
1486
|
requestId,
|
|
1459
1487
|
url: this.#connectUrl(pending),
|
|
1460
|
-
fallback: (0,
|
|
1488
|
+
fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
|
|
1461
1489
|
},
|
|
1462
1490
|
retry: (0, import_mcp_authority.operationRetryDescriptor)(invocation, invocation.input)
|
|
1463
1491
|
};
|
|
@@ -1519,11 +1547,12 @@ var RemoteTenantStore = class {
|
|
|
1519
1547
|
did: tenant.sessionDid,
|
|
1520
1548
|
callback: callback.toString(),
|
|
1521
1549
|
host: this.#config.nodeHost,
|
|
1522
|
-
|
|
1550
|
+
requesterOrigin: this.#config.publicUrl.origin,
|
|
1551
|
+
jwk: Buffer.from(JSON.stringify((0, import_node_sdk2.publicJwk)(tenant.jwk))).toString("base64url"),
|
|
1523
1552
|
permissions: Buffer.from(JSON.stringify({
|
|
1524
1553
|
permissions: pending.permissions,
|
|
1525
1554
|
reason: [
|
|
1526
|
-
pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0,
|
|
1555
|
+
pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0, import_tc_apps2.tcAppsApprovalReason)(pending.permissions) ?? "Approve the exact capabilities requested by the TinyCloud MCP operation.",
|
|
1527
1556
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
1528
1557
|
// client that created this link, never from the link itself. The
|
|
1529
1558
|
// callback refuses a signer outside them, so the approver isn't asked to check.
|
|
@@ -1826,10 +1855,10 @@ var RemoteTenantStore = class {
|
|
|
1826
1855
|
authMethod: "openkey",
|
|
1827
1856
|
openkeyHost: this.#config.openkeyHost
|
|
1828
1857
|
});
|
|
1829
|
-
} else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "")
|
|
1858
|
+
} 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(/\/+$/, "")) {
|
|
1830
1859
|
await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
|
|
1831
1860
|
process.stderr.write(
|
|
1832
|
-
`[tinycloud-mcp-http] tenant node host migrated: from=${
|
|
1861
|
+
`[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
|
|
1833
1862
|
`
|
|
1834
1863
|
);
|
|
1835
1864
|
}
|
|
@@ -2135,11 +2164,6 @@ function sessionFromCallback(data, privateJwk) {
|
|
|
2135
2164
|
signature: data.signature
|
|
2136
2165
|
};
|
|
2137
2166
|
}
|
|
2138
|
-
function publicJwk(jwk) {
|
|
2139
|
-
const copy = { ...jwk };
|
|
2140
|
-
for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
|
|
2141
|
-
return copy;
|
|
2142
|
-
}
|
|
2143
2167
|
function samePrincipal(left, right) {
|
|
2144
2168
|
if (typeof left !== "string") return false;
|
|
2145
2169
|
try {
|
|
@@ -2152,6 +2176,7 @@ function normalizeDid(value) {
|
|
|
2152
2176
|
return value.split("#", 1)[0];
|
|
2153
2177
|
}
|
|
2154
2178
|
function sameNodeHost(left, right) {
|
|
2179
|
+
if (PRODUCTION_NODE_HOSTS.has(left) && (0, import_sdk_core.sameTinyCloudNode)(left, right)) return true;
|
|
2155
2180
|
try {
|
|
2156
2181
|
const normalize = (value) => {
|
|
2157
2182
|
const url = new URL(value);
|
|
@@ -2246,36 +2271,47 @@ function samePendingRequest(pending, expected) {
|
|
|
2246
2271
|
// src/http.ts
|
|
2247
2272
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2248
2273
|
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2274
|
+
var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
|
|
2249
2275
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2250
2276
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2277
|
+
var RESTRICTED_ADDRESS_PREFIXES = ["chatgpt", "claude", "grok", "muse"];
|
|
2278
|
+
var ANNOTATION_TITLE_PREFIXES = /* @__PURE__ */ new Set(["claude"]);
|
|
2251
2279
|
function createHostedMcpApp(config) {
|
|
2252
2280
|
if (config.nativeServiceCredential !== void 0 && Buffer.byteLength(config.nativeServiceCredential, "utf8") < 32) {
|
|
2253
2281
|
throw new Error("TC_MCP_NATIVE_SERVICE_CREDENTIAL must contain at least 32 bytes.");
|
|
2254
2282
|
}
|
|
2255
2283
|
const resourceUrl = canonicalResourceUrl(config.publicUrl);
|
|
2256
|
-
const pluginUrl = new URL("./chatgpt/mcp", resourceUrl);
|
|
2257
2284
|
const statusFor = (resource) => config.introspection === void 0 ? void 0 : createTokenStatusChecker({ ...config.introspection, resourceUrl: resource.toString() });
|
|
2258
2285
|
const hosted = createHostedSurface(config, resourceUrl, "hosted", statusFor(resourceUrl));
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2286
|
+
const surfaces = [hosted];
|
|
2287
|
+
const restrictedByPath = /* @__PURE__ */ new Map();
|
|
2288
|
+
for (const prefix of RESTRICTED_ADDRESS_PREFIXES) {
|
|
2289
|
+
const restrictedUrl = new URL(`./${prefix}/mcp`, resourceUrl);
|
|
2290
|
+
const connectUrl = new URL("./connect", restrictedUrl);
|
|
2291
|
+
const restricted = createHostedSurface({
|
|
2292
|
+
...config,
|
|
2293
|
+
nativeServiceCredential: void 0,
|
|
2294
|
+
stateDir: (0, import_node_path4.join)(config.stateDir, prefix),
|
|
2295
|
+
approvalPath: connectUrl.pathname
|
|
2296
|
+
}, restrictedUrl, "public", statusFor(restrictedUrl), ANNOTATION_TITLE_PREFIXES.has(prefix));
|
|
2297
|
+
surfaces.push(restricted);
|
|
2298
|
+
for (const owned of [
|
|
2299
|
+
restrictedUrl,
|
|
2300
|
+
connectUrl,
|
|
2301
|
+
new URL("./connect/callback", restrictedUrl),
|
|
2302
|
+
new URL((0, import_server5.getOAuthProtectedResourceMetadataUrl)(restrictedUrl))
|
|
2303
|
+
]) {
|
|
2304
|
+
restrictedByPath.set(owned.pathname, restricted);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2271
2307
|
return {
|
|
2272
|
-
fetch: (request) => (
|
|
2308
|
+
fetch: (request) => (restrictedByPath.get(new URL(request.url).pathname) ?? hosted).fetch(request),
|
|
2273
2309
|
close: async () => {
|
|
2274
|
-
await Promise.all(
|
|
2310
|
+
await Promise.all(surfaces.map((surface) => surface.close()));
|
|
2275
2311
|
}
|
|
2276
2312
|
};
|
|
2277
2313
|
}
|
|
2278
|
-
function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
2314
|
+
function createHostedSurface(config, resourceUrl, surface, tokenStatus, annotationTitles = false) {
|
|
2279
2315
|
const connectPath = config.approvalPath ?? "/connect";
|
|
2280
2316
|
const callbackPath = `${connectPath}/callback`;
|
|
2281
2317
|
const issuer = String(config.oauthMetadata.issuer);
|
|
@@ -2315,6 +2351,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
|
2315
2351
|
explicitProfile: true,
|
|
2316
2352
|
allowOwnerProfile: false,
|
|
2317
2353
|
stateRoot,
|
|
2354
|
+
annotationTitles,
|
|
2318
2355
|
...nativeOwner === void 0 ? {} : {
|
|
2319
2356
|
allowedTools: ["tinycloud_sql_query", "tinycloud_kv_get", "tinycloud_read"]
|
|
2320
2357
|
},
|
|
@@ -2323,7 +2360,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
|
|
|
2323
2360
|
transformOperationResult: (result, invocation) => store.decorateAuthorityResult(subject, ownerDids, result, invocation)
|
|
2324
2361
|
} : {}
|
|
2325
2362
|
}, validator);
|
|
2326
|
-
if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface);
|
|
2363
|
+
if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface, annotationTitles);
|
|
2327
2364
|
return server;
|
|
2328
2365
|
}, {
|
|
2329
2366
|
legacy: "stateless",
|
|
@@ -2670,7 +2707,8 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2670
2707
|
close: () => handler.close()
|
|
2671
2708
|
};
|
|
2672
2709
|
}
|
|
2673
|
-
function registerConnectTool(server, validator, store, identity, surface) {
|
|
2710
|
+
function registerConnectTool(server, validator, store, identity, surface, annotationTitles) {
|
|
2711
|
+
const title = "Connect TinyCloud";
|
|
2674
2712
|
const inputSchema = (0, import_server5.fromJsonSchema)({ type: "object", properties: {}, additionalProperties: false }, validator);
|
|
2675
2713
|
const outputSchema = (0, import_server5.fromJsonSchema)({
|
|
2676
2714
|
type: "object",
|
|
@@ -2686,11 +2724,12 @@ function registerConnectTool(server, validator, store, identity, surface) {
|
|
|
2686
2724
|
server.registerTool(
|
|
2687
2725
|
"tinycloud_connect",
|
|
2688
2726
|
{
|
|
2689
|
-
title
|
|
2727
|
+
title,
|
|
2690
2728
|
description: "Check the hosted delegate connection and return a one-time OpenKey approval URL when setup is required.",
|
|
2691
2729
|
inputSchema,
|
|
2692
2730
|
outputSchema,
|
|
2693
2731
|
annotations: {
|
|
2732
|
+
...annotationTitles ? { title } : {},
|
|
2694
2733
|
readOnlyHint: false,
|
|
2695
2734
|
idempotentHint: true,
|
|
2696
2735
|
destructiveHint: false,
|
|
@@ -2759,7 +2798,7 @@ function mcpCors(response, request) {
|
|
|
2759
2798
|
if (request.headers.has("origin")) {
|
|
2760
2799
|
headers.set("access-control-allow-origin", "*");
|
|
2761
2800
|
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2762
|
-
headers.set("access-control-expose-headers",
|
|
2801
|
+
headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
|
|
2763
2802
|
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2764
2803
|
}
|
|
2765
2804
|
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|