Add create_repo tool to MCP server

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
agent
2026-03-24 09:23:22 -04:00
parent 9132394fd5
commit 634bf3353f
3 changed files with 42 additions and 0 deletions

View File

@@ -38,6 +38,31 @@ export interface PRDetails {
isMerged: boolean;
}
// Create a new repository
export async function createRepo(
{ page }: Session,
name: string,
description = '',
isPrivate = false,
): Promise<{ url: string; cloneUrl: string }> {
await page.goto(`${GITEA_URL}/repo/create`, { waitUntil: 'load' });
await page.fill('input[name="repo_name"]', name);
if (description) await page.fill('textarea[name="description"]', description);
if (isPrivate) await page.check('input[name="private"]');
await Promise.all([
page.waitForNavigation({ waitUntil: 'load' }),
page.getByRole('button', { name: 'Create Repository' }).click(),
]);
const cloneUrl =
(await page.locator('#repo-clone-https, input#clone-url').inputValue().catch(() => '')) ||
`${GITEA_URL}/${USERNAME}/${name}.git`;
return { url: page.url(), cloneUrl };
}
// List repos visible to the logged-in user
export async function listRepos({ page }: Session): Promise<Repo[]> {
await page.goto(`${GITEA_URL}/${USERNAME}`, { waitUntil: 'load' });