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

@@ -19,6 +19,19 @@ async function withSession<T>(fn: (session: Session) => Promise<T>): Promise<T>
}
const TOOLS = [
{
name: 'create_repo',
description: 'Create a new repository on Gitea.',
inputSchema: {
type: 'object',
required: ['name'],
properties: {
name: { type: 'string', description: 'Repository name' },
description: { type: 'string', description: 'Optional description' },
private: { type: 'boolean', description: 'Make the repo private (default: false)' },
},
},
},
{
name: 'list_repos',
description: 'List repositories accessible to the Gitea agent account.',
@@ -144,6 +157,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
let result: unknown;
switch (name) {
case 'create_repo':
result = await withSession(s => gitea.createRepo(s, a.name as string, a.description as string | undefined, a.private as boolean | undefined));
break;
case 'list_repos':
result = await withSession(s => gitea.listRepos(s));
break;