@cnbcool/mcp-server 0.3.2 → 0.3.3
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 +7 -0
- package/dist/api/client.js +8 -1
- package/dist/api/group.js +8 -2
- package/dist/api/repository.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/api/client.js
CHANGED
|
@@ -20,7 +20,8 @@ export default class CnbApiClient {
|
|
|
20
20
|
}
|
|
21
21
|
return CnbApiClient.instance;
|
|
22
22
|
}
|
|
23
|
-
async request(method, path, body, config
|
|
23
|
+
async request(method, path, body, config, responseType = 'json' // 'json' | 'text' | 'raw'
|
|
24
|
+
) {
|
|
24
25
|
const url = `${this._baseUrl}${path}`;
|
|
25
26
|
const headers = {
|
|
26
27
|
Authorization: `Bearer ${this._token}`,
|
|
@@ -37,6 +38,12 @@ export default class CnbApiClient {
|
|
|
37
38
|
const errorText = await response.text();
|
|
38
39
|
throw new Error(`API request failed: ${response.status} ${errorText}`);
|
|
39
40
|
}
|
|
41
|
+
if (responseType === 'raw') {
|
|
42
|
+
return response;
|
|
43
|
+
}
|
|
44
|
+
if (responseType === 'text') {
|
|
45
|
+
return response.text();
|
|
46
|
+
}
|
|
40
47
|
return response.json();
|
|
41
48
|
}
|
|
42
49
|
}
|
package/dist/api/group.js
CHANGED
|
@@ -34,7 +34,13 @@ export async function createGroup(params) {
|
|
|
34
34
|
Object.assign(acc, { [key]: value });
|
|
35
35
|
return acc;
|
|
36
36
|
}, {});
|
|
37
|
-
|
|
37
|
+
const response = await CnbApiClient.getInstance().request('POST', '/groups', body, {
|
|
38
38
|
header: { 'Content-Type': 'application/json' }
|
|
39
|
-
});
|
|
39
|
+
}, 'raw');
|
|
40
|
+
if (response.status === 201) {
|
|
41
|
+
return { message: 'Created' };
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return { status: response.status, message: response.statusText };
|
|
45
|
+
}
|
|
40
46
|
}
|
package/dist/api/repository.js
CHANGED
|
@@ -33,7 +33,13 @@ export async function createRepository(group, params) {
|
|
|
33
33
|
Object.assign(acc, { [key]: value });
|
|
34
34
|
return acc;
|
|
35
35
|
}, {});
|
|
36
|
-
|
|
36
|
+
const response = await CnbApiClient.getInstance().request('POST', `/${group}/-/repos`, body, {
|
|
37
37
|
header: { 'Content-Type': 'application/json' }
|
|
38
|
-
});
|
|
38
|
+
}, 'raw');
|
|
39
|
+
if (response.status === 201) {
|
|
40
|
+
return { message: 'Created' };
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return { status: response.status, message: response.statusText };
|
|
44
|
+
}
|
|
39
45
|
}
|
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.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cnb-mcp-server": "dist/index.js"
|