Skip to main content
Glama

Repo Therapist 🛋️

プレッシャーの下でコードベースが自らを語る

このMCPサーバーは完全にCursorを使用して構築されています

Repo Therapistは、あらゆるリポジトリをクエリ可能で説明可能な知識へと変換するMCP(Model Context Protocol)サーバーです。Cursorを通じてコードベースについて質問し、構造化された洞察に満ちた回答を得ることができます。

何ができるのか

Cursorに対して以下のように質問できます:

  • 「なぜこのサービスはこのような構造になっているのか?」

  • 「これを削除すると何が壊れるのか?」

  • 「このリポジトリのどの部分が懸念されるか?」

Repo Therapistは舞台裏で以下の処理を行います:

  • リポジトリの構造とファイルを読み取る

  • Git履歴とコミットパターンを分析する

  • コードと変更頻度を関連付ける

  • 複雑性のホットスポットとリスクを特定する

Related MCP server: Code Understanding MCP Server

利用可能なツール

ツール

説明

analyze_repo(path)

リポジトリを分析する - 最初にこれを実行してください

get_snapshot(section?)

リポジトリの静的スナップショット(信頼できる情報源)を取得する

get_history(section?)

Git履歴分析(時間軸)を取得する

why_is_this_weird(file_path)

特定のファイルがなぜそのようになっているのかを説明する

ask_repo(question)

分析されたリポジトリについてあらゆる質問をする

repo_summary()

高レベルな概要を取得する

risk_report()

リスク評価レポートを生成する

信頼できる情報源:スナップショット

analyze_repoを実行すると、Repo Therapistは静的スナップショットを作成します。これはリポジトリに関する信頼できる情報源となります。このスナップショットには以下が含まれます:

{
  "files": [...],           // Every file with path, language, line count
  "languages": {...},       // Language breakdown with percentages
  "entryPoints": [...],     // Detected entry points with confidence levels
  "configs": {...},         // Parsed package.json, tsconfig, Dockerfile, CI configs
  "directories": [...]      // Directory structure with inferred purposes
}

なぜこれが重要なのか: LLMは推測ではなく、このスナップショットデータを引用しなければなりません。「このリポジトリではどの言語が使われているか?」と尋ねたとき、回答はLLMの思い込みではなく、スナップショットから得られます。

get_snapshotを使用して特定のセクションを取得します:

  • get_snapshot(section: "files") - メタデータを含む全ファイル

  • get_snapshot(section: "languages") - 言語統計

  • get_snapshot(section: "entryPoints") - 検出されたエントリーポイント

  • get_snapshot(section: "configs") - 解析された設定ファイル

  • get_snapshot(section: "directories") - ディレクトリ構造

  • get_snapshot() - すべての概要

Gitヒストリアン:時間軸

Gitヒストリアンはコミット履歴を分析し、コードがなぜそのようになっているのかを説明します。ここからが本番です。

{
  "fileChurn": { "auth.ts": { "totalCommits": 47, "churnScore": 85 } },
  "authors": { "auth.ts": ["alice", "bob", "charlie"] },
  "fragileFiles": [{ "path": "auth.ts", "reasons": ["high-churn", "many-authors"] }],
  "hotPaths": [...],
  "stableCore": [...]
}

これにより、以下の質問に答えられます:

  • 「なぜここが変なのか?」 → 「6ヶ月間で12回書き直されているからです。」

  • 「このファイルの所有者は誰か?」 → 「係争中 - 4人が修正していますが、30%以上修正した人はいません。」

  • 「何に注意すべきか?」 → 「これら5つのファイルは脆弱でバグが発生しやすいです。」

get_historyを使用して特定の側面を取得します:

  • get_history(section: "churn") - ファイルの変更頻度と変動性

  • get_history(section: "authors") - 貢献者統計

  • get_history(section: "fragile") - 問題を引き起こす可能性が高いファイル

  • get_history(section: "hotPaths") - ホットパスと安定したコアの比較

  • get_history(section: "timeline") - 主要なイベントとコミットパターン

  • get_history(section: "ownership") - 所有者の特定

  • get_history() - すべての概要

特定のファイル分析には why_is_this_weird を使用します:

Use why_is_this_weird on "src/auth/login.ts"

引用付きの詳細な説明が返されます:

# Why is "src/auth/login.ts" the way it is?

## Change History
- Total commits: 47
- Authors: 5 (alice, bob, charlie, dave, eve)
- Churn score: 85 ⚠️ HIGH

## 🔍 Why It's Unusual
**Heavily modified:** This file has been changed 47 times...
**Many hands:** 5 different people have modified this file...

セットアップ

1. 依存関係のインストール

cd repo-therapist
npm install

2. プロジェクトのビルド

npm run build

3. Cursorへの追加

Cursorの設定 → MCP → 新しいMCPサーバーの追加を開きます:

{
  "mcpServers": {
    "repo-therapist": {
      "command": "node",
      "args": ["/FULL/PATH/TO/repo-therapist/dist/index.js"]
    }
  }
}

重要: /FULL/PATH/TO/repo-therapist フォルダへの実際の絶対パスに置き換えてください。

例:

{
  "mcpServers": {
    "repo-therapist": {
      "command": "node",
      "args": ["/Users/saar/Projects/private/repo-therapist/dist/index.js"]
    }
  }
}

4. Cursorの再起動

MCP設定を追加した後、変更を反映させるためにCursorを再起動してください。

FAQ

repo-therapistを個別に実行する必要がありますか?

いいえ。 Cursorが自動的にMCPサーバーを開始・管理します。CursorのMCP設定に構成を追加すると、Cursorは以下の処理を行います:

  • 必要に応じて node dist/index.js プロセスを開始する

  • バックグラウンドで実行し続ける

  • stdio(標準入出力)を介して通信する

一度ビルド(npm run build)し、設定を追加してCursorを再起動するだけで完了です。

どこで質問すればよいですか?

通常のCursorチャット(Cmd+L またはチャットパネル)で行います。違いは質問の方法です:

  • MCPなし: 「このリポジトリは何をするもの?」 → Cursorは組み込みツールを使用します

  • Repo Therapistあり:/path/to/repo に対して analyze_repo を使用して」 → CursorはMCPツールを呼び出します

明示的にCursorに対してrepo-therapistツールを使うよう指示します。Cursorはそれらを活用可能な追加機能として認識します。

通常のCursorチャットとの違いは何ですか?

通常のCursorチャット

Repo Therapistあり

必要に応じてファイルを読み取る

リポジトリ構造全体を事前分析する

Git履歴を認識しない

コミットパターンとチャーンを分析する

読み取った内容に基づいて回答する

構造化された分析に基づいて回答する

リスク検知なし

複雑性のホットスポットを特定する

一般的なコード理解

ドメイン固有の洞察(「何が懸念されるか?」)

主な違い: Repo Therapistは事前に構造化された分析を行い、それを保存します。そのため、「どのファイルが最も頻繁に変更されるか?」や「リスクは何か?」といった質問に対し、Cursorが毎回計算するのではなく、事前計算されたデータから回答できます。

Cursorは賢いが受動的であるのに対し、Repo Therapistはコードベースに関する「ブリーフィングドキュメント」を提供し、それを参照できるようにするものだと考えてください。

使用方法

設定が完了したら、CursorチャットでRepo Therapistを使用できます:

ステップ 1: リポジトリの分析

まず、探索したいリポジトリを分析します:

Use analyze_repo to analyze /path/to/some/repo

ステップ 2: 質問する

これで質問が可能になります:

Use ask_repo to answer: "What does this repo do?"
Use ask_repo to answer: "Which parts of this repo scare you?"
Use ask_repo to answer: "What will break if I remove the auth module?"

ステップ 3: レポートを取得する

概要を取得:

Use repo_summary to show me an overview

リスク評価を取得:

Use risk_report to identify potential issues

質問例

  • 「このリポジトリは何をするもの?」

  • 「コードはどのように構造化されているか?」

  • 「どのような技術スタックが使われているか?」

  • 「依存関係を表示して」

  • 「最も大きなファイルはどれか?」

  • 「どのファイルが最も頻繁に変更されるか?」

  • 「貢献者は誰か?」

  • 「最近のコミットは?」

  • 「どの部分が懸念されるか?」

  • 「Xを変更すると何が壊れるか?」

開発

開発モードで実行

npm run dev

本番用にビルド

npm run build

テストの実行

npm test              # Run all tests
npm run test:watch    # Run tests in watch mode
npm run test:coverage # Run tests with coverage report

テストガイドライン

注: 新機能を実装する際は必ずユニットテストを追加してください。

テストは tests/ に配置され、Vitest を使用します。テスト構造はソースを反映しています:

tests/
├── fixtures/           # Test utilities and mock repos
│   └── setup.ts        # Helper functions for creating test repos
├── scanner/            # Scanner module tests
├── historian/          # Historian module tests
├── tools/              # Tool tests
└── cache.test.ts       # Cache tests

新機能を追加する場合:

  1. 適切な tests/ サブディレクトリにテストを作成する

  2. Git関連のテストには fixtures/setup.tscreateTestRepo() を使用する

  3. afterAllcleanupTestRepo() を使用してテストリポジトリをクリーンアップする

  4. コミット前に npm test を実行してすべてのテストが通過することを確認する

プロジェクト構造

repo-therapist/
├── src/
│   ├── index.ts              # MCP server entry point
│   ├── cache.ts              # In-memory repo cache
│   ├── types.ts              # TypeScript interfaces
│   ├── scanner/              # Static snapshot engine (Step 2)
│   │   ├── index.ts          # Scanner exports
│   │   ├── types.ts          # Snapshot type definitions
│   │   └── scan-repo.ts      # Repository scanner
│   ├── historian/            # Git history analyzer (Step 3)
│   │   ├── index.ts          # Historian exports
│   │   ├── types.ts          # History type definitions
│   │   └── analyze-history.ts # Git history analysis
│   └── tools/
│       ├── analyze-repo.ts   # Repository analyzer (orchestrates all)
│       ├── get-snapshot.ts   # Snapshot retrieval (ground truth)
│       ├── get-history.ts    # History retrieval (time dimension)
│       ├── ask-repo.ts       # Question answering
│       ├── repo-summary.ts   # Summary generator
│       └── risk-report.ts    # Risk assessment
├── tests/                    # Unit tests
│   ├── fixtures/             # Test utilities
│   ├── scanner/              # Scanner tests
│   ├── historian/            # Historian tests
│   └── tools/                # Tool tests
├── package.json
├── tsconfig.json
├── vitest.config.ts          # Test configuration
└── README.md

技術スタック

  • TypeScript - 型安全なコードベース

  • @modelcontextprotocol/sdk - MCPサーバー実装

  • simple-git - Git履歴分析

  • ts-morph - TypeScript/JavaScript AST解析(予定)

  • glob - ファイルパターンマッチング

ロードマップ

  • [ ] ts-morphによるASTベースのコード解析

  • [ ] JSON/SQLiteへの分析結果の永続化

  • [ ] 依存関係グラフの可視化

  • [ ] セキュリティ脆弱性検知

  • [ ] テストカバレッジ分析

  • [ ] カスタム質問ハンドラー

ライセンス

MIT

Install Server
F
license - not found
A
quality
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • A MCP server built for developers enabling Git based project management with project and personal…

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • Scan any public GitHub MCP-server repo for security issues. 37 MCP-specific L1 rules, 8 languages.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/salman-arefin74/repo-therapist'

If you have feedback or need assistance with the MCP directory API, please join our Discord server