@cnbcool/mcp-server
Version:
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
29 lines (28 loc) • 1.05 kB
JavaScript
import CnbApiClient from './client.js';
export async function listRepositories(params) {
const cnbInst = CnbApiClient.getInstance();
const url = new URL('/user/repos', cnbInst.baseUrl);
if (params) {
for (const [key, value] of Object.entries(params)) {
if (value === undefined)
continue;
url.searchParams.set(key, value.toString());
}
}
return cnbInst.request('GET', `${url.pathname}${url.search}`);
}
export async function listGroupRepositories(group, params) {
const cnbInst = CnbApiClient.getInstance();
const url = new URL(`/${group}/-/repos`, cnbInst.baseUrl);
if (params) {
for (const [key, value] of Object.entries(params)) {
if (value === undefined)
continue;
url.searchParams.set(key, value.toString());
}
}
return cnbInst.request('GET', `${url.pathname}${url.search}`);
}
export async function getRepository(repo) {
return CnbApiClient.getInstance().request('GET', `/${repo}`);
}