mcpField
H
Hindsight MCP

Hindsight MCP

本地服务
github.com/Rbfinch开发工具540 周前更新

关于 Hindsight MCP

Hindsight MCP 是面向 VS Code 编码助手的 MCP 服务,将 Git 历史、测试结果和 GitHub Copilot 会话汇入可搜索的 SQLite 数据库,并提供时间线、摘要和刷新工具。

主要功能

  1. 01全文搜索提交记录和 Copilot 对话
  2. 02关联测试结果与提交
  3. 03查看活动时间线和摘要
  4. 04自动导入 Git 与 Copilot 数据
  5. 05运行测试并导入结果

适用场景

  1. 01查找与某主题相关的提交
  2. 02回顾近期工作和测试运行
  3. 03按提交检查失败的测试
  4. 04汇总一段时间内的开发活动

MCP 相关

向 MCP 客户端提供工具,用于搜索和查看开发历史、查询测试失败情况及刷新已导入的数据。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库
安装包
mcpbhindsight-mcp-v0.1.5-x86_64-unknown-linux-gnu.tar.gz
mcpbhindsight-mcp-v0.1.5-aarch64-unknown-linux-gnu.tar.gz
mcpbhindsight-mcp-v0.1.5-x86_64-apple-darwin.tar.gz
mcpbhindsight-mcp-v0.1.5-aarch64-apple-darwin.tar.gz
mcpbhindsight-mcp-v0.1.5-x86_64-pc-windows-msvc.zip

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Hindsight 徽标

hindsight-mcp

一款利用开发历史记录辅助 AI 编码的 MCP 服务。

概述

hindsight-mcp 将开发数据(git 日志、测试结果和 GitHub Copilot 会话)整合到可搜索的 SQLite 数据库中,并通过 MCP 工具调用在 VS Code 中提供给 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}"]
    }
  }
}
验证设置
  1. 打开 VS Code 命令面板(Cmd+Shift+P)
  2. 运行 "MCP: List Servers"
  3. 确认列表中有 hindsight
  4. 在 Copilot Chat 中切换到 Agent 模式
  5. 询问:“我最近在做什么?”

就这样!Copilot 会使用 hindsight 工具回答有关开发历史的问题。

MCP 工具

工具用途提示词示例
hindsight_timeline按时间顺序查看活动“显示最近的提交和测试运行”
hindsight_search全文搜索“查找与身份验证相关的提交”
hindsight_failing_tests查询测试失败情况“哪些测试失败了?”
hindsight_activity_summary汇总统计数据“总结我这一周的工作”
hindsight_commit_details包含测试信息的提交详情“提交 abc123 的详情”
hindsight_ingest触发数据刷新“刷新开发历史记录”
工具参数参考
hindsight_timeline
  • limit(int):事件数量上限,默认为 50
  • workspace(string):按路径筛选
hindsight_search
  • query(string):搜索查询(必填)
  • source(string):"all"、"commits" 或 "messages"
  • limit(int):结果数量上限,默认为 20
hindsight_failing_tests
  • limit(int):测试数量上限,默认为 50
  • workspace(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):仅处理新数据,默认为 true
  • limit(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

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。