@cnbcool/mcp-server 0.6.5 → 0.6.6
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_zh.md
CHANGED
|
@@ -42,6 +42,7 @@ CNB(https://cnb.cool) 支持 MCP 协议的 MCP Server
|
|
|
42
42
|
| cnb_startBuild | 开始一个构建 |
|
|
43
43
|
| cnb_stopBuild | 停止一个构建 |
|
|
44
44
|
| cnb_list_workspaces | 获取当前用户在CNB平台的云原生开发环境列表 |
|
|
45
|
+
| cnb_start_workspace | 在CNB平台启动指定仓库的云原生开发环境 |
|
|
45
46
|
| cnb_delete_workspace | 在CNB平台删除指定的云原生开发环境 |
|
|
46
47
|
| cnb_getKnowledgeBaseInfo | 获取知识库信息 |
|
|
47
48
|
| cnb_queryKnowledgeBase | 查询知识库 |
|
package/dist/api/workspace.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listWorkspace = listWorkspace;
|
|
4
4
|
exports.deleteWorkspace = deleteWorkspace;
|
|
5
|
+
exports.startWorkspace = startWorkspace;
|
|
5
6
|
async function listWorkspace(client, params) {
|
|
6
7
|
const url = new URL('/workspace/list', client.baseUrl);
|
|
7
8
|
if (params) {
|
|
@@ -19,3 +20,8 @@ async function deleteWorkspace(client, params) {
|
|
|
19
20
|
header: { 'Content-Type': 'application/json' }
|
|
20
21
|
});
|
|
21
22
|
}
|
|
23
|
+
async function startWorkspace(client, repo, params) {
|
|
24
|
+
return client.request('POST', `/${repo}/-/workspace/start`, params, {
|
|
25
|
+
header: { 'Content-Type': 'application/json' }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -46,6 +46,7 @@ exports.toolDescriptions = {
|
|
|
46
46
|
// 云原生开发工具
|
|
47
47
|
[toolNames_1.ToolNames.LIST_WORKSPACES]: '获取当前用户在CNB平台的云原生开发环境列表',
|
|
48
48
|
[toolNames_1.ToolNames.DELETE_WORKSPACE]: '在CNB平台删除指定的云原生开发环境',
|
|
49
|
+
[toolNames_1.ToolNames.START_WORKSPACE]: '在CNB平台启动指定仓库的云原生开发环境',
|
|
49
50
|
// 知识库工具
|
|
50
51
|
[toolNames_1.ToolNames.GET_KNOWLEDGE_BASE_INFO]: '获取知识库信息',
|
|
51
52
|
[toolNames_1.ToolNames.QUERY_KNOWLEDGE_BASE]: '查询知识库'
|
|
@@ -46,6 +46,7 @@ var ToolNames;
|
|
|
46
46
|
// 云原生开发工具
|
|
47
47
|
ToolNames["LIST_WORKSPACES"] = "cnb_list_workspaces";
|
|
48
48
|
ToolNames["DELETE_WORKSPACE"] = "cnb_delete_workspace";
|
|
49
|
+
ToolNames["START_WORKSPACE"] = "cnb_start_workspace";
|
|
49
50
|
// 知识库工具
|
|
50
51
|
ToolNames["GET_KNOWLEDGE_BASE_INFO"] = "cnb_getKnowledgeBaseInfo";
|
|
51
52
|
ToolNames["QUERY_KNOWLEDGE_BASE"] = "cnb_queryKnowledgeBase";
|
|
@@ -59,4 +59,24 @@ function registerWorkspaceTools(server, client) {
|
|
|
59
59
|
return (0, formatToolResult_js_1.formatToolError)(error, toolNames_js_1.ToolNames.DELETE_WORKSPACE);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
+
server.tool(toolNames_js_1.ToolNames.START_WORKSPACE, toolDescriptions_js_1.toolDescriptions[toolNames_js_1.ToolNames.START_WORKSPACE], {
|
|
63
|
+
repo: zod_1.z.string().describe('仓库路径,格式为 {group}/{repo}'),
|
|
64
|
+
branch: zod_1.z
|
|
65
|
+
.preprocess((val) => (val === null ? undefined : val), zod_1.z.string().optional())
|
|
66
|
+
.describe('分支名或 tag 名,例如:main 或 v1.0.0'),
|
|
67
|
+
ref: zod_1.z
|
|
68
|
+
.preprocess((val) => (val === null ? undefined : val), zod_1.z.string().optional())
|
|
69
|
+
.describe('Git ref,例如,refs/heads/main 或 refs/tags/v1.0.0。不传 ref 时默认基于分支启动')
|
|
70
|
+
}, async ({ repo, branch, ref }) => {
|
|
71
|
+
try {
|
|
72
|
+
const result = await (0, workspace_js_1.startWorkspace)(client, repo, {
|
|
73
|
+
branch,
|
|
74
|
+
ref
|
|
75
|
+
});
|
|
76
|
+
return (0, formatToolResult_js_1.formatTextToolResult)(JSON.stringify(result, null, 2), toolNames_js_1.ToolNames.START_WORKSPACE);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return (0, formatToolResult_js_1.formatToolError)(error, toolNames_js_1.ToolNames.START_WORKSPACE);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
62
82
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnbcool/mcp-server",
|
|
3
3
|
"description": "CNB MCP Server. A comprehensive MCP server that provides seamless integration to the CNB's API(https://cnb.cool), offering a wide range of tools for repository management, pipelines operations and collaboration features",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.6",
|
|
5
5
|
"main": "./dist/stdio.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cnb-mcp-stdio": "dist/stdio.js",
|