Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_remote

Manage Git remote repositories by listing, adding, removing, or showing remote connections to control version control collaboration and repository links.

Instructions

Manage remote repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
actionNoRemote actionlist
nameNoRemote name (required for add/remove/show)
urlNoRemote URL (required for add)

Implementation Reference

  • The main handler function for the 'git_remote' tool. Executes git remote commands (list, add, remove, show) using the shared executeGitCommand helper, with input validation via gitRemoteSchema.
    export async function gitRemote(args: z.infer<typeof gitRemoteSchema>): Promise<ToolResponse> { switch (args.action) { case 'list': return executeGitCommand('git remote -v', args.cwd); case 'add': if (!args.name || !args.url) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Name and URL required for add action' }, null, 2) }], isError: true }; } return executeGitCommand(`git remote add ${args.name} ${args.url}`, args.cwd); case 'remove': if (!args.name) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Name required for remove action' }, null, 2) }], isError: true }; } return executeGitCommand(`git remote remove ${args.name}`, args.cwd); case 'show': if (!args.name) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Name required for show action' }, null, 2) }], isError: true }; } return executeGitCommand(`git remote show ${args.name}`, args.cwd); default: return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Invalid remote action' }, null, 2) }], isError: true }; }
  • Zod schema for validating inputs to the git_remote tool, used in the dispatch handler in index.ts.
    export const gitRemoteSchema = z.object({ cwd: z.string().optional().describe('Repository directory'), action: z.enum(['list', 'add', 'remove', 'show']).optional().default('list').describe('Remote action'), name: z.string().optional().describe('Remote name (required for add/remove/show)'), url: z.string().optional().describe('Remote URL (required for add)') });
  • src/index.ts:413-416 (registration)
    Dispatch registration in the main MCP server handler. Matches tool name, validates args with schema, and calls the gitRemote handler.
    if (name === 'git_remote') { const validated = gitRemoteSchema.parse(args); return await gitRemote(validated); }
  • MCP tool definition in gitTools array, including inputSchema for tool listing. Mirrors the Zod schema.
    { name: 'git_remote', description: 'Manage remote repositories', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Repository directory' }, action: { type: 'string', enum: ['list', 'add', 'remove', 'show'], default: 'list', description: 'Remote action' }, name: { type: 'string', description: 'Remote name (required for add/remove/show)' }, url: { type: 'string', description: 'Remote URL (required for add)' } } }
  • Shared helper function used by all git tools, including gitRemote, to execute git commands and format responses.
    async function executeGitCommand(command: string, cwd?: string): Promise<ToolResponse> { try { const { stdout, stderr } = await execAsync(command, { cwd: cwd || process.cwd(), shell: '/bin/bash', maxBuffer: 10 * 1024 * 1024 // 10MB buffer }); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, command: command, stdout: stdout.trim(), stderr: stderr.trim(), cwd: cwd || process.cwd() }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, command: command, stdout: error.stdout?.trim() || '', stderr: error.stderr?.trim() || error.message, exitCode: error.code || 1, cwd: cwd || process.cwd() }, null, 2) } ], isError: true }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ConnorBoetig-dev/mcp2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server