コードコンテキストMCPサーバー
ローカルGitリポジトリからコードコンテキストを提供するためのモデルコンテキストプロトコル(MCP)サーバー。このサーバーでは以下のことが可能です。
- Gitリポジトリをローカルにクローンする
- プロセスブランチとファイル
- コードチャンクの埋め込みを生成する
- コード上でセマンティック検索を実行する
特徴
- GitHub APIの代わりにローカルのgitリポジトリを使用する
- SQLiteデータベースにデータを保存する
- コードを意味のあるチャンクに分割する
- Ollamaを使用してコードチャンクの埋め込みを生成する
- コード上のセマンティック検索を提供
前提条件
- Node.js (v16+)
- ギット
- 埋め込みモデルを備えたOllama
インストール
構成
次の環境変数を設定します。
DATA_DIR
: SQLite データベースのディレクトリ (デフォルト: '~/.codeContextMcp/data')REPO_CACHE_DIR
: クローンされたリポジトリのディレクトリ (デフォルト: '~/.codeContextMcp/repos')
Ollamaの使用
より高速で強力な埋め込みには、Ollama を使用できます。
使用法
Claude Desktopでの使用
Claude Desktop 構成ファイル ( claude_desktop_config.json
) に次の構成を追加します。
ツール
サーバーは次のツールを提供します。
クエリリポジトリ
リポジトリのクローンを作成し、コードを処理し、セマンティック検索を実行します。
branch
パラメータはオプションです。指定されていない場合、ツールはリポジトリのデフォルトブランチを自動的に使用します。
keywords
パラメータはオプションです。指定した場合、結果は指定されたキーワードの少なくとも1つを含むチャンクのみにフィルタリングされます(大文字と小文字は区別されません)。
filePatterns
およびexcludePatterns
パラメータはオプションです。これらを使用すると、処理および検索対象となるファイルを glob パターンでフィルタリングできます(例: すべての TypeScript ファイルの場合は**/*.ts
)。
データベーススキーマ
サーバーは次のスキーマで SQLite を使用します。
repository
:リポジトリに関する情報を保存しますbranch
: ブランチに関する情報を保存しますfile
: ファイルに関する情報を保存しますbranch_file_association
: ファイルをブランチに関連付けるfile_chunk
: コードチャンクとその埋め込みを保存する
ライセンス
マサチューセッツ工科大学
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
ローカル Git リポジトリに対するセマンティック検索を提供する MCP サーバー。これにより、ユーザーはリポジトリのクローン作成、ブランチの処理、ベクトル化されたコード チャンクによるコードの検索が可能になります。
Related MCP Servers
- AsecurityAlicenseAqualityA specialized MCP server for in-depth analysis of git repositories, offering tools for branch overview, time period analysis, file changes, and merge recommendations.Last updated -42Apache 2.0
- -securityFlicense-qualityAn MCP server that enables Git repository operations and GitHub PR workflows, allowing users to manage repositories, create branches, commit changes, and create pull requests through natural language.Last updated -1
- AsecurityAlicenseAqualityAn MCP server that allows users to efficiently search and reference user-configured documents through document listing, grep searching, semantic searching with OpenAI Embeddings, and full document retrieval.Last updated -43MIT License