コード分析MCPサーバー
AI モデルが自然言語の会話を通じてコードベースを理解し、分析できるようにするモデル コンテキスト プロトコル (MCP) サーバー。
✨ ハイライト
自然なコード探索: コードベースについて高レベルの質問をする
"What are all the different payment providers integrated in the system?"コードの深い理解: データモデルとシステムアーキテクチャに関する洞察を抽出
"How does the user authentication flow work from frontend to database?"動的解析: データフローをトレースし、システムの関係を理解する
"Show me all the places where we calculate transaction fees"
Related MCP server: MCP-Python
制限事項
このツールは、 Aiderのようなより高度なコード分析ツール/コパイロットのよりシンプルな代替手段です。Aiderのようなツールのような高度なコード分析機能や堅牢性は備えていませんが、Claude Proサブスクリプションを既にお持ちの場合、コードベース探索のための軽量なソリューションを提供します。主な利点は以下のとおりです。
コスト効率が高い: 既存のClaude Proサブスクリプションを使用すると、大規模なコードベースを分析する際に高額になる可能性のあるツールとは異なり、追加のAPIコストは発生しません。
シンプルなセットアップ:最小限の設定ですぐに始められます
基本分析:高レベルのコード理解と探索に適しています
コード分析に対するアプローチがより単純なため、より専門的なツールに比べてエラーが多くなったり、詳細な分析情報が得られなかったりする可能性があることに注意してください。
🚀 クイックスタート
サーバーをインストールします。
git clone https://github.com/saiprashanths/code-analysis-mcp.git
cd code-analysis-mcpClaudeデスクトップアプリをインストールします。Claudeデスクトップアプリを使用したMCPサーバーの設定手順の詳細については、ドキュメントを参照してください。
Claude Desktop の構成ファイルでサーバーを構成します。
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"code-analysis": {
"command": "uv",
"args": [
"--directory",
"/PATH/TO/YOUR/REPO",
"run",
"code_analysis.py"
]
}
}
}Claude Desktop を再起動してコードの分析を開始してください。
ツールが正しく設定されていることを確認する
ツールアイコンをクリックすると、
code-analysisツールが表示されます。統合ボタンをクリックすると
analyze_code_repositoryプロンプトが表示されます。
💡 使用例
複雑なコードベースを理解するためにツールを使用する方法は次のとおりです。
まず、以下に示すanalyze_code_repositoryプロンプトをクリックしてください。リポジトリを初期化して作業を開始する手順が案内されます。
You: How does the transaction processing work in this system?
Claude: Let me analyze the data flow for transactions.
Looking at the codebase, I can see that transaction processing happens through several key components:
1. Raw transaction data is captured in the `TransactionEvent` model with fields for:
- Payment status
- Amount
- Fee calculations
- Processing timestamps
2. This data is then processed through the PaymentSummary model, which:
- Validates payment provider responses
- Calculates processing fees
- Records transaction status
Would you like me to explain any part of this in more detail?
You: What are the key database tables involved?
Claude: The main tables in the transaction processing pipeline are:
1. transaction_events: Stores raw payment events
2. payment_summary: Processed transaction records
3. payment_providers: Provider configuration
4. merchant_accounts: Account-specific settings
Let me know if you'd like to see the schema for any of these tables!🔧 利用可能なツール
リポジトリの初期化
分析用のコード リポジトリを初期化します。
initialize_repository("/path/to/repo")
# Output: Successfully initialized code repository at: /path/to/repoリポジトリ情報を取得する
初期化されたリポジトリに関する情報を取得します。
get_repo_info()
# Output:
# Code Repository Information:
# Path: /path/to/repo
# Exists: True
# Is Directory: True
# Found .gitignore fileリポジトリ構造を取得する
リポジトリのファイル構造を調べます。
get_repo_structure(depth=2)
# Output:
# 📁 src/
# 📁 api/
# 📄 routes.py
# 📄 models.py
# 📁 utils/
# 📄 helpers.py
# 📄 main.py読み取りファイル
特定のファイルを読み取って分析します。
read_file("src/api/models.py")
# Output:
# File: src/api/models.py
# Language: python
# Size: 2.3 KB
#
# [File contents...]⚙️ 技術的な詳細
デフォルトのスキャン深度: 3 レベル
最大ファイルサイズ: 1MB
ファイルあたりの最大行数: 1000
.gitignore にリストされているパスを無視します
ローカルファイルシステムへのアクセスのみ
ディレクトリトラバーサルを防ぐためにファイルパスを検証します
📝 ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。