@tinycloud/mcp 0.10.0-beta.49 → 0.10.0-beta.50
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 +6 -1
- package/dist/cli.cjs +52 -16
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +52 -16
- package/dist/cli.js.map +1 -1
- package/dist/http-cli.cjs +52 -16
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +52 -16
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +52 -16
- package/dist/http.cjs.map +1 -1
- package/dist/http.js +52 -16
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +56 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -16
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +52 -16
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +52 -16
- package/dist/server.js.map +1 -1
- package/dist/tools.cjs +50 -14
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +50 -14
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
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 = {}) {
|
|
@@ -473,18 +474,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
|
473
474
|
result: toMcpJsonSchema(operation.result)
|
|
474
475
|
}
|
|
475
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
|
+
}
|
|
476
506
|
function createJsonSchemaValidator() {
|
|
477
507
|
return new import_ajv.AjvJsonSchemaValidator();
|
|
478
508
|
}
|
|
479
509
|
function registerTinyCloudTools(server, selection, validator) {
|
|
480
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));
|
|
481
512
|
for (const binding of bindings) {
|
|
482
513
|
const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
|
|
483
514
|
if (operation === void 0) {
|
|
484
515
|
throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
|
|
485
516
|
}
|
|
517
|
+
const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
|
|
518
|
+
const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
|
|
486
519
|
const inputSchema = (0, import_server.fromJsonSchema)(
|
|
487
|
-
|
|
520
|
+
inputJsonSchema,
|
|
488
521
|
validator
|
|
489
522
|
);
|
|
490
523
|
const outputSchema = (0, import_server.fromJsonSchema)(
|
|
@@ -511,19 +544,22 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
511
544
|
const metrics = { replayedGrants: 0 };
|
|
512
545
|
let code = "INTERNAL_ERROR";
|
|
513
546
|
try {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
547
|
+
let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
|
|
548
|
+
if (projected === void 0) {
|
|
549
|
+
await selection.beforeOperation?.();
|
|
550
|
+
const result = await (0, import_operations.invokeOperation)(
|
|
551
|
+
binding.operationId,
|
|
552
|
+
binding.operationVersion,
|
|
553
|
+
invocationTargetForMcp(selection),
|
|
554
|
+
input,
|
|
555
|
+
metrics
|
|
556
|
+
);
|
|
557
|
+
projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
|
|
558
|
+
operationId: binding.operationId,
|
|
559
|
+
operationVersion: binding.operationVersion,
|
|
560
|
+
input
|
|
561
|
+
});
|
|
562
|
+
}
|
|
527
563
|
const response = toMcpToolResult(projected, bindings, {
|
|
528
564
|
surface: selection.surface === "local" ? "local" : "hosted",
|
|
529
565
|
readOnly: binding.readOnlyHint,
|
|
@@ -555,7 +591,7 @@ function outcomeCode(result) {
|
|
|
555
591
|
// package.json
|
|
556
592
|
var package_default = {
|
|
557
593
|
name: "@tinycloud/mcp",
|
|
558
|
-
version: "0.10.0-beta.
|
|
594
|
+
version: "0.10.0-beta.50",
|
|
559
595
|
description: "TinyCloud delegated operations MCP server",
|
|
560
596
|
keywords: [
|
|
561
597
|
"tinycloud",
|
|
@@ -629,7 +665,7 @@ var package_default = {
|
|
|
629
665
|
"@tinycloud/node-sdk": "3.12.0-beta.38",
|
|
630
666
|
"@tinycloud/sdk-core": "3.12.0-beta.37",
|
|
631
667
|
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
632
|
-
"@tinycloud/operations": "0.9.0-beta.
|
|
668
|
+
"@tinycloud/operations": "0.9.0-beta.45",
|
|
633
669
|
jose: "6.2.4"
|
|
634
670
|
},
|
|
635
671
|
devDependencies: {
|
|
@@ -1017,7 +1053,7 @@ var import_artifacts = require("@tinycloud/operations/artifacts");
|
|
|
1017
1053
|
var import_state = require("@tinycloud/operations/state");
|
|
1018
1054
|
var import_operations2 = require("@tinycloud/operations");
|
|
1019
1055
|
var import_mcp_authority = require("@tinycloud/operations/mcp-authority");
|
|
1020
|
-
var
|
|
1056
|
+
var import_tc_apps2 = require("@tinycloud/operations/tc-apps");
|
|
1021
1057
|
|
|
1022
1058
|
// src/native-auth.ts
|
|
1023
1059
|
var import_node_crypto2 = require("crypto");
|
|
@@ -1413,7 +1449,7 @@ var RemoteTenantStore = class {
|
|
|
1413
1449
|
kind: "openkey",
|
|
1414
1450
|
requestId,
|
|
1415
1451
|
url: this.#connectUrl(pending),
|
|
1416
|
-
fallback: (0,
|
|
1452
|
+
fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
|
|
1417
1453
|
}
|
|
1418
1454
|
};
|
|
1419
1455
|
}
|
|
@@ -1448,7 +1484,7 @@ var RemoteTenantStore = class {
|
|
|
1448
1484
|
kind: "openkey",
|
|
1449
1485
|
requestId,
|
|
1450
1486
|
url: this.#connectUrl(pending),
|
|
1451
|
-
fallback: (0,
|
|
1487
|
+
fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
|
|
1452
1488
|
},
|
|
1453
1489
|
retry: (0, import_mcp_authority.operationRetryDescriptor)(invocation, invocation.input)
|
|
1454
1490
|
};
|
|
@@ -1515,7 +1551,7 @@ var RemoteTenantStore = class {
|
|
|
1515
1551
|
permissions: Buffer.from(JSON.stringify({
|
|
1516
1552
|
permissions: pending.permissions,
|
|
1517
1553
|
reason: [
|
|
1518
|
-
pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0,
|
|
1554
|
+
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.",
|
|
1519
1555
|
// Owner DIDs come from the verified OpenKey access token of the MCP
|
|
1520
1556
|
// client that created this link, never from the link itself. The
|
|
1521
1557
|
// callback refuses a signer outside them, so the approver isn't asked to check.
|