VC

vltansky/cursor-chat-history-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

33 stars 11 forks 质量 73 趋势 11MIT

你做出承诺。几周后你会想:“我为什么要这样写?”

概览

你做出承诺。几周后你会想:“我为什么要这样写?” git 消息说修复认证漏洞,但真正的背景——调试会话、考虑的替代方案、AI 建议——都存在于一个你永远找不到的光标对话中。 这个MCP服务器会自动将你的光标对话与git提交关联。当你重新查看代码时,AI助手可以调出原始讨论内容。 就这么简单。钩子在第一次使用时会自动安装。 - - 没有外部服务,没有API密钥 - - 仅用SQLite数据库 - - 自己审计代码 当MCP服务器启动时,钩子会自动安装:- (~/.cursor/hooks.json) - 捕获文件编辑和会话结束 - (当前仓库)- 连接提交对话 提交时,系统会通过以下方式查找相关对话:- : 涉及对话中讨论的文件提交 - : 过去14天内的对话 大型对话不会直接加载到上下文中。相反:1.

概述(AI 翻译)

将你的光标对话连接到你的git历史记录。

为什么?

你做出承诺。几周后你会想:“我为什么要这样写?”*

git 消息显示 fix auth bug,但真正的上下文——调试会话、考虑的替代方案、AI 建议——都存在于一个你永远找不到的光标对话中。

这个MCP服务器会自动将你的光标对话与git提交关联。当你重新查看代码时,AI助手可以调出原始讨论内容。

快速启动

加到.cursor/mcp.json:

就这么简单。钩子在第一次使用时会自动安装。

你能做什么

为代码寻找上下文

搜索你的聊天记录

提取模式

可用工具

Git Linker

工具 目的
get_file_context 获取与文件相关的对话和提交
get_commit_conversations 查找与提交相关的对话
list_conversation_commits 查找与对话相关的提交
link_conversation_commit 手动链接对话↔提交

聊天历史

工具 目的
list_conversations 使用筛选器浏览(项目、关键词、文件)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Cursor Chat History MCP

Connect your Cursor conversations to your git history.

Why?

You make a commit. Weeks later you wonder: “Why did I write it this way?”

The git message says fix auth bug but the real context - the debugging session, the alternatives considered, the AI suggestions - lives in a Cursor conversation you’ll never find again.

This MCP server automatically links your Cursor conversations to git commits. When you revisit code, the AI assistant can pull up the original discussion.

Quick Start

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "cursor-chat-history": {
      "command": "npx",
      "args": ["-y", "--package=cursor-chat-history-mcp", "cursor-chat-history-mcp"]
    }
  }
}

That’s it. Hooks install automatically on first use.

What You Can Do

Find Context for Code

"What was the context behind commit abc123?"
"Find the conversation that led to this fix"
"Show discussions about auth.ts from the last month"

Search Your Chat History

"Find all debugging sessions about performance"
"Search conversations mentioning useState"
"List recent conversations in this project"

Extract Patterns

"Create TypeScript guidelines from my actual usage"
"Extract error handling patterns from my conversations"
"Summarize my React patterns from chat history"

Available Tools

Git Linker

Tool Purpose
get_file_context Get conversations and commits related to a file
get_commit_conversations Find conversations linked to a commit
list_conversation_commits Find commits linked to a conversation
link_conversation_commit Manually link conversation ↔ commit

Chat History

Tool Purpose
list_conversations Browse with filters (project, keywords, files)
get_conversation Get full conversation content
search_conversations Multi-keyword and pattern search
get_conversation_analytics Usage patterns, file activity, language stats

Privacy

  • 100% local - No external services, no API keys
  • Your data stays on disk - SQLite databases only
  • Open source - Audit the code yourself

How It Works

Hooks are installed automatically when the MCP server starts:

  • Cursor hooks (~/.cursor/hooks.json) - capture file edits and session ends
  • Git post-commit hook (current repo) - link commits to conversations

When you commit, the system finds related conversations using:

  • File overlap (70%): Commits touching files discussed in conversations
  • Recency (30%): Conversations from the last 14 days

Efficient Context Retrieval

Large conversations aren’t loaded directly into context. Instead:

在 GitHub 查看完整 README

安装

npx -y --package=cursor-chat-history-mcp cursor-chat-history-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "cursor-chat-history": { "command": "npx", "args": ["-y", "--package=cursor-chat-history-mcp", "cursor-chat-history-mcp"] } } }