@cnbcool/mcp-server 0.1.0 → 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## 0.1.1 (March 25, 2025)
2
+
3
+ ### New Features
4
+
5
+ - Supports list group repositories with various filters
6
+
7
+ ## 0.1.0 (March 17, 2025)
8
+
9
+ ### New Features
10
+
11
+ - Supports list user repositories with various filters
12
+ - Supports get repository details
13
+ - Supports list repository issues with various filters
14
+ - Supports get issue details
15
+ - Supports create repository issue
@@ -35,6 +35,17 @@ export class CnbApiClient {
35
35
  }
36
36
  return this.request('GET', `${url.pathname}${url.search}`);
37
37
  }
38
+ async listGroupRepositories(group, params) {
39
+ const url = new URL(`/${group}/-/repos`, this.baseUrl);
40
+ if (params) {
41
+ for (const [key, value] of Object.entries(params)) {
42
+ if (value === undefined)
43
+ continue;
44
+ url.searchParams.set(key, value.toString());
45
+ }
46
+ }
47
+ return this.request('GET', `${url.pathname}${url.search}`);
48
+ }
38
49
  async getRepository(repo) {
39
50
  return this.request('GET', `/${repo}`);
40
51
  }
package/dist/tools.js CHANGED
@@ -28,6 +28,35 @@ export function registerTools(server, cnbApi) {
28
28
  };
29
29
  }
30
30
  });
31
+ server.tool("list-group-repositories", "获取分组里当前用户有权限的仓库", {
32
+ group: z.string().describe("组织名称"),
33
+ page: z.number().default(1).describe("第几页,从1开始"),
34
+ page_size: z.number().default(20).describe("每页多少条数据"),
35
+ search: z.string().optional().describe("仓库关键字"),
36
+ filter_type: z.enum(["private", "public", "encrypted"]).optional().describe("仓库类型"),
37
+ descendant: z.enum(["all", "sub", "grand"]).optional().describe("查全部、直接属于当前组织的仓库、子组织的仓库"),
38
+ order_by: z.enum(["created_at", "last_updated_at", "stars", "slug_path"]).optional().describe("排序类型"),
39
+ desc: z.boolean().optional().describe("排序顺序")
40
+ }, async ({ group, page, page_size, search, filter_type, descendant, order_by, desc }) => {
41
+ try {
42
+ const repos = await cnbApi.listGroupRepositories(group, { page, page_size, search, filter_type, descendant, order_by, desc });
43
+ return {
44
+ content: [{
45
+ type: "text",
46
+ text: JSON.stringify(repos, null, 2)
47
+ }]
48
+ };
49
+ }
50
+ catch (error) {
51
+ return {
52
+ content: [{
53
+ type: "text",
54
+ text: `Error listing repositories: ${error instanceof Error ? error.message : String(error)}`
55
+ }],
56
+ isError: true
57
+ };
58
+ }
59
+ });
31
60
  server.tool("get-repository", "获取指定仓库信息", {
32
61
  repoId: z.string().describe("仓库 ID")
33
62
  }, async ({ repoId }) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cnbcool/mcp-server",
3
3
  "description": "CMB MCP server",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {
7
7
  "cnbcool-mcp-server": "dist/index.js"
@@ -25,6 +25,7 @@
25
25
  "files": [
26
26
  "dist/",
27
27
  "package.json",
28
+ "CHANGELOG.md",
28
29
  "README.md"
29
30
  ],
30
31
  "engines": {