@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.js
CHANGED
|
@@ -12,6 +12,7 @@ import { join } from "path";
|
|
|
12
12
|
import { fromJsonSchema } from "@modelcontextprotocol/server";
|
|
13
13
|
import { AjvJsonSchemaValidator } from "@modelcontextprotocol/server/validators/ajv";
|
|
14
14
|
import { invokeOperation } from "@tinycloud/operations";
|
|
15
|
+
import { TC_APPS_CATALOG_APPS } from "@tinycloud/operations/tc-apps";
|
|
15
16
|
|
|
16
17
|
// src/results.ts
|
|
17
18
|
function toMcpToolResult(result, bindings = [], options = {}) {
|
|
@@ -436,18 +437,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
|
436
437
|
result: toMcpJsonSchema(operation.result)
|
|
437
438
|
}
|
|
438
439
|
]));
|
|
440
|
+
var CATALOG_APP_TOOLS = [
|
|
441
|
+
"tinycloud_knowledge_list",
|
|
442
|
+
"tinycloud_knowledge_read",
|
|
443
|
+
"tinycloud_sql_query",
|
|
444
|
+
"tinycloud_sql_execute"
|
|
445
|
+
];
|
|
446
|
+
var APP_WITHOUT_CATALOG_APPS = "Pass one existing personal app id to request its task access together.";
|
|
447
|
+
function withPropertyDescription(schema, property, description) {
|
|
448
|
+
const properties = schema.properties;
|
|
449
|
+
const current = properties?.[property];
|
|
450
|
+
if (current === void 0) throw new Error(`Generated operations catalog has no ${property} input to describe.`);
|
|
451
|
+
return { ...schema, properties: { ...properties, [property]: { ...current, description } } };
|
|
452
|
+
}
|
|
453
|
+
function catalogAppRefusal(binding, profile, input) {
|
|
454
|
+
const app = typeof input === "object" && input !== null ? input.app : void 0;
|
|
455
|
+
if (typeof app !== "string" || !Object.hasOwn(TC_APPS_CATALOG_APPS, app)) return void 0;
|
|
456
|
+
const { title, link } = TC_APPS_CATALOG_APPS[app];
|
|
457
|
+
return {
|
|
458
|
+
status: "error",
|
|
459
|
+
operation: { operationId: binding.operationId, operationVersion: binding.operationVersion },
|
|
460
|
+
context: { profile, host: "unresolved", posture: "unauthenticated" },
|
|
461
|
+
error: {
|
|
462
|
+
code: "INPUT_INVALID",
|
|
463
|
+
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.`,
|
|
464
|
+
retryable: false,
|
|
465
|
+
details: { reason: "catalog_app_unavailable", app, link }
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
439
469
|
function createJsonSchemaValidator() {
|
|
440
470
|
return new AjvJsonSchemaValidator();
|
|
441
471
|
}
|
|
442
472
|
function registerTinyCloudTools(server, selection, validator) {
|
|
443
473
|
const bindings = TOOL_BINDINGS.filter((binding) => bindingSurfaces(binding).includes(selection.surface) && (selection.allowedTools === void 0 || selection.allowedTools.includes(binding.name)));
|
|
474
|
+
const servesCatalogApps = CATALOG_APP_TOOLS.every((name) => bindings.some((binding) => binding.name === name));
|
|
444
475
|
for (const binding of bindings) {
|
|
445
476
|
const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
|
|
446
477
|
if (operation === void 0) {
|
|
447
478
|
throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
|
|
448
479
|
}
|
|
480
|
+
const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
|
|
481
|
+
const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
|
|
449
482
|
const inputSchema = fromJsonSchema(
|
|
450
|
-
|
|
483
|
+
inputJsonSchema,
|
|
451
484
|
validator
|
|
452
485
|
);
|
|
453
486
|
const outputSchema = fromJsonSchema(
|
|
@@ -474,19 +507,22 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
474
507
|
const metrics = { replayedGrants: 0 };
|
|
475
508
|
let code = "INTERNAL_ERROR";
|
|
476
509
|
try {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
510
|
+
let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
|
|
511
|
+
if (projected === void 0) {
|
|
512
|
+
await selection.beforeOperation?.();
|
|
513
|
+
const result = await invokeOperation(
|
|
514
|
+
binding.operationId,
|
|
515
|
+
binding.operationVersion,
|
|
516
|
+
invocationTargetForMcp(selection),
|
|
517
|
+
input,
|
|
518
|
+
metrics
|
|
519
|
+
);
|
|
520
|
+
projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
|
|
521
|
+
operationId: binding.operationId,
|
|
522
|
+
operationVersion: binding.operationVersion,
|
|
523
|
+
input
|
|
524
|
+
});
|
|
525
|
+
}
|
|
490
526
|
const response = toMcpToolResult(projected, bindings, {
|
|
491
527
|
surface: selection.surface === "local" ? "local" : "hosted",
|
|
492
528
|
readOnly: binding.readOnlyHint,
|
|
@@ -518,7 +554,7 @@ function outcomeCode(result) {
|
|
|
518
554
|
// package.json
|
|
519
555
|
var package_default = {
|
|
520
556
|
name: "@tinycloud/mcp",
|
|
521
|
-
version: "0.10.0-beta.
|
|
557
|
+
version: "0.10.0-beta.50",
|
|
522
558
|
description: "TinyCloud delegated operations MCP server",
|
|
523
559
|
keywords: [
|
|
524
560
|
"tinycloud",
|
|
@@ -592,7 +628,7 @@ var package_default = {
|
|
|
592
628
|
"@tinycloud/node-sdk": "3.12.0-beta.38",
|
|
593
629
|
"@tinycloud/sdk-core": "3.12.0-beta.37",
|
|
594
630
|
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
595
|
-
"@tinycloud/operations": "0.9.0-beta.
|
|
631
|
+
"@tinycloud/operations": "0.9.0-beta.45",
|
|
596
632
|
jose: "6.2.4"
|
|
597
633
|
},
|
|
598
634
|
devDependencies: {
|