Skip to main content
Glama

GitPilot MCP

An autonomous MCP-powered agent that automates GitHub contributions end-to-end, from issue analysis and code changes to pull requests, conflict resolution, and review updates.


๐Ÿš€ Overview

GitPilot MCP is an Autonomous GitHub Contribution Agent built using the Model Context Protocol (MCP). It helps developers and contributors automate the full open-source workflow:

  • Forking repositories

  • Analyzing issues

  • Making code changes

  • Running tests

  • Creating pull requests

  • Syncing with upstream changes

  • Handling merge conflicts

  • Updating PRs based on maintainer feedback

The agent is designed to be minimal, safe, and extensible, without overengineering.


Related MCP server: GitHub Agent MCP Server

โœจ Key Features

  • ๐Ÿ” Fork & clone GitHub repositories

  • ๐ŸŒฟ Create and manage feature branches

  • ๐Ÿ”„ Sync fork with upstream when new PRs are merged

  • ๐Ÿง  Semantic code understanding using RAG

  • โœ๏ธ Generate minimal, clean git diffs

  • ๐Ÿงช Run tests and retry fixes automatically

  • ๐Ÿ“ฆ Commit & push changes

  • ๐Ÿ”€ Create pull requests programmatically

  • ๐Ÿ› ๏ธ Update existing PRs after review feedback

  • โš ๏ธ Detect merge conflicts before PR updates


๐Ÿง  Architecture (High Level)

Issue โ†’ Code Context (RAG) โ†’ Patch โ†’ Tests โ†’ Commit โ†’ PR
              โ†‘
      Sync / Review Feedback

The system follows real-world open-source contribution practices.


๐Ÿ“‚ Project Structure

mcp-github/
โ”‚
โ”œโ”€โ”€ main.py        # MCP server & tools
โ”œโ”€โ”€ rag.py         # RAG indexing and search
โ”œโ”€โ”€ config.py      # GitHub token & workspace
โ”œโ”€โ”€ .rag/          # Vector store (local)
โ””โ”€โ”€ README.md

๐Ÿงฉ Installation & Setup

Make sure you have the following installed:

  • Python 3.10+

  • Git

  • Claude Desktop (latest version)

  • Ollama (for embeddings)

Step 1: Install uv

uv is used for dependency management and isolated execution.

pip install uv

Step 2: Clone the Repository

git clone https://github.com/<your-username>/GitPilot-MCP.git
cd GitPilot-MCP

Step 3: Initialize the Project (uv)

Initialize the project environment:

uv init

Step 4: Install Dependencies

Add all required dependencies:

uv add fastmcp gitpython pygithub python-dotenv numpy faiss-cpu ollama

Step 5: For MCP tools testing

uv run fastmcp dev main.py

โš™๏ธ MCP Server Configuration

Use the following configuration to run the MCP server locally via uv + fastmcp in Claude-desktop:

paste this configuration in claudee-desktop-config file.

{
  "mcpServers": {
    "GitPilot-MCP": {
      "command": "<PATH_TO_PYTHON>/Scripts/uv.exe",
      "args": [
        "run",
        "--project",
        "<PATH_TO_PROJECT_ROOT>",
        "--directory",
        "<PATH_TO_PROJECT_ROOT>",
        "fastmcp",
        "run",
        "main.py"
      ],
      "transport": "stdio"
    }
  }
}

๐Ÿ” Configuration

Create a config.py file:

GITHUB_TOKEN = "your_github_personal_access_token"
WORKSPACE = "./workspace"

โš ๏ธ The token must have permissions to fork repositories and create pull requests.


๐Ÿ› ๏ธ Available MCP Tools

Some important tools exposed by the agent:

  • fork_repo

  • clone_repo

  • create_branch

  • sync_with_upstream

  • index_repo

  • get_repo_context

  • apply_patch

  • run_tests

  • retry_fix_with_tests

  • commit_and_push

  • create_pull_request

  • check_for_conflicts

  • update_pr_after_feedback

Each tool is single-responsibility and composable.


๐Ÿงช Testing Workflow

  1. Apply generated patch

  2. Run tests (pytest -q by default)

  3. Retry fixes automatically if tests fail

  4. Stop immediately once tests pass


๐Ÿ”„ Handling Maintainer Feedback

When a maintainer requests changes:

  • Generate a new patch

  • Apply it to the same branch

  • Commit & push

The existing PR updates automatically. No new PRs are created.


๐Ÿงฉ Design Principles

  • โœ… Minimal diffs

  • โœ… Short, inline comments only when necessary

  • โœ… No hard refresh or destructive git actions

  • โœ… No silent failures

  • โœ… Extensible for future improvements


๐Ÿšง Limitations

  • Repository indexing may be limited on very large repos

  • Conflict resolution is assisted, not fully automatic

  • Designed for local / controlled environments (remote hardening can be added later)


๐Ÿ”ฎ Future Improvements

  • Scoped repository indexing

  • PR comment parsing

  • CI status polling

  • Refresh-token support

  • Remote multi-user MCP deployment


๐Ÿ“œ License

MIT License (or as per your choice)


๐Ÿ™Œ Acknowledgements

Built using:

  • FastMCP

  • GitPython

  • PyGitHub

  • Ollama (for embeddings)

  • Qdrant / FAISS (vector search)

๐Ÿ‘จโ€๐Ÿ’ป Author

Divyanshu Giri

Available Tools

17 tools
apply_patchC

Apply a git patch to the repository.

Inputs: repo_path (required), patch (required). Returns: result

check_for_conflictsC

Check if there are merge conflicts with upstream.

Inputs: repo_path (required), base. Returns: object

clone_repoC

Clone a repository to the workspace.

Inputs: repo_url (required). Returns: result

commit_and_pushC

Commit changes and push to origin.

Inputs: repo_path (required), message (required). Returns: result

create_branchC

Create or checkout a branch.

Inputs: repo_path (required), branch_name (required). Returns: result

create_pull_requestD

Inputs: repo_input (required), head_branch (required), title (required), body (required), +1 more. Returns: result

fork_repoC

Fork a GitHub repository to your account.

Inputs: repo_input (required). Returns: result

get_index_storage_infoA

Get information about the centralized index storage location.

Returns: Dictionary with storage path and statistics

Inputs: no named parameters. Returns: object

get_issueC

Get details about a GitHub issue.

Inputs: repo_input (required), issue_number (required). Returns: object

get_repo_contextB

Search the indexed repository for relevant code chunks.

Inputs: repo_path (required), query (required), k. Returns: object

index_repoA

Index a repository for semantic code search.

The index is stored in a centralized location to avoid polluting the repository with .rag folders.

Inputs: repo_path (required). Returns: result

list_indexed_repositoriesA

List all repositories that have been indexed.

Returns: Dictionary with count and list of indexed repositories

Inputs: no named parameters. Returns: object

reindex_repositoryA

Re-index a repository (useful after code changes).

This will delete the old index and create a fresh one.

Inputs: repo_path (required). Returns: result

retry_fix_with_testsC

Helper tool for Claude to manage test-fix loops. Claude should:

  1. Call run_tests

  2. If failed, generate a patch and apply_patch

  3. Repeat until success or retries exhausted

Inputs: repo_path (required), max_retries. Returns: object

run_testsC

Run tests inside the repository. Returns stdout, stderr, and exit code.

Inputs: repo_path (required), command. Returns: object

sync_with_upstreamC

Sync local fork with upstream repository.

Inputs: repo_path (required), upstream_repo (required), base. Returns: result

update_pr_after_feedbackD

Inputs: repo_path (required), patch (required), commit_message. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    C2.5/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools have distinct purposes, though create_pull_request and update_pr_after_feedback lack descriptions, causing ambiguity. retry_fix_with_tests is a meta-tool but clear in its intent. Overall, minimal overlap.

    Naming Consistency3/5

    Tools predominantly use snake_case with verbs, but some are phrases like check_for_conflicts and retry_fix_with_tests, breaking consistency. get_index_storage_info uses 'info' instead of a standard noun.

    Tool Count4/5

    With 17 tools, it covers a wide range of git/GitHub operations. Some tools like get_index_storage_info are niche but still relevant. Slightly above ideal but reasonable.

    Completeness3/5

    Core workflows (clone, branch, commit, PR) are present, but missing operations like branch deletion, merge, and issue creation. Indexing feature adds unique functionality but gaps remain.

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      B
      quality
      Not graded
      maintenance
      Enables AI-driven orchestration of GitHub development workflows including automated issue analysis, code generation, code review, and PR creation through multiple specialized agents. Integrates with GitHub Actions to automate the complete development process from issue to pull request.
      7
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to automate GitHub repository management, issue tracking, and commits using natural language.
      11 npm
      Apache 2.0