Skip to main content
Glama
Git Repo Browser MCP

Git Repo Browser MCP

by bsreeram08

MCP Git リポジトリ ブラウザ (Node.js)

モデル コンテキスト プロトコル (MCP) を使用した Git リポジトリ ブラウザーの Node.js 実装。

GitHubリポジトリ npmパッケージ

インストール

NPM(推奨)

npm install -g git-commands-mcp

手動インストール

git clone https://github.com/bsreeram08/git-commands-mcp.git
cd git-commands-mcp
npm install

Related MCP server: MCP Git Repo Browser

構成

MCP 設定構成ファイルに以下を追加します。

{
  "mcpServers": {
    "git-commands-mcp": {
      "command": "git-commands-mcp"
    }
  }
}

手動でインストールする場合は、以下を使用します。

{
  "mcpServers": {
    "git-commands-mcp": {
      "command": "node",
      "args": ["/path/to/git-commands-mcp/src/index.js"]
    }
  }
}

特徴

サーバーは次のツールを提供します。

基本的なリポジトリ操作

  1. git_directory_structure : リポジトリのディレクトリ構造のツリー状の表現を返します

    • 入力: リポジトリ URL

    • 出力: リポジトリ構造のASCIIツリー表現

  2. git_read_files : リポジトリ内の指定されたファイルの内容を読み取って返します

    • 入力: リポジトリのURLとファイルパスのリスト

    • 出力: ファイルパスとその内容をマッピングする辞書

  3. git_search_code : リポジトリコード内のパターンを検索します

    • 入力: リポジトリ URL、検索パターン、オプションのファイルパターン、大文字と小文字の区別、コンテキスト行

    • 出力: 一致する行とコンテキストを含む検索結果を含む JSON

支店運営

  1. git_branch_diff : 2つのブランチを比較し、それらの間で変更されたファイルを表示します

    • 入力: リポジトリ URL、ソース ブランチ、ターゲット ブランチ、およびオプションの show_patch フラグ

    • 出力: コミット数と差分サマリーを含むJSON

コミット操作

  1. git_commit_history : オプションのフィルタリングを使用してブランチのコミット履歴を取得する

    • 入力: リポジトリ URL、ブランチ名、最大数、作成者フィルター、開始日、終了日、メッセージ grep

    • 出力: コミットの詳細を含むJSON

  2. git_commits_details : 完全なメッセージと差分を含むコミットの詳細情報を取得します

    • 入力: リポジトリ URL、ブランチ名、最大数、include_diff フラグ、作成者フィルター、開始日、終了日、メッセージ grep

    • 出力: 詳細なコミット情報を含むJSON

  3. git_local_changes : 作業ディレクトリ内のコミットされていない変更を取得する

    • 入力: ローカルリポジトリのパス

    • 出力: ステータス情報と差分を含むJSON

プロジェクト構造

git-commands-mcp/
├── src/
│   ├── index.js         # Entry point
│   ├── server.js        # Main server implementation
│   ├── handlers/        # Tool handlers
│   │   └── index.js     # Tool implementation functions
│   └── utils/           # Utility functions
│       └── git.js       # Git-related helper functions
├── package.json
└── readme.md

実装の詳細

  • コア機能には Node.js ネイティブ モジュール (crypto、path、os) を使用します

  • 強化されたファイル操作のために fs-extra を活用

  • Gitリポジトリ操作にはsimple-gitを使用する

  • クリーンなエラー処理とリソースのクリーンアップを実装します

  • リポジトリの URL ハッシュに基づいて決定論的な一時ディレクトリを作成します。

  • 効率性を高めるために、可能な場合はクローンリポジトリを再利用します。

  • 保守性を向上させるモジュール式コード構造

要件

  • Node.js 14.x 以上

  • システムにGitがインストールされている

使用法

npm 経由でグローバルにインストールした場合:

git-commands-mcp

手動でインストールする場合:

node src/index.js

サーバーは stdio 上で実行されるため、MCP クライアントと互換性があります。

CI/CD

このプロジェクトでは、継続的な統合とデプロイメントに GitHub Actions を使用します。

自動NPM公開

リポジトリは、変更がマスター ブランチにプッシュされたときにパッケージを npm に自動的に公開する GitHub Actions ワークフローで構成されています。

NPM_AUTOMATION_TOKENの設定

自動公開を有効にするには、npm Automation トークンを GitHub シークレットとして追加する必要があります (これは、2FA が有効になっているアカウントでも機能します)。

  1. npm Automation トークンを生成します。

    • npmjs.comでnpmアカウントにログインします。

    • プロフィール設定に移動

    • 「アクセストークン」を選択

    • 「新しいトークンを生成」をクリックします

    • 「自動化」トークンタイプを選択

    • 適切な権限を設定します(パッケージには「読み取りと書き込み」が必要です)

    • 生成されたトークンをコピーする

  2. トークンを GitHub リポジトリに追加します。

    • GitHubリポジトリへアクセスする

    • 「設定」>「シークレットと変数」>「アクション」に移動します

    • 「新しいリポジトリシークレット」をクリックします

    • 名前: NPM_AUTOMATION_TOKEN

    • 値: npm Automationトークンを貼り付けます

    • 「シークレットを追加」をクリック

設定が完了すると、マスター ブランチへのプッシュによって、パッケージを npm に公開するワークフローがトリガーされます。

ライセンス

MIT ライセンス - 詳細についてはLICENSEファイルを参照してください。

リンク

Available Tools

27 tools
git_archiveC

Create a git archive (zip or tar).

Inputs: repo_path (required), output_path (required), format, prefix, +1 more.

git_attributesC

Manage git attributes for files.

Inputs: repo_path (required), action (required), pattern, attribute.

git_blameC

Get blame information for a file.

Inputs: repo_path (required), file_path (required), rev.

git_branch_diffC

Compare two branches and show files changed between them.

Inputs: repo_url (required), source_branch (required), target_branch (required), show_patch.

git_checkout_branchC

Create and/or checkout a branch.

Inputs: repo_path (required), branch_name (required), start_point, create.

git_cleanC

Perform git clean operations.

Inputs: repo_path (required), directories, force, dry_run.

git_commitC

Create a commit with the specified message.

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

git_commit_historyB

Get commit history for a branch with optional filtering.

Inputs: repo_url (required), branch, max_count, author, +3 more.

git_commits_detailsC

Get detailed information about commits including full messages and diffs.

Inputs: repo_url (required), branch, max_count, include_diff, +4 more.

git_configC

Configure git settings for the repository.

Inputs: repo_path (required), key (required), value (required), scope.

git_create_tagC

Create a tag.

Inputs: repo_path (required), tag_name (required), message, annotated.

git_delete_branchC

Delete a branch from the repository.

Inputs: repo_path (required), branch_name (required), force.

git_directory_structureC

Clone a Git repository and return its directory structure in a tree format.

Inputs: repo_url (required).

git_hooksC

Manage git hooks in the repository.

Inputs: repo_path (required), action (required), hook_name, script.

git_lfsC

Manage Git LFS (Large File Storage).

Inputs: repo_path (required), action (required), patterns.

git_lfs_fetchC

Fetch LFS objects from the remote repository.

Inputs: repo_path (required), dry_run, pointers.

git_local_changesC

Get uncommitted changes in the working directory.

Inputs: repo_path (required).

git_merge_branchC

Merge a source branch into the current or target branch.

Inputs: repo_path (required), source_branch (required), target_branch, no_fast_forward.

git_pullC

Pull changes from a remote repository.

Inputs: repo_path (required), remote, branch, rebase.

git_pushC

Push changes to a remote repository.

Inputs: repo_path (required), remote, branch, force.

git_read_filesC

Read the contents of specified files in a given git repository.

Inputs: repo_url (required), file_paths (required).

git_rebaseC

Rebase the current branch onto another branch or commit.

Inputs: repo_path (required), onto (required), interactive.

git_resetC

Reset repository to specified commit or state.

Inputs: repo_path (required), mode, to.

git_revertC

Revert the current branch to a commit or state.

Inputs: repo_path (required), commit, no_commit.

git_search_codeC

Search for patterns in repository code.

Inputs: repo_url (required), pattern (required), file_patterns, case_sensitive, +1 more.

git_stashC

Create or apply a stash.

Inputs: repo_path (required), action, message, index.

git_trackC

Track (stage) specific files or all files.

Inputs: repo_path (required), files.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 27 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific Git operations, but some overlap exists. For example, git_commit_history and git_commits_details both handle commit information retrieval, and git_clean and git_reset both involve repository state management, which could cause minor confusion. However, descriptions clarify their specific focuses, keeping ambiguity manageable.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with a 'git_' prefix and descriptive verb_noun combinations. Examples include git_checkout_branch, git_merge_branch, and git_search_code. This uniformity makes the tool set predictable and easy to navigate for an agent.

    Tool Count2/5

    With 27 tools, the count is excessive for a Git repository browser. Many tools cover niche or low-level operations that could be consolidated, such as git_lfs and git_lfs_fetch, or git_attributes and git_hooks. This bloated set may overwhelm agents and complicate task selection.

    Completeness5/5

    The tool set provides comprehensive coverage of Git operations, including cloning, branching, committing, merging, searching, and configuration. It supports full CRUD and lifecycle management for repositories, with no obvious gaps. Agents can perform end-to-end workflows without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      A Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.
      14
      115,976 PyPI
      92,301
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.
      28
      6,847 npm
      246
      Apache 2.0
    • A
      license
      C
      quality
      C
      maintenance
      Node.js server implementing Model Context Protocol for git operations, enabling AI assistants to manage git repositories through natural language commands.
      11
      MIT