MCP Git: Git Configuration Options

Supporting information for MCP Git article

Other MCP Git configuration options

I'll break down the different configuration options available for the Git MCP server configuration.

Configuration Options Deep Dive

{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",          // Base command
        "--repository", "/path",    // Repository path
        "--branch", "main",        // Target branch
        "--depth", "100",          // History depth
        "--include", "src/**/*.py", // File patterns to include
        "--exclude", "tests/**",    // File patterns to exclude
        "--cache-dir", "/path/cache", // Cache directory
        "--log-level", "info",     // Logging verbosity
        "--max-file-size", "5mb"   // File size limit
      ],
      "env": {
        "GIT_SSH_COMMAND": "ssh -i /path/to/key" // SSH configuration
      }
    }
  }
}

Core Options

  1. Repository Configuration
"--repository": "/path/to/your/git/repo"

  • Specifies the root directory of the Git repository
  • Can be absolute or relative path
  • Required parameter
  • Example paths:
    • macOS: "/Users/username/projects/myrepo"
    • Windows: "C:\\\\Users\\\\username\\\\projects\\\\myrepo"
  1. Branch Selection
"--branch": "main"

  • Specifies the default branch to analyze
  • Optional (defaults to repository's default branch)
  • Common values:
    • "main" or "master" for primary branch
    • "develop" for development branch
    • "feature/*" for feature branches
  1. History Depth
"--depth": "100"

  • Limits how far back in history to analyze
  • Optional (defaults to full history)
  • Trade-off between completeness and performance
  • Values:
    • Numeric value (e.g., "100" for last 100 commits)
    • "all" for complete history
    • "shallow" for minimal history

Advanced Options

  1. File Filtering
"--include": "src/**/*.py",
"--exclude": "tests/**"

  • Control which files are analyzed

  • Supports glob patterns

  • Multiple patterns can be specified

  • Examples:

    "--include": ["src/**/*.{js,ts}", "lib/**/*.{js,ts}"]
    "--exclude": ["node_modules/**", "**/*.test.js"]
    
    
  1. Cache Configuration
"--cache-dir": "/path/to/cache",
"--cache-ttl": "24h"

  • Optimize performance with caching
  • Optional but recommended for large repos
  • TTL (Time To Live) options:
    • "1h" for one hour
    • "24h" for one day
    • "7d" for one week
  1. Performance Settings
"--max-file-size": "5mb",
"--max-commits": "1000",
"--parallel": "4"

  • Control resource usage
  • Prevent performance issues with large repositories
  • Optional with reasonable defaults
  1. Logging Configuration
"--log-level": "info",
"--log-file": "/path/to/logs/git-mcp.log"

  • Control debugging output
  • Log levels:
    • "error" - Errors only
    • "warn" - Warnings and errors
    • "info" - General information (default)
    • "debug" - Detailed debugging
    • "trace" - Most verbose
  1. Authentication
"env": {
  "GIT_SSH_COMMAND": "ssh -i /path/to/key",
  "GIT_ASKPASS": "/path/to/askpass-script"
}

  • Configure Git authentication
  • Useful for private repositories
  • Support for:
    • SSH keys
    • HTTP(S) credentials
    • Custom authentication scripts

Example Configurations

  1. Basic Local Repository
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository", "/Users/me/projects/myrepo"
      ]
    }
  }
}

  1. Production Analysis Setup
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository", "/var/www/project",
        "--branch", "production",
        "--depth", "500",
        "--include", "src/**/*.{js,ts}",
        "--exclude", ["tests/**", "**/*.test.js"],
        "--cache-dir", "/var/cache/git-mcp",
        "--log-level", "warn"
      ]
    }
  }
}

  1. Development Environment
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository", "./",
        "--branch", "develop",
        "--depth", "all",
        "--log-level", "debug"
      ]
    }
  }
}