Skip to main content
Glama
Code Analysis MCP Server

Code Analysis MCP Server

コード分析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: Notion MCP Server

制限事項

このツールは、 Aiderのようなより高度なコード分析ツール/コパイロットのよりシンプルな代替手段です。Aiderのようなツールのような高度なコード分析機能や堅牢性は備えていませんが、Claude Proサブスクリプションを既にお持ちの場合、コードベース探索のための軽量なソリューションを提供します。主な利点は以下のとおりです。

  • コスト効率が高い: 既存のClaude Proサブスクリプションを使用すると、大規模なコードベースを分析する際に高額になる可能性のあるツールとは異なり、追加のAPIコストは発生しません。

  • シンプルなセットアップ:最小限の設定ですぐに始められます

  • 基本分析:高レベルのコード理解と探索に適しています

コード分析に対するアプローチがより単純なため、より専門的なツールに比べてエラーが多くなったり、詳細な分析情報が得られなかったりする可能性があることに注意してください。

🚀 クイックスタート

  1. サーバーをインストールします。

git clone https://github.com/saiprashanths/code-analysis-mcp.git
cd code-analysis-mcp
  1. Claudeデスクトップアプリをインストールします。Claudeデスクトップアプリを使用したMCPサーバーの設定手順の詳細については、ドキュメントを参照してください。

  2. Claude Desktop の構成ファイルでサーバーを構成します。

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "code-analysis": {
      "command": "uv",
      "args": [
        "--directory",
        "/PATH/TO/YOUR/REPO",
        "run",
        "code_analysis.py"
      ]
    }
  }
}
  1. Claude Desktop を再起動してコードの分析を開始してください。

  2. ツールが正しく設定されていることを確認する

  • ツールアイコンをクリックすると、 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ファイルを参照してください。

Available Tools

4 tools
get_repo_infoB

Get information about the currently initialized code repository.

Inputs: no named parameters.

get_repo_structureB

Get the structure of files and directories in the repository.

Args:
    sub_path: Optional subdirectory path relative to repository root
    depth: Optional maximum depth to traverse (default is 3)

Inputs: sub_path, depth.

initialize_repositoryC

Initialize the repository path for future code analysis operations.

Args:
    path: Path to the repository root directory that contains the code to analyze

Inputs: path (required).

read_fileB

Read and display the contents of a file from the repository.

Args:
    file_path: Path to the file relative to repository root

Inputs: file_path (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: initialize_repository sets up the context, get_repo_info provides metadata, get_repo_structure shows the file hierarchy, and read_file accesses file contents. There is no overlap in functionality, making tool selection straightforward for an agent.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern (e.g., initialize_repository, get_repo_info, get_repo_structure, read_file). The naming is uniform and predictable, using snake_case throughout with clear action descriptors.

    Tool Count4/5

    With 4 tools, the count is reasonable for a code analysis server, covering core operations like initialization, metadata retrieval, structure viewing, and file reading. However, it feels slightly thin, as advanced analysis features (e.g., linting, dependency checks) are absent, though not essential for basic functionality.

    Completeness3/5

    The toolset covers basic repository operations (initialize, info, structure, read), but there are notable gaps for a code analysis domain, such as missing tools for analyzing code quality (e.g., lint, test), searching within files, or modifying content. Agents can perform foundational tasks but may hit dead ends for deeper analysis.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers