Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_push

Push Git commits to remote repositories to synchronize local changes with team members and deployment environments.

Instructions

Push commits to remote repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
remoteNoRemote nameorigin
branchNoBranch to push (defaults to current branch)
forceNoForce push (use with caution)
setUpstreamNoSet upstream tracking

Implementation Reference

  • The gitPush function implements the core logic for the git_push tool by constructing and executing the appropriate git push command using the shared executeGitCommand helper.
    export async function gitPush(args: z.infer<typeof gitPushSchema>): Promise<ToolResponse> { const forceFlag = args.force ? '--force' : ''; const upstreamFlag = args.setUpstream ? '-u' : ''; const branch = args.branch || ''; return executeGitCommand(`git push ${upstreamFlag} ${forceFlag} ${args.remote} ${branch}`.trim(), args.cwd); }
  • Zod schema used for input validation of git_push tool arguments in the handler dispatch.
    export const gitPushSchema = z.object({ cwd: z.string().optional().describe('Repository directory'), remote: z.string().optional().default('origin').describe('Remote name'), branch: z.string().optional().describe('Branch to push (defaults to current branch)'), force: z.boolean().optional().default(false).describe('Force push (use with caution)'), setUpstream: z.boolean().optional().default(false).describe('Set upstream tracking') });
  • src/index.ts:389-392 (registration)
    Registration and dispatch logic in the main MCP server handler that routes 'git_push' calls to the gitPush function after validation.
    if (name === 'git_push') { const validated = gitPushSchema.parse(args); return await gitPush(validated); }
  • MCP-compatible JSON schema definition for the git_push tool, included in the gitTools array returned by listTools.
    { name: 'git_push', description: 'Push commits to remote repository', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Repository directory' }, remote: { type: 'string', default: 'origin', description: 'Remote name' }, branch: { type: 'string', description: 'Branch to push (defaults to current branch)' }, force: { type: 'boolean', default: false, description: 'Force push (use with caution)' }, setUpstream: { type: 'boolean', default: false, description: 'Set upstream tracking' } } } },
  • Shared helper function executeGitCommand that all git tools (including gitPush) use to run 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