コードコンテキスト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
- AsecurityFlicenseAqualityMCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.Last updated -1843TypeScript
- -securityAlicense-qualityA 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 -41JavaScriptApache 2.0
- AsecurityFlicenseAqualityMCP server for managing Git operations on local repositories, allowing users to list repositories, get and create tags, list commits, push tags, and refresh repositories through a standardized interface.Last updated -6Python
- -securityAlicense-qualityA MCP server that transforms code repositories from GitHub, GitLab, or local directories into LLM-friendly formats, preserving context and structure for better AI processing.Last updated -1PythonApache 2.0