github-repos-manager-mcp
Version:
Model Context Protocol (MCP) server that enables your MCP client (e.g., Claude Desktop, Cline, Roo Code, Cursor, Windsurf, etc.) to interact with GitHub repositories using your GitHub personal access token.
150 lines (141 loc) • 4.4 kB
JavaScript
const { getOwnerRepo } = require("../utils/shared-utils.cjs");
const githubApi = require("../services/github-api.cjs");
// TODO: Replace with actual GraphQL calls once github-api.js is updated
async function list_repo_projects(args, defaultRepo, apiService) {
try {
const { owner, repo } = getOwnerRepo(args, defaultRepo);
// Use the existing GitHub API implementation
const result = await apiService.listProjectsV2({ owner, repo, ...args });
return {
success: true,
data: result,
message: "Projects listed successfully (using placeholder implementation)."
};
} catch (error) {
console.error("Error in list_repo_projects:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
async function create_project(args, defaultRepo, apiService) {
try {
const { owner, repo } = getOwnerRepo(args, defaultRepo);
if (!args.title) {
throw new Error("Title is required for creating a project");
}
// Use the existing GitHub API implementation
const result = await apiService.createProjectV2({ owner, repo, ...args });
return {
success: true,
data: result,
message: "Project creation initiated (using placeholder implementation)."
};
} catch (error) {
console.error("Error in create_project:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
async function list_project_columns(args, defaultRepo, apiService) {
try {
if (!args.project_id) {
throw new Error("Project ID is required");
}
// Use the existing GitHub API implementation
const result = await apiService.listProjectFieldsV2({ project_id: args.project_id, ...args });
return {
success: true,
data: result,
message: "Project columns/fields listed successfully (using placeholder implementation)."
};
} catch (error) {
console.error("Error in list_project_columns:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
async function list_project_cards(args, defaultRepo, apiService) {
try {
if (!args.project_id) {
throw new Error("Project ID is required");
}
// Use the existing GitHub API implementation
const result = await apiService.listProjectItemsV2({ project_id: args.project_id, ...args });
return {
success: true,
data: result,
message: "Project cards/items listed successfully (using placeholder implementation)."
};
} catch (error) {
console.error("Error in list_project_cards:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
async function create_project_card(args, defaultRepo, apiService) {
try {
if (!args.project_id) {
throw new Error("Project ID is required");
}
// Use the existing GitHub API implementation
const result = await apiService.createProjectItemV2({ project_id: args.project_id, ...args });
return {
success: true,
data: result,
message: "Project card/item creation initiated (using placeholder implementation)."
};
} catch (error) {
console.error("Error in create_project_card:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
async function move_project_card(args, defaultRepo, apiService) {
try {
if (!args.card_id || !args.project_id || !args.new_column_id) {
throw new Error("Card ID, Project ID, and New Column ID are required");
}
// Use the existing GitHub API implementation
const result = await apiService.updateProjectItemV2({
item_id: args.card_id,
project_id: args.project_id,
field_id: args.new_column_id,
...args
});
return {
success: true,
data: result,
message: "Project card/item moved successfully (using placeholder implementation)."
};
} catch (error) {
console.error("Error in move_project_card:", error.message);
return {
success: false,
message: error.message,
error: error.message
};
}
}
module.exports = {
list_repo_projects,
create_project,
list_project_columns,
list_project_cards,
create_project_card,
move_project_card,
};