@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/http-cli.js
CHANGED
|
@@ -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 = {}) {
|
|
@@ -1907,18 +1908,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
|
|
|
1907
1908
|
result: toMcpJsonSchema(operation.result)
|
|
1908
1909
|
}
|
|
1909
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
|
+
}
|
|
1910
1940
|
function createJsonSchemaValidator() {
|
|
1911
1941
|
return new AjvJsonSchemaValidator();
|
|
1912
1942
|
}
|
|
1913
1943
|
function registerTinyCloudTools(server, selection, validator) {
|
|
1914
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));
|
|
1915
1946
|
for (const binding of bindings) {
|
|
1916
1947
|
const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
|
|
1917
1948
|
if (operation === void 0) {
|
|
1918
1949
|
throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
|
|
1919
1950
|
}
|
|
1951
|
+
const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
|
|
1952
|
+
const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
|
|
1920
1953
|
const inputSchema = fromJsonSchema(
|
|
1921
|
-
|
|
1954
|
+
inputJsonSchema,
|
|
1922
1955
|
validator
|
|
1923
1956
|
);
|
|
1924
1957
|
const outputSchema = fromJsonSchema(
|
|
@@ -1945,19 +1978,22 @@ function registerTinyCloudTools(server, selection, validator) {
|
|
|
1945
1978
|
const metrics = { replayedGrants: 0 };
|
|
1946
1979
|
let code = "INTERNAL_ERROR";
|
|
1947
1980
|
try {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1981
|
+
let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
|
|
1982
|
+
if (projected === void 0) {
|
|
1983
|
+
await selection.beforeOperation?.();
|
|
1984
|
+
const result = await invokeOperation2(
|
|
1985
|
+
binding.operationId,
|
|
1986
|
+
binding.operationVersion,
|
|
1987
|
+
invocationTargetForMcp(selection),
|
|
1988
|
+
input,
|
|
1989
|
+
metrics
|
|
1990
|
+
);
|
|
1991
|
+
projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
|
|
1992
|
+
operationId: binding.operationId,
|
|
1993
|
+
operationVersion: binding.operationVersion,
|
|
1994
|
+
input
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1961
1997
|
const response = toMcpToolResult(projected, bindings, {
|
|
1962
1998
|
surface: selection.surface === "local" ? "local" : "hosted",
|
|
1963
1999
|
readOnly: binding.readOnlyHint,
|
|
@@ -1989,7 +2025,7 @@ function outcomeCode(result) {
|
|
|
1989
2025
|
// package.json
|
|
1990
2026
|
var package_default = {
|
|
1991
2027
|
name: "@tinycloud/mcp",
|
|
1992
|
-
version: "0.10.0-beta.
|
|
2028
|
+
version: "0.10.0-beta.50",
|
|
1993
2029
|
description: "TinyCloud delegated operations MCP server",
|
|
1994
2030
|
keywords: [
|
|
1995
2031
|
"tinycloud",
|
|
@@ -2063,7 +2099,7 @@ var package_default = {
|
|
|
2063
2099
|
"@tinycloud/node-sdk": "3.12.0-beta.38",
|
|
2064
2100
|
"@tinycloud/sdk-core": "3.12.0-beta.37",
|
|
2065
2101
|
"@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
|
|
2066
|
-
"@tinycloud/operations": "0.9.0-beta.
|
|
2102
|
+
"@tinycloud/operations": "0.9.0-beta.45",
|
|
2067
2103
|
jose: "6.2.4"
|
|
2068
2104
|
},
|
|
2069
2105
|
devDependencies: {
|