Hindsight MCP について
Hindsight MCPは、VS Codeのコーディングアシスタント向けMCPサーバーです。Git履歴、テスト結果、GitHub Copilotのセッションを検索可能なSQLiteデータベースに集約し、タイムラインや要約、更新機能を提供します。
主な機能
- 01コミットとCopilotチャットの全文検索
- 02コミットにテスト結果を関連付け
- 03アクティビティのタイムラインと要約
- 04GitとCopilotデータの自動取り込み
- 05テスト実行と結果の取り込み
活用シーン
- 01特定の話題に関するコミットの検索
- 02最近の作業とテスト実行の確認
- 03コミットごとの失敗テストの調査
- 04一定期間の開発アクティビティの要約
MCP 対応
開発履歴の検索・確認、テスト失敗の照会、取り込みデータの更新を行うツールをMCPクライアントに公開します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
hindsight-mcp
開発履歴を活用する、AI 支援コーディング向けの MCP サーバーです。
概要
hindsight-mcp は、開発データ(git ログ、テスト結果、GitHub Copilot のセッション)を検索可能な SQLite データベースに集約し、VS Code で MCP ツール呼び出しを通じて AI アシスタントから利用できるようにします。
主な機能:
- コミットと Copilot の会話を対象とした全文検索
- 特定のコミットに関連付けたテスト結果の追跡
- アクティビティの要約とタイムライン表示
- git と Copilot セッションの自動取り込み
クイックスタート
前提条件
- GitHub Copilot を備えた VS Code v1.99+
- cargo-nextest(テストの取り込み用):
cargo install cargo-nextest
インストール
cargo install hindsight-mcp
VS Code の設定
プロジェクトに .vscode/mcp.json を作成します。
{
"servers": {
"hindsight": {
"type": "stdio",
"command": "hindsight-mcp",
"args": ["--workspace", "${workspaceFolder}"]
}
}
}
セットアップの確認
- VS Code のコマンドパレット(
Cmd+Shift+P)を開きます - **「MCP: List Servers」**を実行します
hindsightが一覧に表示されていることを確認します- Copilot Chat でエージェントモードに切り替えます
- *「最近、どんな作業をしていましたか?」*と質問します
これで完了です!Copilot は hindsight ツールを使って、開発履歴に関する質問に回答します。
MCP ツール
| ツール | 用途 | プロンプトの例 |
|---|---|---|
hindsight_timeline | 時系列のアクティビティ表示 | 「最近のコミットとテスト実行を表示して」 |
hindsight_search | 全文検索 | 「認証に関するコミットを探して」 |
hindsight_failing_tests | テストの失敗を検索 | 「失敗しているテストは何ですか?」 |
hindsight_activity_summary | 統計の集計 | 「今週の作業を要約して」 |
hindsight_commit_details | テストを含むコミット情報 | 「コミット abc123 の詳細」 |
hindsight_ingest | データ更新の実行 | 「開発履歴を更新して」 |
ツール引数リファレンス
hindsight_timeline
limit(int):イベントの最大数。既定値は 50workspace(string):パスで絞り込み
hindsight_search
query(string):検索クエリ(必須)source(string):「all」、「commits」、または「messages」limit(int):結果の最大数。既定値は 20
hindsight_failing_tests
limit(int):テストの最大数。既定値は 50workspace(string):パスで絞り込みcommit(string):SHA で絞り込み
hindsight_activity_summary
days(int):要約する日数。既定値は 7
hindsight_commit_details
sha(string):コミット SHA(必須)
hindsight_ingest
workspace(string):取り込むパス(必須)source(string):「git」、「copilot」、または「all」incremental(bool):新しいデータのみ。既定値は truelimit(int):項目の最大数
テストの取り込み
テストを実行し、結果を自動的に取り込みます。
# Run all tests and ingest
hindsight-mcp test
# Test specific package
hindsight-mcp test -p my-crate
# Preview without writing to database
hindsight-mcp test --dry-run
test コマンドは次の処理を自動的に行います。
- 適切なフラグを指定して
cargo nextestを起動します - 現在の git コミットを自動検出します
- 結果をデータベースに取り込みます
CI/高度な使い方
CI パイプラインやカスタムの nextest 呼び出しの場合:
# Using stdin mode
NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 cargo nextest run \
--message-format libtest-json 2>/dev/null | \
hindsight-mcp test --stdin
# Using ingest command with explicit commit
NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 cargo nextest run \
--message-format libtest-json 2>/dev/null | \
hindsight-mcp ingest --tests --commit $(git rev-parse HEAD)
データソース
| ソース | 収集するデータ |
|---|---|
| Git | コミット(SHA、作成者、メッセージ、タイムスタンプ、親) |
| テスト | 実行メタデータ、結果、所要時間、失敗時の出力 |
| Copilot | チャットセッション、プロンプト、応答、添付ファイル |
Git と Copilot のデータは自動的に取り込まれます。テスト結果を取り込むには hindsight-mcp test を実行する必要があります。
CLI リファレンス
hindsight-mcp [OPTIONS] [COMMAND]
Commands:
ingest Ingest data from various sources
test Run tests and ingest results
Options:
-d, --database <PATH> Database path [default: ~/.hindsight/hindsight.db]
-w, --workspace <PATH> Workspace path [default: current directory]
-v, --verbose Debug logging
-q, --quiet Errors only
--skip-init Skip database init
-h, --help Print help
-V, --version Print version
test サブコマンドのオプション
hindsight-mcp test [OPTIONS] [-- <NEXTEST_ARGS>...]
Options:
-p, --package <PKG> Package(s) to test
--bin <BIN> Binary(ies) to run
-E, --filter <EXPR> Filter expression
--stdin Read from stdin
--dry-run Preview only
--no-commit Do not link to commit
--commit <SHA> Explicit commit SHA
--show-output Show test output
環境変数
| 変数 | 説明 |
|---|---|
HINDSIGHT_DATABASE | データベースのパス |
HINDSIGHT_WORKSPACE | 既定のワークスペース |
データベースの場所
| プラットフォーム | 既定のパス |
|---|---|
| macOS | ~/Library/Application Support/hindsight/hindsight.db |
| Linux | ~/.local/share/hindsight/hindsight.db |
| Windows | %LOCALAPPDATA%\hindsight\hindsight.db |
トラブルシューティング
| 問題 | 解決方法 |
|---|---|
| サーバーが起動しない | バイナリのパスを確認し、--verbose を指定して実行します |
| データが表示されない | Copilot 経由で hindsight_ingest ツールを実行します |
| ログが干渉する | 本番環境では --quiet を使用します |
開発
ソースからのビルド
git clone https://github.com/Rbfinch/hindsight-mcp.git
cd hindsight-mcp
cargo build --release
テストの実行
cargo install cargo-nextest
cargo nextest run --workspace
ワークスペースの構成
hindsight/
├── crates/
│ ├── hindsight-mcp/ # MCP server binary
│ ├── hindsight-git/ # Git log processing
│ ├── hindsight-tests/ # Test result processing
│ └── hindsight-copilot/ # Copilot session parsing
ファジング
cd crates/hindsight-tests
cargo +nightly fuzz run fuzz_nextest_run
cd crates/hindsight-copilot
cargo +nightly fuzz run fuzz_session_json
ライセンス
MIT
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。