@cloudbase/cloudbase-mcp 2.0.5 → 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/README.md +1 -5
- package/dist/cli.cjs +281 -15
- package/dist/index.cjs +281 -15
- package/dist/index.js +288 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__cloudbase_cals_lib_cjs_utils_mermaid_data
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_ws__ from "ws";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_winston_daily_rotate_file_69928d76__ from "winston-daily-rotate-file";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_winston__ from "winston";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_types_js_70eb1363__ from "@modelcontextprotocol/sdk/types.js";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_net__ from "net";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_stdio_js_25848778__ from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -38,6 +39,7 @@ const fs_1 = __importDefault(__webpack_require__(421));
|
|
|
38
39
|
const path_1 = __importDefault(__webpack_require__(521));
|
|
39
40
|
const zod_1 = __webpack_require__(971);
|
|
40
41
|
const cloudbase_manager_js_1 = __webpack_require__(431);
|
|
42
|
+
const notification_js_1 = __webpack_require__(720);
|
|
41
43
|
// CloudRun service types
|
|
42
44
|
exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
43
45
|
// CloudRun access types
|
|
@@ -542,6 +544,58 @@ for await (let x of res.textStream) {
|
|
|
542
544
|
catch (error) {
|
|
543
545
|
// Ignore cloudbaserc.json creation errors
|
|
544
546
|
}
|
|
547
|
+
// Send deployment notification to CodeBuddy IDE
|
|
548
|
+
try {
|
|
549
|
+
// Query service details to get access URL
|
|
550
|
+
let serviceUrl = "";
|
|
551
|
+
try {
|
|
552
|
+
const serviceDetails = await cloudrunService.detail({ serverName: input.serverName });
|
|
553
|
+
// Extract access URL from service details
|
|
554
|
+
// Priority: DefaultDomainName > CustomDomainName > PublicDomain > InternalDomain
|
|
555
|
+
const details = serviceDetails; // Use any to access dynamic properties
|
|
556
|
+
if (details?.BaseInfo?.DefaultDomainName) {
|
|
557
|
+
// DefaultDomainName is already a complete URL (e.g., https://...)
|
|
558
|
+
serviceUrl = details.BaseInfo.DefaultDomainName;
|
|
559
|
+
}
|
|
560
|
+
else if (details?.BaseInfo?.CustomDomainName) {
|
|
561
|
+
// CustomDomainName might be a domain without protocol
|
|
562
|
+
const customDomain = details.BaseInfo.CustomDomainName;
|
|
563
|
+
serviceUrl = customDomain.startsWith('http') ? customDomain : `https://${customDomain}`;
|
|
564
|
+
}
|
|
565
|
+
else if (details?.BaseInfo?.PublicDomain) {
|
|
566
|
+
serviceUrl = `https://${details.BaseInfo.PublicDomain}`;
|
|
567
|
+
}
|
|
568
|
+
else if (details?.BaseInfo?.InternalDomain) {
|
|
569
|
+
serviceUrl = `https://${details.BaseInfo.InternalDomain}`;
|
|
570
|
+
}
|
|
571
|
+
else if (details?.AccessInfo?.PublicDomain) {
|
|
572
|
+
serviceUrl = `https://${details.AccessInfo.PublicDomain}`;
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
serviceUrl = ""; // URL not available
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
catch (detailErr) {
|
|
579
|
+
// If query fails, continue with empty URL
|
|
580
|
+
serviceUrl = "";
|
|
581
|
+
}
|
|
582
|
+
// Extract project name from targetPath
|
|
583
|
+
const projectName = path_1.default.basename(targetPath);
|
|
584
|
+
// Build console URL
|
|
585
|
+
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
|
|
586
|
+
// Send notification
|
|
587
|
+
await (0, notification_js_1.sendDeployNotification)(server, {
|
|
588
|
+
deployType: 'cloudrun',
|
|
589
|
+
url: serviceUrl,
|
|
590
|
+
projectId: currentEnvId,
|
|
591
|
+
projectName: projectName,
|
|
592
|
+
consoleUrl: consoleUrl
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
catch (notifyErr) {
|
|
596
|
+
// Notification failure should not affect deployment flow
|
|
597
|
+
// Error is already logged in sendDeployNotification
|
|
598
|
+
}
|
|
545
599
|
return {
|
|
546
600
|
content: [
|
|
547
601
|
{
|
|
@@ -2664,6 +2718,7 @@ async function registerRagTools(server) {
|
|
|
2664
2718
|
}
|
|
2665
2719
|
});
|
|
2666
2720
|
let skills = [];
|
|
2721
|
+
let openapis = [];
|
|
2667
2722
|
// 知识库检索
|
|
2668
2723
|
try {
|
|
2669
2724
|
skills = await prepareKnowledgeBaseWebTemplate();
|
|
@@ -2673,22 +2728,40 @@ async function registerRagTools(server) {
|
|
|
2673
2728
|
error,
|
|
2674
2729
|
});
|
|
2675
2730
|
}
|
|
2731
|
+
// OpenAPI 文档准备
|
|
2732
|
+
try {
|
|
2733
|
+
openapis = await prepareOpenAPIDocs();
|
|
2734
|
+
}
|
|
2735
|
+
catch (error) {
|
|
2736
|
+
(0, logger_js_1.warn)("[searchKnowledgeBase] Failed to prepare OpenAPI docs", {
|
|
2737
|
+
error,
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2676
2740
|
server.registerTool?.("searchKnowledgeBase", {
|
|
2677
2741
|
title: "云开发知识库检索",
|
|
2678
|
-
description: `云开发知识库智能检索工具,支持向量查询 (vector)
|
|
2742
|
+
description: `云开发知识库智能检索工具,支持向量查询 (vector)、固定文档 (doc) 和 OpenAPI 文档 (openapi) 查询。
|
|
2679
2743
|
|
|
2680
|
-
强烈推荐始终优先使用固定文档 (doc) 模式进行检索,仅当固定文档无法覆盖你的问题时,再使用向量查询 (vector) 模式。
|
|
2744
|
+
强烈推荐始终优先使用固定文档 (doc) 或 OpenAPI 文档 (openapi) 模式进行检索,仅当固定文档无法覆盖你的问题时,再使用向量查询 (vector) 模式。
|
|
2681
2745
|
|
|
2682
2746
|
固定文档 (doc) 查询当前支持 ${skills.length} 个固定文档,分别是:
|
|
2683
2747
|
${skills
|
|
2684
2748
|
.map((skill) => `文档名:${path.basename(path.dirname(skill.absolutePath))} 文档介绍:${skill.description}`)
|
|
2749
|
+
.join("\n")}
|
|
2750
|
+
|
|
2751
|
+
OpenAPI 文档 (openapi) 查询当前支持 ${openapis.length} 个 API 文档,分别是:
|
|
2752
|
+
${openapis
|
|
2753
|
+
.map((api) => `API名:${api.name} API介绍:${api.description}`)
|
|
2685
2754
|
.join("\n")}`,
|
|
2686
2755
|
inputSchema: {
|
|
2687
|
-
mode: zod_1.z.enum(["vector", "doc"]),
|
|
2756
|
+
mode: zod_1.z.enum(["vector", "doc", "openapi"]),
|
|
2688
2757
|
docName: zod_1.z
|
|
2689
2758
|
.enum(skills.map((skill) => path.basename(path.dirname(skill.absolutePath))))
|
|
2690
2759
|
.optional()
|
|
2691
2760
|
.describe("mode=doc 时指定。文档名称。"),
|
|
2761
|
+
apiName: zod_1.z
|
|
2762
|
+
.enum(openapis.map((api) => api.name))
|
|
2763
|
+
.optional()
|
|
2764
|
+
.describe("mode=openapi 时指定。API 名称。"),
|
|
2692
2765
|
threshold: zod_1.z
|
|
2693
2766
|
.number()
|
|
2694
2767
|
.default(0.5)
|
|
@@ -2718,7 +2791,7 @@ async function registerRagTools(server) {
|
|
|
2718
2791
|
openWorldHint: true,
|
|
2719
2792
|
category: "rag",
|
|
2720
2793
|
},
|
|
2721
|
-
}, async ({ id, content, options: { chunkExpand = [3, 3] } = {}, limit = 5, threshold = 0.5, mode, docName, }) => {
|
|
2794
|
+
}, async ({ id, content, options: { chunkExpand = [3, 3] } = {}, limit = 5, threshold = 0.5, mode, docName, apiName, }) => {
|
|
2722
2795
|
if (mode === "doc") {
|
|
2723
2796
|
const absolutePath = skills.find((skill) => skill.absolutePath.includes(docName)).absolutePath;
|
|
2724
2797
|
return {
|
|
@@ -2730,6 +2803,27 @@ async function registerRagTools(server) {
|
|
|
2730
2803
|
],
|
|
2731
2804
|
};
|
|
2732
2805
|
}
|
|
2806
|
+
if (mode === "openapi") {
|
|
2807
|
+
const api = openapis.find((api) => api.name === apiName);
|
|
2808
|
+
if (!api) {
|
|
2809
|
+
return {
|
|
2810
|
+
content: [
|
|
2811
|
+
{
|
|
2812
|
+
type: "text",
|
|
2813
|
+
text: `OpenAPI document "${apiName}" not found. Available APIs: ${openapis.map((a) => a.name).join(", ")}`,
|
|
2814
|
+
},
|
|
2815
|
+
],
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
return {
|
|
2819
|
+
content: [
|
|
2820
|
+
{
|
|
2821
|
+
type: "text",
|
|
2822
|
+
text: `OpenAPI document: ${api.name}\nDescription: ${api.description}\nPath: ${api.absolutePath}\n\n${(await fs.readFile(api.absolutePath)).toString()}`,
|
|
2823
|
+
},
|
|
2824
|
+
],
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2733
2827
|
// 枚举到后端 id 映射
|
|
2734
2828
|
const backendId = KnowledgeBaseIdMap[id] || id;
|
|
2735
2829
|
const signInRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/auth/v1/signin/anonymously", {
|
|
@@ -2806,6 +2900,65 @@ function extractDescriptionFromFrontMatter(content) {
|
|
|
2806
2900
|
.match(/^(?:decsription|description)\s*:\s*(.*)$/m);
|
|
2807
2901
|
return match ? match[1].trim() : null;
|
|
2808
2902
|
}
|
|
2903
|
+
// OpenAPI 文档 URL 列表
|
|
2904
|
+
const OPENAPI_SOURCES = [
|
|
2905
|
+
{
|
|
2906
|
+
name: "mysqldb",
|
|
2907
|
+
description: "MySQL RESTful API - 云开发 MySQL 数据库 HTTP API",
|
|
2908
|
+
url: "https://docs.cloudbase.net/openapi/mysqldb.v1.openapi.yaml",
|
|
2909
|
+
},
|
|
2910
|
+
{
|
|
2911
|
+
name: "functions",
|
|
2912
|
+
description: "Cloud Functions API - 云函数 HTTP API",
|
|
2913
|
+
url: "https://docs.cloudbase.net/openapi/functions.v1.openapi.yaml",
|
|
2914
|
+
},
|
|
2915
|
+
{
|
|
2916
|
+
name: "auth",
|
|
2917
|
+
description: "Authentication API - 身份认证 HTTP API",
|
|
2918
|
+
url: "https://docs.cloudbase.net/openapi/auth.v1.openapi.yaml",
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
name: "cloudrun",
|
|
2922
|
+
description: "CloudRun API - 云托管服务 HTTP API",
|
|
2923
|
+
url: "https://docs.cloudbase.net/openapi/cloudrun.v1.openapi.yaml",
|
|
2924
|
+
},
|
|
2925
|
+
{
|
|
2926
|
+
name: "storage",
|
|
2927
|
+
description: "Storage API - 云存储 HTTP API",
|
|
2928
|
+
url: "https://docs.cloudbase.net/openapi/storage.v1.openapi.yaml",
|
|
2929
|
+
},
|
|
2930
|
+
];
|
|
2931
|
+
// 下载并准备 OpenAPI 文档
|
|
2932
|
+
async function prepareOpenAPIDocs() {
|
|
2933
|
+
const baseDir = path.join(os.homedir(), ".cloudbase-mcp", "openapi");
|
|
2934
|
+
await fs.mkdir(baseDir, { recursive: true });
|
|
2935
|
+
const results = [];
|
|
2936
|
+
await Promise.all(OPENAPI_SOURCES.map(async (source) => {
|
|
2937
|
+
try {
|
|
2938
|
+
const response = await fetch(source.url);
|
|
2939
|
+
if (!response.ok) {
|
|
2940
|
+
(0, logger_js_1.warn)(`[prepareOpenAPIDocs] Failed to download ${source.name}`, {
|
|
2941
|
+
status: response.status,
|
|
2942
|
+
});
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2945
|
+
const content = await response.text();
|
|
2946
|
+
const filePath = path.join(baseDir, `${source.name}.openapi.yaml`);
|
|
2947
|
+
await fs.writeFile(filePath, content, "utf8");
|
|
2948
|
+
results.push({
|
|
2949
|
+
name: source.name,
|
|
2950
|
+
description: source.description,
|
|
2951
|
+
absolutePath: filePath,
|
|
2952
|
+
});
|
|
2953
|
+
}
|
|
2954
|
+
catch (error) {
|
|
2955
|
+
(0, logger_js_1.warn)(`[prepareOpenAPIDocs] Failed to download ${source.name}`, {
|
|
2956
|
+
error,
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
}));
|
|
2960
|
+
return results;
|
|
2961
|
+
}
|
|
2809
2962
|
async function collectSkillDescriptions(rootDir) {
|
|
2810
2963
|
const result = [];
|
|
2811
2964
|
async function walk(dir) {
|
|
@@ -3106,13 +3259,19 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_winston_daily_rotate_file_69928d76__;
|
|
|
3106
3259
|
/***/ }),
|
|
3107
3260
|
|
|
3108
3261
|
/***/ 279:
|
|
3109
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
3262
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3110
3263
|
|
|
3111
3264
|
|
|
3265
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3266
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3267
|
+
};
|
|
3112
3268
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3113
3269
|
exports.registerHostingTools = registerHostingTools;
|
|
3270
|
+
const fs_1 = __importDefault(__webpack_require__(421));
|
|
3271
|
+
const path_1 = __importDefault(__webpack_require__(521));
|
|
3114
3272
|
const zod_1 = __webpack_require__(971);
|
|
3115
3273
|
const cloudbase_manager_js_1 = __webpack_require__(431);
|
|
3274
|
+
const notification_js_1 = __webpack_require__(720);
|
|
3116
3275
|
function registerHostingTools(server) {
|
|
3117
3276
|
// 获取 cloudBaseOptions,如果没有则为 undefined
|
|
3118
3277
|
const cloudBaseOptions = server.cloudBaseOptions;
|
|
@@ -3149,6 +3308,43 @@ function registerHostingTools(server) {
|
|
|
3149
3308
|
// 获取环境信息
|
|
3150
3309
|
const envInfo = await cloudbase.env.getEnvInfo();
|
|
3151
3310
|
const staticDomain = envInfo.EnvInfo?.StaticStorages?.[0]?.StaticDomain;
|
|
3311
|
+
const accessUrl = staticDomain ? `https://${staticDomain}/${cloudPath || ''}` : "";
|
|
3312
|
+
// Send deployment notification to CodeBuddy IDE
|
|
3313
|
+
try {
|
|
3314
|
+
const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
|
|
3315
|
+
// Extract project name from localPath
|
|
3316
|
+
let projectName = "unknown";
|
|
3317
|
+
if (localPath) {
|
|
3318
|
+
try {
|
|
3319
|
+
// If localPath is a file, get parent directory name; if it's a directory, get directory name
|
|
3320
|
+
const stats = fs_1.default.statSync(localPath);
|
|
3321
|
+
if (stats.isFile()) {
|
|
3322
|
+
projectName = path_1.default.basename(path_1.default.dirname(localPath));
|
|
3323
|
+
}
|
|
3324
|
+
else {
|
|
3325
|
+
projectName = path_1.default.basename(localPath);
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
catch (statErr) {
|
|
3329
|
+
// If stat fails, try to extract from path directly
|
|
3330
|
+
projectName = path_1.default.basename(localPath);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
// Build console URL
|
|
3334
|
+
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${envId}#/static-hosting`;
|
|
3335
|
+
// Send notification
|
|
3336
|
+
await (0, notification_js_1.sendDeployNotification)(server, {
|
|
3337
|
+
deployType: 'hosting',
|
|
3338
|
+
url: accessUrl,
|
|
3339
|
+
projectId: envId,
|
|
3340
|
+
projectName: projectName,
|
|
3341
|
+
consoleUrl: consoleUrl
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
catch (notifyErr) {
|
|
3345
|
+
// Notification failure should not affect deployment flow
|
|
3346
|
+
// Error is already logged in sendDeployNotification
|
|
3347
|
+
}
|
|
3152
3348
|
return {
|
|
3153
3349
|
content: [
|
|
3154
3350
|
{
|
|
@@ -3157,7 +3353,7 @@ function registerHostingTools(server) {
|
|
|
3157
3353
|
...result,
|
|
3158
3354
|
staticDomain,
|
|
3159
3355
|
message: "文件上传成功",
|
|
3160
|
-
accessUrl:
|
|
3356
|
+
accessUrl: accessUrl
|
|
3161
3357
|
}, null, 2)
|
|
3162
3358
|
}
|
|
3163
3359
|
]
|
|
@@ -5659,6 +5855,13 @@ async function getInteractiveServerSafe(mcpServer) {
|
|
|
5659
5855
|
}
|
|
5660
5856
|
|
|
5661
5857
|
|
|
5858
|
+
/***/ }),
|
|
5859
|
+
|
|
5860
|
+
/***/ 344:
|
|
5861
|
+
/***/ ((module) => {
|
|
5862
|
+
|
|
5863
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_types_js_70eb1363__;
|
|
5864
|
+
|
|
5662
5865
|
/***/ }),
|
|
5663
5866
|
|
|
5664
5867
|
/***/ 357:
|
|
@@ -6021,7 +6224,7 @@ ${envIdSection}
|
|
|
6021
6224
|
## 环境信息
|
|
6022
6225
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
6023
6226
|
- Node.js版本: ${process.version}
|
|
6024
|
-
- MCP 版本:${process.env.npm_package_version || "2.0
|
|
6227
|
+
- MCP 版本:${process.env.npm_package_version || "2.1.0" || 0}
|
|
6025
6228
|
- 系统架构: ${os_1.default.arch()}
|
|
6026
6229
|
- 时间: ${new Date().toISOString()}
|
|
6027
6230
|
- 请求ID: ${requestId}
|
|
@@ -6188,7 +6391,7 @@ function registerSQLDatabaseTools(server) {
|
|
|
6188
6391
|
// executeReadOnlySQL
|
|
6189
6392
|
server.registerTool?.("executeReadOnlySQL", {
|
|
6190
6393
|
title: "Execute read-only SQL query",
|
|
6191
|
-
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.",
|
|
6394
|
+
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.",
|
|
6192
6395
|
inputSchema: {
|
|
6193
6396
|
sql: zod_1.z.string().describe("SQL query statement (SELECT queries only)"),
|
|
6194
6397
|
},
|
|
@@ -6247,7 +6450,7 @@ function registerSQLDatabaseTools(server) {
|
|
|
6247
6450
|
// executeWriteSQL
|
|
6248
6451
|
server.registerTool?.("executeWriteSQL", {
|
|
6249
6452
|
title: "Execute write SQL statement",
|
|
6250
|
-
description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must**
|
|
6453
|
+
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.",
|
|
6251
6454
|
inputSchema: {
|
|
6252
6455
|
sql: zod_1.z
|
|
6253
6456
|
.string()
|
|
@@ -6339,12 +6542,14 @@ const rag_js_1 = __webpack_require__(215);
|
|
|
6339
6542
|
const setup_js_1 = __webpack_require__(556);
|
|
6340
6543
|
const storage_js_1 = __webpack_require__(848);
|
|
6341
6544
|
// import { registerMiniprogramTools } from "./tools/miniprogram.js";
|
|
6545
|
+
const types_js_1 = __webpack_require__(344);
|
|
6342
6546
|
const cloudrun_js_1 = __webpack_require__(23);
|
|
6343
6547
|
const dataModel_js_1 = __webpack_require__(52);
|
|
6344
6548
|
const gateway_js_1 = __webpack_require__(319);
|
|
6345
6549
|
const invite_code_js_1 = __webpack_require__(760);
|
|
6346
6550
|
const security_rule_js_1 = __webpack_require__(862);
|
|
6347
6551
|
const cloud_mode_js_1 = __webpack_require__(684);
|
|
6552
|
+
const logger_js_1 = __webpack_require__(39);
|
|
6348
6553
|
const tool_wrapper_js_1 = __webpack_require__(363);
|
|
6349
6554
|
// 默认插件列表
|
|
6350
6555
|
const DEFAULT_PLUGINS = [
|
|
@@ -6445,6 +6650,13 @@ async function createCloudBaseMcpServer(options) {
|
|
|
6445
6650
|
...(ide === "CodeBuddy" ? { logging: {} } : {}),
|
|
6446
6651
|
},
|
|
6447
6652
|
});
|
|
6653
|
+
// Only set logging handler if logging capability is declared
|
|
6654
|
+
if (ide === "CodeBuddy") {
|
|
6655
|
+
server.server.setRequestHandler(types_js_1.SetLevelRequestSchema, (request, extra) => {
|
|
6656
|
+
(0, logger_js_1.info)(`--- Logging level: ${request.params.level}`);
|
|
6657
|
+
return {};
|
|
6658
|
+
});
|
|
6659
|
+
}
|
|
6448
6660
|
// Store cloudBaseOptions in server instance for tools to access
|
|
6449
6661
|
if (cloudBaseOptions) {
|
|
6450
6662
|
server.cloudBaseOptions = cloudBaseOptions;
|
|
@@ -6475,10 +6687,10 @@ function getDefaultServer() {
|
|
|
6475
6687
|
}
|
|
6476
6688
|
var stdio_js_1 = __webpack_require__(448);
|
|
6477
6689
|
Object.defineProperty(exports, "StdioServerTransport", ({ enumerable: true, get: function () { return stdio_js_1.StdioServerTransport; } }));
|
|
6478
|
-
var
|
|
6479
|
-
Object.defineProperty(exports, "error", ({ enumerable: true, get: function () { return
|
|
6480
|
-
Object.defineProperty(exports, "info", ({ enumerable: true, get: function () { return
|
|
6481
|
-
Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return
|
|
6690
|
+
var logger_js_2 = __webpack_require__(39);
|
|
6691
|
+
Object.defineProperty(exports, "error", ({ enumerable: true, get: function () { return logger_js_2.error; } }));
|
|
6692
|
+
Object.defineProperty(exports, "info", ({ enumerable: true, get: function () { return logger_js_2.info; } }));
|
|
6693
|
+
Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return logger_js_2.warn; } }));
|
|
6482
6694
|
var telemetry_js_1 = __webpack_require__(880);
|
|
6483
6695
|
Object.defineProperty(exports, "reportToolCall", ({ enumerable: true, get: function () { return telemetry_js_1.reportToolCall; } }));
|
|
6484
6696
|
Object.defineProperty(exports, "reportToolkitLifecycle", ({ enumerable: true, get: function () { return telemetry_js_1.reportToolkitLifecycle; } }));
|
|
@@ -7211,7 +7423,7 @@ function registerSetupTools(server) {
|
|
|
7211
7423
|
title: "下载项目模板",
|
|
7212
7424
|
description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
|
|
7213
7425
|
|
|
7214
|
-
**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
|
|
7426
|
+
**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)`,
|
|
7215
7427
|
inputSchema: {
|
|
7216
7428
|
template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
|
|
7217
7429
|
ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
|
|
@@ -7487,6 +7699,52 @@ function shouldRegisterTool(toolName) {
|
|
|
7487
7699
|
}
|
|
7488
7700
|
|
|
7489
7701
|
|
|
7702
|
+
/***/ }),
|
|
7703
|
+
|
|
7704
|
+
/***/ 720:
|
|
7705
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7706
|
+
|
|
7707
|
+
|
|
7708
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7709
|
+
exports.sendDeployNotification = sendDeployNotification;
|
|
7710
|
+
const logger_js_1 = __webpack_require__(39);
|
|
7711
|
+
/**
|
|
7712
|
+
* Send deployment notification to CodeBuddy IDE
|
|
7713
|
+
* @param server ExtendedMcpServer instance
|
|
7714
|
+
* @param notificationData Deployment notification data
|
|
7715
|
+
*/
|
|
7716
|
+
async function sendDeployNotification(server, notificationData) {
|
|
7717
|
+
// Check if current IDE is CodeBuddy (prefer server.ide, fallback to environment variable)
|
|
7718
|
+
const currentIde = server.ide || process.env.INTEGRATION_IDE;
|
|
7719
|
+
if (currentIde !== 'CodeBuddy' || !server.server) {
|
|
7720
|
+
// Not CodeBuddy IDE, skip notification
|
|
7721
|
+
return;
|
|
7722
|
+
}
|
|
7723
|
+
try {
|
|
7724
|
+
// Send notification using sendLoggingMessage
|
|
7725
|
+
server.server.sendLoggingMessage({
|
|
7726
|
+
level: "notice",
|
|
7727
|
+
data: {
|
|
7728
|
+
type: "tcb",
|
|
7729
|
+
event: "deploy",
|
|
7730
|
+
data: {
|
|
7731
|
+
type: notificationData.deployType, // "hosting" or "cloudrun"
|
|
7732
|
+
url: notificationData.url,
|
|
7733
|
+
projectId: notificationData.projectId,
|
|
7734
|
+
projectName: notificationData.projectName,
|
|
7735
|
+
consoleUrl: notificationData.consoleUrl
|
|
7736
|
+
}
|
|
7737
|
+
}
|
|
7738
|
+
});
|
|
7739
|
+
(0, logger_js_1.info)(`CodeBuddy IDE: 已发送部署通知 - ${notificationData.deployType} - ${notificationData.url}`);
|
|
7740
|
+
}
|
|
7741
|
+
catch (err) {
|
|
7742
|
+
// Log error but don't throw - notification failure should not affect deployment flow
|
|
7743
|
+
(0, logger_js_1.error)(`Failed to send deployment notification: ${err instanceof Error ? err.message : err}`, err);
|
|
7744
|
+
}
|
|
7745
|
+
}
|
|
7746
|
+
|
|
7747
|
+
|
|
7490
7748
|
/***/ }),
|
|
7491
7749
|
|
|
7492
7750
|
/***/ 760:
|
|
@@ -8253,7 +8511,7 @@ class TelemetryReporter {
|
|
|
8253
8511
|
const nodeVersion = process.version; // Node.js版本
|
|
8254
8512
|
const arch = os_1.default.arch(); // 系统架构
|
|
8255
8513
|
// 从构建时注入的版本号获取MCP版本信息
|
|
8256
|
-
const mcpVersion = process.env.npm_package_version || "2.0
|
|
8514
|
+
const mcpVersion = process.env.npm_package_version || "2.1.0" || 0;
|
|
8257
8515
|
return {
|
|
8258
8516
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
8259
8517
|
deviceId: this.deviceId,
|
|
@@ -8844,12 +9102,15 @@ deleteCollection: 删除数据`),
|
|
|
8844
9102
|
collectionName: zod_1.z.string().describe("集合名称"),
|
|
8845
9103
|
documents: zod_1.z
|
|
8846
9104
|
.array(zod_1.z.object({}).passthrough())
|
|
9105
|
+
.optional()
|
|
8847
9106
|
.describe("要插入的文档对象数组,每个文档都是对象(insert 操作必填)"),
|
|
8848
9107
|
query: zod_1.z
|
|
8849
9108
|
.union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
|
|
9109
|
+
.optional()
|
|
8850
9110
|
.describe("查询条件(对象或字符串,推荐对象)(update/delete 操作必填)"),
|
|
8851
9111
|
update: zod_1.z
|
|
8852
9112
|
.union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
|
|
9113
|
+
.optional()
|
|
8853
9114
|
.describe("更新内容(对象或字符串,推荐对象)(update 操作必填)"),
|
|
8854
9115
|
isMulti: zod_1.z
|
|
8855
9116
|
.boolean()
|
|
@@ -8869,6 +9130,9 @@ deleteCollection: 删除数据`),
|
|
|
8869
9130
|
},
|
|
8870
9131
|
}, async ({ action, collectionName, documents, query, update, isMulti, upsert, }) => {
|
|
8871
9132
|
if (action === "insert") {
|
|
9133
|
+
if (!documents) {
|
|
9134
|
+
throw new Error("insert 操作时必须提供 documents");
|
|
9135
|
+
}
|
|
8872
9136
|
const text = await insertDocuments({
|
|
8873
9137
|
collectionName,
|
|
8874
9138
|
documents,
|
|
@@ -8884,6 +9148,12 @@ deleteCollection: 删除数据`),
|
|
|
8884
9148
|
};
|
|
8885
9149
|
}
|
|
8886
9150
|
if (action === "update") {
|
|
9151
|
+
if (!query) {
|
|
9152
|
+
throw new Error("update 操作时必须提供 query");
|
|
9153
|
+
}
|
|
9154
|
+
if (!update) {
|
|
9155
|
+
throw new Error("update 操作时必须提供 update");
|
|
9156
|
+
}
|
|
8887
9157
|
const text = await updateDocuments({
|
|
8888
9158
|
collectionName,
|
|
8889
9159
|
query,
|
|
@@ -8902,6 +9172,9 @@ deleteCollection: 删除数据`),
|
|
|
8902
9172
|
};
|
|
8903
9173
|
}
|
|
8904
9174
|
if (action === "delete") {
|
|
9175
|
+
if (!query) {
|
|
9176
|
+
throw new Error("delete 操作时必须提供 query");
|
|
9177
|
+
}
|
|
8905
9178
|
const text = await deleteDocuments({
|
|
8906
9179
|
collectionName,
|
|
8907
9180
|
query,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cloudbase-mcp",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|