@cloudbase/cloudbase-mcp 2.0.6 → 2.1.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/dist/cli.cjs +266 -15
- package/dist/index.cjs +266 -15
- package/dist/index.js +273 -15
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -38331,7 +38331,7 @@ function registerSQLDatabaseTools(server) {
|
|
|
38331
38331
|
// executeReadOnlySQL
|
|
38332
38332
|
server.registerTool?.("executeReadOnlySQL", {
|
|
38333
38333
|
title: "Execute read-only SQL query",
|
|
38334
|
-
description: "Execute a read-only SQL query on the SQL database. Note: For per-user ACL, each table should contain a fixed `_openid` column that represents the user and is used for access control.",
|
|
38334
|
+
description: "Execute a read-only SQL query on the SQL database. Note: For per-user ACL, each table should contain a fixed `_openid` column defined as `_openid VARCHAR(64) DEFAULT '' NOT NULL` that represents the user and is used for access control.",
|
|
38335
38335
|
inputSchema: {
|
|
38336
38336
|
sql: zod_1.z.string().describe("SQL query statement (SELECT queries only)"),
|
|
38337
38337
|
},
|
|
@@ -38390,7 +38390,7 @@ function registerSQLDatabaseTools(server) {
|
|
|
38390
38390
|
// executeWriteSQL
|
|
38391
38391
|
server.registerTool?.("executeWriteSQL", {
|
|
38392
38392
|
title: "Execute write SQL statement",
|
|
38393
|
-
description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must**
|
|
38393
|
+
description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must** include a fixed `_openid` column defined as `_openid VARCHAR(64) DEFAULT '' NOT NULL` that represents the user and is used for access control.",
|
|
38394
38394
|
inputSchema: {
|
|
38395
38395
|
sql: zod_1.z
|
|
38396
38396
|
.string()
|
|
@@ -100307,12 +100307,14 @@ const rag_js_1 = __webpack_require__(64215);
|
|
|
100307
100307
|
const setup_js_1 = __webpack_require__(76556);
|
|
100308
100308
|
const storage_js_1 = __webpack_require__(94848);
|
|
100309
100309
|
// import { registerMiniprogramTools } from "./tools/miniprogram.js";
|
|
100310
|
+
const types_js_1 = __webpack_require__(1294);
|
|
100310
100311
|
const cloudrun_js_1 = __webpack_require__(35023);
|
|
100311
100312
|
const dataModel_js_1 = __webpack_require__(34052);
|
|
100312
100313
|
const gateway_js_1 = __webpack_require__(84319);
|
|
100313
100314
|
const invite_code_js_1 = __webpack_require__(44760);
|
|
100314
100315
|
const security_rule_js_1 = __webpack_require__(7862);
|
|
100315
100316
|
const cloud_mode_js_1 = __webpack_require__(89684);
|
|
100317
|
+
const logger_js_1 = __webpack_require__(13039);
|
|
100316
100318
|
const tool_wrapper_js_1 = __webpack_require__(71363);
|
|
100317
100319
|
// 默认插件列表
|
|
100318
100320
|
const DEFAULT_PLUGINS = [
|
|
@@ -100413,6 +100415,13 @@ async function createCloudBaseMcpServer(options) {
|
|
|
100413
100415
|
...(ide === "CodeBuddy" ? { logging: {} } : {}),
|
|
100414
100416
|
},
|
|
100415
100417
|
});
|
|
100418
|
+
// Only set logging handler if logging capability is declared
|
|
100419
|
+
if (ide === "CodeBuddy") {
|
|
100420
|
+
server.server.setRequestHandler(types_js_1.SetLevelRequestSchema, (request, extra) => {
|
|
100421
|
+
(0, logger_js_1.info)(`--- Logging level: ${request.params.level}`);
|
|
100422
|
+
return {};
|
|
100423
|
+
});
|
|
100424
|
+
}
|
|
100416
100425
|
// Store cloudBaseOptions in server instance for tools to access
|
|
100417
100426
|
if (cloudBaseOptions) {
|
|
100418
100427
|
server.cloudBaseOptions = cloudBaseOptions;
|
|
@@ -100443,10 +100452,10 @@ function getDefaultServer() {
|
|
|
100443
100452
|
}
|
|
100444
100453
|
var stdio_js_1 = __webpack_require__(6166);
|
|
100445
100454
|
Object.defineProperty(exports, "StdioServerTransport", ({ enumerable: true, get: function () { return stdio_js_1.StdioServerTransport; } }));
|
|
100446
|
-
var
|
|
100447
|
-
Object.defineProperty(exports, "error", ({ enumerable: true, get: function () { return
|
|
100448
|
-
Object.defineProperty(exports, "info", ({ enumerable: true, get: function () { return
|
|
100449
|
-
Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return
|
|
100455
|
+
var logger_js_2 = __webpack_require__(13039);
|
|
100456
|
+
Object.defineProperty(exports, "error", ({ enumerable: true, get: function () { return logger_js_2.error; } }));
|
|
100457
|
+
Object.defineProperty(exports, "info", ({ enumerable: true, get: function () { return logger_js_2.info; } }));
|
|
100458
|
+
Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return logger_js_2.warn; } }));
|
|
100450
100459
|
var telemetry_js_1 = __webpack_require__(45880);
|
|
100451
100460
|
Object.defineProperty(exports, "reportToolCall", ({ enumerable: true, get: function () { return telemetry_js_1.reportToolCall; } }));
|
|
100452
100461
|
Object.defineProperty(exports, "reportToolkitLifecycle", ({ enumerable: true, get: function () { return telemetry_js_1.reportToolkitLifecycle; } }));
|
|
@@ -101892,6 +101901,53 @@ class AsyncReader extends reader_1.default {
|
|
|
101892
101901
|
exports["default"] = AsyncReader;
|
|
101893
101902
|
|
|
101894
101903
|
|
|
101904
|
+
/***/ }),
|
|
101905
|
+
|
|
101906
|
+
/***/ 32720:
|
|
101907
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
101908
|
+
|
|
101909
|
+
"use strict";
|
|
101910
|
+
|
|
101911
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
101912
|
+
exports.sendDeployNotification = sendDeployNotification;
|
|
101913
|
+
const logger_js_1 = __webpack_require__(13039);
|
|
101914
|
+
/**
|
|
101915
|
+
* Send deployment notification to CodeBuddy IDE
|
|
101916
|
+
* @param server ExtendedMcpServer instance
|
|
101917
|
+
* @param notificationData Deployment notification data
|
|
101918
|
+
*/
|
|
101919
|
+
async function sendDeployNotification(server, notificationData) {
|
|
101920
|
+
// Check if current IDE is CodeBuddy (prefer server.ide, fallback to environment variable)
|
|
101921
|
+
const currentIde = server.ide || process.env.INTEGRATION_IDE;
|
|
101922
|
+
if (currentIde !== 'CodeBuddy' || !server.server) {
|
|
101923
|
+
// Not CodeBuddy IDE, skip notification
|
|
101924
|
+
return;
|
|
101925
|
+
}
|
|
101926
|
+
try {
|
|
101927
|
+
// Send notification using sendLoggingMessage
|
|
101928
|
+
server.server.sendLoggingMessage({
|
|
101929
|
+
level: "notice",
|
|
101930
|
+
data: {
|
|
101931
|
+
type: "tcb",
|
|
101932
|
+
event: "deploy",
|
|
101933
|
+
data: {
|
|
101934
|
+
type: notificationData.deployType, // "hosting" or "cloudrun"
|
|
101935
|
+
url: notificationData.url,
|
|
101936
|
+
projectId: notificationData.projectId,
|
|
101937
|
+
projectName: notificationData.projectName,
|
|
101938
|
+
consoleUrl: notificationData.consoleUrl
|
|
101939
|
+
}
|
|
101940
|
+
}
|
|
101941
|
+
});
|
|
101942
|
+
(0, logger_js_1.info)(`CodeBuddy IDE: 已发送部署通知 - ${notificationData.deployType} - ${notificationData.url}`);
|
|
101943
|
+
}
|
|
101944
|
+
catch (err) {
|
|
101945
|
+
// Log error but don't throw - notification failure should not affect deployment flow
|
|
101946
|
+
(0, logger_js_1.error)(`Failed to send deployment notification: ${err instanceof Error ? err.message : err}`, err);
|
|
101947
|
+
}
|
|
101948
|
+
}
|
|
101949
|
+
|
|
101950
|
+
|
|
101895
101951
|
/***/ }),
|
|
101896
101952
|
|
|
101897
101953
|
/***/ 32923:
|
|
@@ -110205,6 +110261,7 @@ const fs_1 = __importDefault(__webpack_require__(29021));
|
|
|
110205
110261
|
const path_1 = __importDefault(__webpack_require__(39902));
|
|
110206
110262
|
const zod_1 = __webpack_require__(21614);
|
|
110207
110263
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
110264
|
+
const notification_js_1 = __webpack_require__(32720);
|
|
110208
110265
|
// CloudRun service types
|
|
110209
110266
|
exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
110210
110267
|
// CloudRun access types
|
|
@@ -110709,6 +110766,58 @@ for await (let x of res.textStream) {
|
|
|
110709
110766
|
catch (error) {
|
|
110710
110767
|
// Ignore cloudbaserc.json creation errors
|
|
110711
110768
|
}
|
|
110769
|
+
// Send deployment notification to CodeBuddy IDE
|
|
110770
|
+
try {
|
|
110771
|
+
// Query service details to get access URL
|
|
110772
|
+
let serviceUrl = "";
|
|
110773
|
+
try {
|
|
110774
|
+
const serviceDetails = await cloudrunService.detail({ serverName: input.serverName });
|
|
110775
|
+
// Extract access URL from service details
|
|
110776
|
+
// Priority: DefaultDomainName > CustomDomainName > PublicDomain > InternalDomain
|
|
110777
|
+
const details = serviceDetails; // Use any to access dynamic properties
|
|
110778
|
+
if (details?.BaseInfo?.DefaultDomainName) {
|
|
110779
|
+
// DefaultDomainName is already a complete URL (e.g., https://...)
|
|
110780
|
+
serviceUrl = details.BaseInfo.DefaultDomainName;
|
|
110781
|
+
}
|
|
110782
|
+
else if (details?.BaseInfo?.CustomDomainName) {
|
|
110783
|
+
// CustomDomainName might be a domain without protocol
|
|
110784
|
+
const customDomain = details.BaseInfo.CustomDomainName;
|
|
110785
|
+
serviceUrl = customDomain.startsWith('http') ? customDomain : `https://${customDomain}`;
|
|
110786
|
+
}
|
|
110787
|
+
else if (details?.BaseInfo?.PublicDomain) {
|
|
110788
|
+
serviceUrl = `https://${details.BaseInfo.PublicDomain}`;
|
|
110789
|
+
}
|
|
110790
|
+
else if (details?.BaseInfo?.InternalDomain) {
|
|
110791
|
+
serviceUrl = `https://${details.BaseInfo.InternalDomain}`;
|
|
110792
|
+
}
|
|
110793
|
+
else if (details?.AccessInfo?.PublicDomain) {
|
|
110794
|
+
serviceUrl = `https://${details.AccessInfo.PublicDomain}`;
|
|
110795
|
+
}
|
|
110796
|
+
else {
|
|
110797
|
+
serviceUrl = ""; // URL not available
|
|
110798
|
+
}
|
|
110799
|
+
}
|
|
110800
|
+
catch (detailErr) {
|
|
110801
|
+
// If query fails, continue with empty URL
|
|
110802
|
+
serviceUrl = "";
|
|
110803
|
+
}
|
|
110804
|
+
// Extract project name from targetPath
|
|
110805
|
+
const projectName = path_1.default.basename(targetPath);
|
|
110806
|
+
// Build console URL
|
|
110807
|
+
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
|
|
110808
|
+
// Send notification
|
|
110809
|
+
await (0, notification_js_1.sendDeployNotification)(server, {
|
|
110810
|
+
deployType: 'cloudrun',
|
|
110811
|
+
url: serviceUrl,
|
|
110812
|
+
projectId: currentEnvId,
|
|
110813
|
+
projectName: projectName,
|
|
110814
|
+
consoleUrl: consoleUrl
|
|
110815
|
+
});
|
|
110816
|
+
}
|
|
110817
|
+
catch (notifyErr) {
|
|
110818
|
+
// Notification failure should not affect deployment flow
|
|
110819
|
+
// Error is already logged in sendDeployNotification
|
|
110820
|
+
}
|
|
110712
110821
|
return {
|
|
110713
110822
|
content: [
|
|
110714
110823
|
{
|
|
@@ -114885,14 +114994,20 @@ module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
|
|
|
114885
114994
|
/***/ }),
|
|
114886
114995
|
|
|
114887
114996
|
/***/ 37279:
|
|
114888
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
114997
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
114889
114998
|
|
|
114890
114999
|
"use strict";
|
|
114891
115000
|
|
|
115001
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
115002
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
115003
|
+
};
|
|
114892
115004
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
114893
115005
|
exports.registerHostingTools = registerHostingTools;
|
|
115006
|
+
const fs_1 = __importDefault(__webpack_require__(29021));
|
|
115007
|
+
const path_1 = __importDefault(__webpack_require__(39902));
|
|
114894
115008
|
const zod_1 = __webpack_require__(21614);
|
|
114895
115009
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
115010
|
+
const notification_js_1 = __webpack_require__(32720);
|
|
114896
115011
|
function registerHostingTools(server) {
|
|
114897
115012
|
// 获取 cloudBaseOptions,如果没有则为 undefined
|
|
114898
115013
|
const cloudBaseOptions = server.cloudBaseOptions;
|
|
@@ -114929,6 +115044,43 @@ function registerHostingTools(server) {
|
|
|
114929
115044
|
// 获取环境信息
|
|
114930
115045
|
const envInfo = await cloudbase.env.getEnvInfo();
|
|
114931
115046
|
const staticDomain = envInfo.EnvInfo?.StaticStorages?.[0]?.StaticDomain;
|
|
115047
|
+
const accessUrl = staticDomain ? `https://${staticDomain}/${cloudPath || ''}` : "";
|
|
115048
|
+
// Send deployment notification to CodeBuddy IDE
|
|
115049
|
+
try {
|
|
115050
|
+
const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
|
|
115051
|
+
// Extract project name from localPath
|
|
115052
|
+
let projectName = "unknown";
|
|
115053
|
+
if (localPath) {
|
|
115054
|
+
try {
|
|
115055
|
+
// If localPath is a file, get parent directory name; if it's a directory, get directory name
|
|
115056
|
+
const stats = fs_1.default.statSync(localPath);
|
|
115057
|
+
if (stats.isFile()) {
|
|
115058
|
+
projectName = path_1.default.basename(path_1.default.dirname(localPath));
|
|
115059
|
+
}
|
|
115060
|
+
else {
|
|
115061
|
+
projectName = path_1.default.basename(localPath);
|
|
115062
|
+
}
|
|
115063
|
+
}
|
|
115064
|
+
catch (statErr) {
|
|
115065
|
+
// If stat fails, try to extract from path directly
|
|
115066
|
+
projectName = path_1.default.basename(localPath);
|
|
115067
|
+
}
|
|
115068
|
+
}
|
|
115069
|
+
// Build console URL
|
|
115070
|
+
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${envId}#/static-hosting`;
|
|
115071
|
+
// Send notification
|
|
115072
|
+
await (0, notification_js_1.sendDeployNotification)(server, {
|
|
115073
|
+
deployType: 'hosting',
|
|
115074
|
+
url: accessUrl,
|
|
115075
|
+
projectId: envId,
|
|
115076
|
+
projectName: projectName,
|
|
115077
|
+
consoleUrl: consoleUrl
|
|
115078
|
+
});
|
|
115079
|
+
}
|
|
115080
|
+
catch (notifyErr) {
|
|
115081
|
+
// Notification failure should not affect deployment flow
|
|
115082
|
+
// Error is already logged in sendDeployNotification
|
|
115083
|
+
}
|
|
114932
115084
|
return {
|
|
114933
115085
|
content: [
|
|
114934
115086
|
{
|
|
@@ -114937,7 +115089,7 @@ function registerHostingTools(server) {
|
|
|
114937
115089
|
...result,
|
|
114938
115090
|
staticDomain,
|
|
114939
115091
|
message: "文件上传成功",
|
|
114940
|
-
accessUrl:
|
|
115092
|
+
accessUrl: accessUrl
|
|
114941
115093
|
}, null, 2)
|
|
114942
115094
|
}
|
|
114943
115095
|
]
|
|
@@ -134865,7 +135017,7 @@ class TelemetryReporter {
|
|
|
134865
135017
|
const nodeVersion = process.version; // Node.js版本
|
|
134866
135018
|
const arch = os_1.default.arch(); // 系统架构
|
|
134867
135019
|
// 从构建时注入的版本号获取MCP版本信息
|
|
134868
|
-
const mcpVersion = process.env.npm_package_version || "2.0
|
|
135020
|
+
const mcpVersion = process.env.npm_package_version || "2.1.0" || 0;
|
|
134869
135021
|
return {
|
|
134870
135022
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
134871
135023
|
deviceId: this.deviceId,
|
|
@@ -185531,6 +185683,7 @@ async function registerRagTools(server) {
|
|
|
185531
185683
|
}
|
|
185532
185684
|
});
|
|
185533
185685
|
let skills = [];
|
|
185686
|
+
let openapis = [];
|
|
185534
185687
|
// 知识库检索
|
|
185535
185688
|
try {
|
|
185536
185689
|
skills = await prepareKnowledgeBaseWebTemplate();
|
|
@@ -185540,22 +185693,40 @@ async function registerRagTools(server) {
|
|
|
185540
185693
|
error,
|
|
185541
185694
|
});
|
|
185542
185695
|
}
|
|
185696
|
+
// OpenAPI 文档准备
|
|
185697
|
+
try {
|
|
185698
|
+
openapis = await prepareOpenAPIDocs();
|
|
185699
|
+
}
|
|
185700
|
+
catch (error) {
|
|
185701
|
+
(0, logger_js_1.warn)("[searchKnowledgeBase] Failed to prepare OpenAPI docs", {
|
|
185702
|
+
error,
|
|
185703
|
+
});
|
|
185704
|
+
}
|
|
185543
185705
|
server.registerTool?.("searchKnowledgeBase", {
|
|
185544
185706
|
title: "云开发知识库检索",
|
|
185545
|
-
description: `云开发知识库智能检索工具,支持向量查询 (vector)
|
|
185707
|
+
description: `云开发知识库智能检索工具,支持向量查询 (vector)、固定文档 (doc) 和 OpenAPI 文档 (openapi) 查询。
|
|
185546
185708
|
|
|
185547
|
-
强烈推荐始终优先使用固定文档 (doc) 模式进行检索,仅当固定文档无法覆盖你的问题时,再使用向量查询 (vector) 模式。
|
|
185709
|
+
强烈推荐始终优先使用固定文档 (doc) 或 OpenAPI 文档 (openapi) 模式进行检索,仅当固定文档无法覆盖你的问题时,再使用向量查询 (vector) 模式。
|
|
185548
185710
|
|
|
185549
185711
|
固定文档 (doc) 查询当前支持 ${skills.length} 个固定文档,分别是:
|
|
185550
185712
|
${skills
|
|
185551
185713
|
.map((skill) => `文档名:${path.basename(path.dirname(skill.absolutePath))} 文档介绍:${skill.description}`)
|
|
185714
|
+
.join("\n")}
|
|
185715
|
+
|
|
185716
|
+
OpenAPI 文档 (openapi) 查询当前支持 ${openapis.length} 个 API 文档,分别是:
|
|
185717
|
+
${openapis
|
|
185718
|
+
.map((api) => `API名:${api.name} API介绍:${api.description}`)
|
|
185552
185719
|
.join("\n")}`,
|
|
185553
185720
|
inputSchema: {
|
|
185554
|
-
mode: zod_1.z.enum(["vector", "doc"]),
|
|
185721
|
+
mode: zod_1.z.enum(["vector", "doc", "openapi"]),
|
|
185555
185722
|
docName: zod_1.z
|
|
185556
185723
|
.enum(skills.map((skill) => path.basename(path.dirname(skill.absolutePath))))
|
|
185557
185724
|
.optional()
|
|
185558
185725
|
.describe("mode=doc 时指定。文档名称。"),
|
|
185726
|
+
apiName: zod_1.z
|
|
185727
|
+
.enum(openapis.map((api) => api.name))
|
|
185728
|
+
.optional()
|
|
185729
|
+
.describe("mode=openapi 时指定。API 名称。"),
|
|
185559
185730
|
threshold: zod_1.z
|
|
185560
185731
|
.number()
|
|
185561
185732
|
.default(0.5)
|
|
@@ -185585,7 +185756,7 @@ async function registerRagTools(server) {
|
|
|
185585
185756
|
openWorldHint: true,
|
|
185586
185757
|
category: "rag",
|
|
185587
185758
|
},
|
|
185588
|
-
}, async ({ id, content, options: { chunkExpand = [3, 3] } = {}, limit = 5, threshold = 0.5, mode, docName, }) => {
|
|
185759
|
+
}, async ({ id, content, options: { chunkExpand = [3, 3] } = {}, limit = 5, threshold = 0.5, mode, docName, apiName, }) => {
|
|
185589
185760
|
if (mode === "doc") {
|
|
185590
185761
|
const absolutePath = skills.find((skill) => skill.absolutePath.includes(docName)).absolutePath;
|
|
185591
185762
|
return {
|
|
@@ -185597,6 +185768,27 @@ async function registerRagTools(server) {
|
|
|
185597
185768
|
],
|
|
185598
185769
|
};
|
|
185599
185770
|
}
|
|
185771
|
+
if (mode === "openapi") {
|
|
185772
|
+
const api = openapis.find((api) => api.name === apiName);
|
|
185773
|
+
if (!api) {
|
|
185774
|
+
return {
|
|
185775
|
+
content: [
|
|
185776
|
+
{
|
|
185777
|
+
type: "text",
|
|
185778
|
+
text: `OpenAPI document "${apiName}" not found. Available APIs: ${openapis.map((a) => a.name).join(", ")}`,
|
|
185779
|
+
},
|
|
185780
|
+
],
|
|
185781
|
+
};
|
|
185782
|
+
}
|
|
185783
|
+
return {
|
|
185784
|
+
content: [
|
|
185785
|
+
{
|
|
185786
|
+
type: "text",
|
|
185787
|
+
text: `OpenAPI document: ${api.name}\nDescription: ${api.description}\nPath: ${api.absolutePath}\n\n${(await fs.readFile(api.absolutePath)).toString()}`,
|
|
185788
|
+
},
|
|
185789
|
+
],
|
|
185790
|
+
};
|
|
185791
|
+
}
|
|
185600
185792
|
// 枚举到后端 id 映射
|
|
185601
185793
|
const backendId = KnowledgeBaseIdMap[id] || id;
|
|
185602
185794
|
const signInRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/auth/v1/signin/anonymously", {
|
|
@@ -185673,6 +185865,65 @@ function extractDescriptionFromFrontMatter(content) {
|
|
|
185673
185865
|
.match(/^(?:decsription|description)\s*:\s*(.*)$/m);
|
|
185674
185866
|
return match ? match[1].trim() : null;
|
|
185675
185867
|
}
|
|
185868
|
+
// OpenAPI 文档 URL 列表
|
|
185869
|
+
const OPENAPI_SOURCES = [
|
|
185870
|
+
{
|
|
185871
|
+
name: "mysqldb",
|
|
185872
|
+
description: "MySQL RESTful API - 云开发 MySQL 数据库 HTTP API",
|
|
185873
|
+
url: "https://docs.cloudbase.net/openapi/mysqldb.v1.openapi.yaml",
|
|
185874
|
+
},
|
|
185875
|
+
{
|
|
185876
|
+
name: "functions",
|
|
185877
|
+
description: "Cloud Functions API - 云函数 HTTP API",
|
|
185878
|
+
url: "https://docs.cloudbase.net/openapi/functions.v1.openapi.yaml",
|
|
185879
|
+
},
|
|
185880
|
+
{
|
|
185881
|
+
name: "auth",
|
|
185882
|
+
description: "Authentication API - 身份认证 HTTP API",
|
|
185883
|
+
url: "https://docs.cloudbase.net/openapi/auth.v1.openapi.yaml",
|
|
185884
|
+
},
|
|
185885
|
+
{
|
|
185886
|
+
name: "cloudrun",
|
|
185887
|
+
description: "CloudRun API - 云托管服务 HTTP API",
|
|
185888
|
+
url: "https://docs.cloudbase.net/openapi/cloudrun.v1.openapi.yaml",
|
|
185889
|
+
},
|
|
185890
|
+
{
|
|
185891
|
+
name: "storage",
|
|
185892
|
+
description: "Storage API - 云存储 HTTP API",
|
|
185893
|
+
url: "https://docs.cloudbase.net/openapi/storage.v1.openapi.yaml",
|
|
185894
|
+
},
|
|
185895
|
+
];
|
|
185896
|
+
// 下载并准备 OpenAPI 文档
|
|
185897
|
+
async function prepareOpenAPIDocs() {
|
|
185898
|
+
const baseDir = path.join(os.homedir(), ".cloudbase-mcp", "openapi");
|
|
185899
|
+
await fs.mkdir(baseDir, { recursive: true });
|
|
185900
|
+
const results = [];
|
|
185901
|
+
await Promise.all(OPENAPI_SOURCES.map(async (source) => {
|
|
185902
|
+
try {
|
|
185903
|
+
const response = await fetch(source.url);
|
|
185904
|
+
if (!response.ok) {
|
|
185905
|
+
(0, logger_js_1.warn)(`[prepareOpenAPIDocs] Failed to download ${source.name}`, {
|
|
185906
|
+
status: response.status,
|
|
185907
|
+
});
|
|
185908
|
+
return;
|
|
185909
|
+
}
|
|
185910
|
+
const content = await response.text();
|
|
185911
|
+
const filePath = path.join(baseDir, `${source.name}.openapi.yaml`);
|
|
185912
|
+
await fs.writeFile(filePath, content, "utf8");
|
|
185913
|
+
results.push({
|
|
185914
|
+
name: source.name,
|
|
185915
|
+
description: source.description,
|
|
185916
|
+
absolutePath: filePath,
|
|
185917
|
+
});
|
|
185918
|
+
}
|
|
185919
|
+
catch (error) {
|
|
185920
|
+
(0, logger_js_1.warn)(`[prepareOpenAPIDocs] Failed to download ${source.name}`, {
|
|
185921
|
+
error,
|
|
185922
|
+
});
|
|
185923
|
+
}
|
|
185924
|
+
}));
|
|
185925
|
+
return results;
|
|
185926
|
+
}
|
|
185676
185927
|
async function collectSkillDescriptions(rootDir) {
|
|
185677
185928
|
const result = [];
|
|
185678
185929
|
async function walk(dir) {
|
|
@@ -200510,7 +200761,7 @@ ${envIdSection}
|
|
|
200510
200761
|
## 环境信息
|
|
200511
200762
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
200512
200763
|
- Node.js版本: ${process.version}
|
|
200513
|
-
- MCP 版本:${process.env.npm_package_version || "2.0
|
|
200764
|
+
- MCP 版本:${process.env.npm_package_version || "2.1.0" || 0}
|
|
200514
200765
|
- 系统架构: ${os_1.default.arch()}
|
|
200515
200766
|
- 时间: ${new Date().toISOString()}
|
|
200516
200767
|
- 请求ID: ${requestId}
|
|
@@ -215102,7 +215353,7 @@ function registerSetupTools(server) {
|
|
|
215102
215353
|
title: "下载项目模板",
|
|
215103
215354
|
description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
|
|
215104
215355
|
|
|
215105
|
-
**CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.0
|
|
215356
|
+
**CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.1.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
215106
215357
|
inputSchema: {
|
|
215107
215358
|
template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
|
|
215108
215359
|
ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
|