Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_config

Manage Git configuration settings by getting, setting, or listing values for repository or global scope to customize your development workflow.

Instructions

Get or set git configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
actionNoConfig actionlist
keyNoConfig key (required for get/set)
valueNoConfig value (required for set)
globalNoUse global config instead of repository config

Implementation Reference

  • Main handler function that executes git config commands based on action (list/get/set) using the shared executeGitCommand helper.
    export async function gitConfig(args: z.infer<typeof gitConfigSchema>): Promise<ToolResponse> { const globalFlag = args.global ? '--global' : ''; switch (args.action) { case 'list': return executeGitCommand(`git config ${globalFlag} --list`.trim(), args.cwd); case 'get': if (!args.key) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Key required for get action' }, null, 2) }], isError: true }; } return executeGitCommand(`git config ${globalFlag} ${args.key}`.trim(), args.cwd); case 'set': if (!args.key || !args.value) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Key and value required for set action' }, null, 2) }], isError: true }; } return executeGitCommand(`git config ${globalFlag} ${args.key} "${args.value}"`.trim(), args.cwd); default: return { content: [{ type: "text", text: JSON.stringify({ success: false, error: 'Invalid config action' }, null, 2) }], isError: true }; } }
  • Zod schema used for input validation in the gitConfig handler.
    export const gitConfigSchema = z.object({ cwd: z.string().optional().describe('Repository directory'), action: z.enum(['get', 'set', 'list']).optional().default('list').describe('Config action'), key: z.string().optional().describe('Config key (required for get/set)'), value: z.string().optional().describe('Config value (required for set)'), global: z.boolean().optional().default(false).describe('Use global config instead of repository config') });
  • MCP tool registration/definition in the gitTools array, including name, description, and JSON inputSchema.
    { name: 'git_config', description: 'Get or set git configuration', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Repository directory' }, action: { type: 'string', enum: ['get', 'set', 'list'], default: 'list', description: 'Config action' }, key: { type: 'string', description: 'Config key (required for get/set)' }, value: { type: 'string', description: 'Config value (required for set)' }, global: { type: 'boolean', default: false, description: 'Use global config instead of repository config' } } } }
  • src/index.ts:437-440 (registration)
    Dispatcher/registration in main index.ts handler that routes 'git_config' calls to the gitConfig function after schema validation.
    if (name === 'git_config') { const validated = gitConfigSchema.parse(args); return await gitConfig(validated); }
  • Shared helper function used by all git tools (including git_config) 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