Skip to main content
Glama

git-workflow

Manage Git repositories locally and remotely with operations including init, commit, sync, backup, and repository management for GitHub and Gitea platforms.

Instructions

Core Git workflow tool for local and remote Git operations. Supports init, status, commit, sync, backup, create, list, get, update, delete, fork, and search operations. Provides comprehensive Git repository management with both local and remote provider support (GitHub/Gitea).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe Git operation to perform. Local operations: init, status, commit, sync, backup. Remote operations: create, list, get, update, delete, fork, search (require provider parameter).
backupPathNoPath for backup file (for backup action)
bareNoInitialize as bare repository (for init action)
branchNoBranch name for sync
descriptionNoRepository description (for create/update actions)
filesNoSpecific files to commit (default: all changes)
forceNoForce operation (for sync action)
messageNoCommit message (required for commit action)
nameNoRepository name (for create action)
ownerNoRepository owner (for get/update/delete/fork actions)
privateNoCreate private repository (for create action)
projectPathYesAbsolute path to the project directory
providerNoProvider for remote operations (required for remote operations)
queryNoSearch query (for search action)
remoteNoRemote name for sync (default: origin)
repoNoRepository name (for get/update/delete/fork actions)

Implementation Reference

  • Main execute handler for git-workflow tool: validates parameters, routes local Git operations (init, commit, sync, push, pull, status, backup) or remote repository operations (create, list, get, update, delete, fork, search) via providers.
    async execute(params: GitWorkflowParams): Promise<ToolResult> { const startTime = Date.now(); try { // Validate basic parameters const validation = ParameterValidator.validateToolParams('git-workflow', params); if (!validation.isValid) { return OperationErrorHandler.createToolError( 'VALIDATION_ERROR', `Parameter validation failed: ${validation.errors.join(', ')}`, params.action, { validationErrors: validation.errors }, validation.suggestions ); } // Validate operation-specific parameters const operationValidation = ParameterValidator.validateOperationParams('git-workflow', params.action, params); if (!operationValidation.isValid) { return OperationErrorHandler.createToolError( 'VALIDATION_ERROR', `Operation validation failed: ${operationValidation.errors.join(', ')}`, params.action, { validationErrors: operationValidation.errors }, operationValidation.suggestions ); } // Route to appropriate handler const isRemoteOperation = this.isRemoteOperation(params.action); if (isRemoteOperation) { return await this.executeRemoteOperation(params, startTime); } else { return await this.executeLocalOperation(params, startTime); } } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return OperationErrorHandler.createToolError( 'EXECUTION_ERROR', `Failed to execute ${params.action}: ${errorMessage}`, params.action, { error: errorMessage }, ['Check the error details and try again'] ); } }
  • Tool schema definition for MCP registration, including name, description, and detailed inputSchema with all parameters for git-workflow.
    static getToolSchema() { return { name: 'git-workflow', description: 'Core Git workflow tool for local and remote Git operations. Supports init, status, commit, sync, backup, create, list, get, update, delete, fork, and search operations. Provides comprehensive Git repository management with both local and remote provider support (GitHub/Gitea). In universal mode (GIT_MCP_MODE=universal), automatically executes on both GitHub and Gitea providers.', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['init', 'status', 'commit', 'sync', 'backup', 'push', 'pull', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'], description: 'The Git operation to perform. Local operations: init, status, commit, sync, backup. Remote operations: create, list, get, update, delete, fork, search (require provider parameter).' }, projectPath: { type: 'string', description: 'Absolute path to the project directory' }, provider: { type: 'string', enum: ['github', 'gitea', 'both'], description: 'Provider for remote operations (required for remote operations)' }, message: { type: 'string', description: 'Commit message (required for commit action)' }, files: { type: 'array', items: { type: 'string' }, description: 'Specific files to commit (default: all changes)' }, bare: { type: 'boolean', description: 'Initialize as bare repository (for init action)' }, backupPath: { type: 'string', description: 'Path for backup file (for backup action)' }, name: { type: 'string', description: 'Repository name (for create action)' }, description: { type: 'string', description: 'Repository description (for create/update actions)' }, private: { type: 'boolean', description: 'Create private repository (for create action)' }, query: { type: 'string', description: 'Search query (for search action)' }, repo: { type: 'string', description: 'Repository name (for get/update/delete/fork actions)' }, remote: { type: 'string', description: 'Remote name for sync (default: origin)' }, branch: { type: 'string', description: 'Branch name for sync' }, force: { type: 'boolean', description: 'Force operation (for sync action)' }, pushRemote: { type: 'string', description: 'Remote name for push (default: origin)' }, pushBranch: { type: 'string', description: 'Branch name for push (default: current branch)' }, pullRemote: { type: 'string', description: 'Remote name for pull (default: origin)' }, pullBranch: { type: 'string', description: 'Branch name for pull (default: current branch)' } }, required: ['action', 'projectPath'] } }; }
  • src/server.ts:122-146 (registration)
    Registration of git-workflow schema in MCP listTools handler via GitWorkflowTool.getToolSchema().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ GitWorkflowTool.getToolSchema(), GitFilesTool.getToolSchema(), GitBranchesTool.getToolSchema(), GitIssuesTool.getToolSchema(), GitPullsTool.getToolSchema(), GitTagsTool.getToolSchema(), GitReleaseTool.getToolSchema(), GitRemoteTool.getToolSchema(), GitResetTool.getToolSchema(), GitStashTool.getToolSchema(), GitConfigTool.getToolSchema(), GitMonitorTool.getToolSchema(), GitBackupTool.getToolSchema(), GitArchiveTool.getToolSchema(), GitSyncTool.getToolSchema(), GitPackagesTool.getToolSchema(), GitAnalyticsTool.getToolSchema(), GitUpdateTool.getToolSchema(), GitHistoryTool.getToolSchema() ] }; });
  • src/server.ts:468-511 (registration)
    Tool execution dispatch for git-workflow in server switch statement calling this.gitWorkflowTool.execute().
    private async executeTool(name: string, args: any): Promise<any> { switch (name) { case 'git-workflow': return await this.gitWorkflowTool.execute(args); case 'git-files': return await this.gitFilesTool.execute(args); case 'git-branches': return await this.gitBranchesTool.execute(args); case 'git-issues': return await this.gitIssuesTool.execute(args); case 'git-pulls': return await this.gitPullsTool.execute(args); case 'git-tags': return await this.gitTagsTool.execute(args); case 'git-release': return await this.gitReleaseTool.execute(args); case 'git-remote': return await this.gitRemoteTool.execute(args); case 'git-reset': return await this.gitResetTool.execute(args); case 'git-stash': return await this.gitStashTool.execute(args); case 'git-config': return await this.gitConfigTool.execute(args); case 'git-monitor': return await this.gitMonitorTool.execute(args); case 'git-backup': return await this.gitBackupTool.execute(args); case 'git-archive': return await this.gitArchiveTool.execute(args); case 'git-sync': return await this.gitSyncTool.execute(args); case 'git-packages': return await this.gitPackagesTool.execute(args); case 'git-analytics': return await this.gitAnalyticsTool.execute(args); case 'git-update': return await this.gitUpdateTool.execute(args); case 'git-history': return await this.gitHistoryTool.execute(args); default: throw new Error(`Tool execution not implemented: ${name}`); } }
  • src/server.ts:87-87 (registration)
    Instantiation of GitWorkflowTool instance in server initialization with provider config.
    this.gitWorkflowTool = new GitWorkflowTool(providerConfig);
  • TOOL_OPERATIONS constant defining supported actions for git-workflow used in validation.
    private static readonly TOOL_OPERATIONS: Record<string, string[]> = { 'git-workflow': ['init', 'commit', 'sync', 'status', 'backup', 'push', 'pull', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'], 'git-files': ['read', 'search', 'backup', 'list'], 'git-branches': ['create', 'list', 'get', 'delete', 'merge', 'compare'], 'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'], 'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'], 'git-tags': ['create', 'list', 'get', 'delete', 'search'], 'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'], 'git-remote': ['add', 'remove', 'rename', 'show', 'set-url', 'prune', 'list'], 'git-reset': ['soft', 'mixed', 'hard', 'reset-to-commit', 'reset-branch'], 'git-stash': ['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear'], 'git-config': ['get', 'set', 'unset', 'list', 'edit', 'show'], 'git-monitor': ['log', 'status', 'commits', 'contributors'], 'git-backup': ['backup', 'restore', 'list', 'verify'], 'git-archive': ['create', 'extract', 'list', 'verify'], 'git-packages': ['list', 'get', 'create', 'update', 'delete', 'publish', 'download'], 'git-analytics': ['stats', 'commits', 'contributors'], 'git-sync': ['sync', 'status'], 'git-update': ['update', 'history', 'changelog', 'track', 'sync-providers', 'status', 'rollback', 'compare'], 'git-history': ['log', 'track', 'sync', 'export', 'auto'] };
  • Operation-specific parameter validation for git-workflow actions.
    private static validateWorkflowParams(action: string, params: ToolParams): ValidationResult { const result: ValidationResult = { isValid: true, errors: [], warnings: [], suggestions: [] }; switch (action) { case 'commit': if (!params.message) { result.errors.push('message is required for commit operation'); result.suggestions.push('Provide a commit message describing your changes'); result.isValid = false; } break; case 'create': if (!params.name) { result.errors.push('name is required for repository creation'); result.suggestions.push('Provide a repository name'); result.isValid = false; } break; case 'get': case 'update': case 'delete': case 'fork': if (!params.repo) { result.errors.push('repo is required for repository operations'); result.suggestions.push('Provide repository name'); result.isValid = false; } break; case 'search': if (!params.query) { result.errors.push('query is required for search operation'); result.suggestions.push('Provide a search query string'); result.isValid = false; } break; case 'push': // Validate push parameters if (params.force) { result.warnings.push('Force push will override remote changes. Use with caution.'); } break; case 'pull': // Validate pull parameters if (params.strategy && !['merge', 'rebase', 'fast-forward'].includes(params.strategy)) { result.errors.push('Invalid pull strategy. Must be one of: merge, rebase, fast-forward'); result.suggestions.push('Use strategy: "merge", "rebase", or "fast-forward"'); result.isValid = false; } break; case 'backup': if (params.backupPath && typeof params.backupPath !== 'string') { result.errors.push('backupPath must be a string'); result.isValid = false; } break; case 'sync': if (params.remote && typeof params.remote !== 'string') { result.errors.push('remote must be a string'); result.isValid = false; } if (params.branch && typeof params.branch !== 'string') { result.errors.push('branch must be a string'); result.isValid = false; } break; } return result; }

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/Andre-Buzeli/git-mcp'

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