recode-mcp
v0.1.0
Published
MCP server for ReCode VS Code extension - AI-powered code history integration
Maintainers
Readme
ReCode-MCP
中文
ReCode-MCP 是一个 Model Context Protocol (MCP) 服务器,为 AI 助手提供对 ReCode VS Code 扩展 管理的代码变更历史的访问能力。
✨ 功能特性
- 🔍 查询历史 - 按时间、文件路径查询代码变更记录
- 📝 查看 Diff - 获取任意变更记录的详细差异
- 🔎 内容搜索 - 搜索特定代码何时被添加或删除
- 📊 统计分析 - 查看变更频率、文件活跃度等统计
- 🗂️ 多工作区 - 支持同时管理多个项目的历史
📦 安装
# 克隆仓库
git clone https://github.com/yourusername/ReCode-MCP.git
cd ReCode-MCP
# 安装依赖
npm install
# 构建
npm run build🚀 配置
Claude Desktop
在 ~/Library/Application Support/Claude/claude_desktop_config.json 中添加:
{
"mcpServers": {
"recode": {
"command": "node",
"args": ["/path/to/ReCode-MCP/dist/index.js"]
}
}
}自定义配置
创建 ~/.config/recode-mcp/config.json:
{
"workspaces": [
"/Users/you/projects/myapp"
],
"autoDiscoverWorkspaces": true,
"discoveryPaths": [
"/Users/you/projects"
],
"maxRecordsPerQuery": 1000,
"logLevel": "info"
}🛠️ 可用工具
query_history
查询代码变更历史。
参数:
- workspace_path (必需): 工作区路径
- file_path (可选): 特定文件路径
- since (可选): 开始时间 (ISO 8601)
- until (可选): 结束时间 (ISO 8601)
- limit (可选): 返回数量限制,默认 50get_change_diff
获取特定变更的 diff 内容。
参数:
- workspace_path (必需): 工作区路径
- record_id (必需): 变更记录 ID
- format (可选): 'unified' 或 'side-by-side'search_changes
按内容搜索变更记录。
参数:
- workspace_path (必需): 工作区路径
- search_query (必需): 搜索关键词
- search_in (可选): 'added' | 'removed' | 'both'
- limit (可选): 返回数量限制get_statistics
获取工作区统计信息。
参数:
- workspace_path (必需): 工作区路径
- time_range (可选): 'today' | 'week' | 'month' | 'all'list_workspaces
列出所有发现的 ReCode 工作区。
参数:
- discovery_paths (可选): 额外搜索路径💡 使用示例
与 AI 助手对话:
用户:最近一小时我改了什么代码?
AI:[使用 query_history 工具查询]
用户:查看第 42 条变更的具体内容
AI:[使用 get_change_diff 工具获取 diff]
用户:搜索包含 "authentication" 的变更
AI:[使用 search_changes 工具搜索]📋 前置要求
- Node.js >= 18
- 项目中已安装 ReCode VS Code 扩展
- 项目中存在
.recode/history.db文件
English
ReCode-MCP is a Model Context Protocol (MCP) server that provides AI assistants with access to code change history managed by the ReCode VS Code extension.
✨ Features
- 🔍 Query History - Query code change records by time and file path
- 📝 View Diff - Get detailed diff of any change record
- 🔎 Content Search - Search when specific code was added or removed
- 📊 Statistics - View change frequency, file activity stats
- 🗂️ Multi-workspace - Support multiple projects simultaneously
📦 Installation
# Clone repository
git clone https://github.com/yourusername/ReCode-MCP.git
cd ReCode-MCP
# Install dependencies
npm install
# Build
npm run build🚀 Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"recode": {
"command": "node",
"args": ["/path/to/ReCode-MCP/dist/index.js"]
}
}
}Custom Configuration
Create ~/.config/recode-mcp/config.json:
{
"workspaces": [
"/Users/you/projects/myapp"
],
"autoDiscoverWorkspaces": true,
"discoveryPaths": [
"/Users/you/projects"
],
"maxRecordsPerQuery": 1000,
"logLevel": "info"
}🛠️ Available Tools
query_history
Query code change history.
Parameters:
- workspace_path (required): Workspace path
- file_path (optional): Specific file path
- since (optional): Start time (ISO 8601)
- until (optional): End time (ISO 8601)
- limit (optional): Result limit, default 50get_change_diff
Get diff content of a specific change.
Parameters:
- workspace_path (required): Workspace path
- record_id (required): Change record ID
- format (optional): 'unified' or 'side-by-side'search_changes
Search changes by content.
Parameters:
- workspace_path (required): Workspace path
- search_query (required): Search keyword
- search_in (optional): 'added' | 'removed' | 'both'
- limit (optional): Result limitget_statistics
Get workspace statistics.
Parameters:
- workspace_path (required): Workspace path
- time_range (optional): 'today' | 'week' | 'month' | 'all'list_workspaces
List all discovered ReCode workspaces.
Parameters:
- discovery_paths (optional): Additional search paths💡 Usage Examples
Chat with AI assistant:
User: What code did I change in the last hour?
AI: [Uses query_history tool]
User: Show me the details of change #42
AI: [Uses get_change_diff tool]
User: Search for changes containing "authentication"
AI: [Uses search_changes tool]📋 Prerequisites
- Node.js >= 18
- ReCode VS Code extension installed
.recode/history.dbfile exists in project
📄 License
MIT License
