克劳德作家援助MCP
一种模型上下文协议(MCP)服务器,专为使用markdown手稿的作者和作者而设计。提供集成到Claude Code中的智能分析、质量检查和写作辅助工具。
💡 它做什么
- 手稿索引 -自动索引和跟踪写作项目中的所有markdown文件
- 语义搜索 -使用自然语言查询在手稿中查找内容
- 质量分析 -检查术语的一致性、可读性、重复性和结构问题
- 链路管理 -验证内部链接,查找损坏的引用,并建议交叉引用
- 进度跟踪 -监控字数、跟踪变化并生成进度报告
- 主题提取 -发现并分析内容中重复出现的主题
- TODO管理 -提取并跟踪所有TODO、FIXME和DRAFT标记
- 写作统计 -为您的写作项目提供全面的指标和分析
⚠️ 重要提示:仅限Claude代码CLI
此MCP服务器仅适用于 克劳德代码CLI.
它不适用于:
- ❌ 克劳德桌面
- ❌ 克劳德·韦伯
- ❌ 其他Claude集成
Writer’s Aid MCP将手稿数据存储在 .writers-aid/manuscript.db 在您的项目文件夹中,将所有写作数据与手稿文件放在一起。
📦 安装
先决条件
必修的:
- 克劳德代码CLI: https://github.com/anthropics/claude-code
- Node.js:版本18或更高版本
快速安装(推荐)
从npm全局安装:
# Install the package globally
npm install -g claude-writers-aid-mcp
# Auto-configure for Claude Code CLI
writers-aid init-mcp就是这样!这 init-mcp 命令自动执行:
- 检测您的安装路径
- 配置
~/.claude.json使用正确的设置 - 提供验证的后续步骤
替代方案:开发安装
对于此存储库的本地开发/使用:
# Clone the repository
git clone https://github.com/xiaolai/claude-writers-aid-mcp.git
cd claude-writers-aid-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Configure MCP server
npm run init-mcp手动配置(高级)
如果您更喜欢手动设置,请添加到您的 ~/.claude.json (不是 ~/.claude/config.json):
{
"mcpServers": {
"writers-aid": {
"type": "stdio",
"command": "node",
"args": [
"/path/to/claude-writers-aid-mcp/dist/index.js"
]
}
}
}替换 /path/to/ 使用安装包的实际路径。
验证安装
检查您的MCP配置:
writers-aid mcp-status重新启动Claude Code CLI并使用以下命令进行测试:
"Index my manuscript files"
"Check my manuscript for quality issues"
"Show writing statistics"如果MCP工具正常工作,您将看到分析结果和统计数据!
MCP配置命令
该软件包包括管理Claude Code MCP配置的命令:
# Check MCP configuration status
writers-aid mcp-status
# Configure or update MCP server
writers-aid init-mcp
# Remove MCP configuration
writers-aid remove-mcp重要提示:更新后重新启动
升级到新版本时,您必须重新启动Claude Code CLI以重新加载MCP服务器:
- 完全退出Claude Code CLI
- 重新开始
- 将加载新版本
为什么? Claude Code缓存MCP服务器。如果不重新启动,它将继续使用旧的缓存版本,即使您已经全局升级了npm包。
快速检查:重新启动后,您可以使用以下命令验证版本:
claude-conversation-memory-mcp --version🖥️ 独立CLI/REPL模式
除了MCP服务器之外,此软件包还包括一个强大的 独立CLI 用于直接从终端管理您的对话记忆。
三种操作模式
1.交互式REPL模式 (默认)
claude-conversation-memory-mcp
# Starts interactive shell with 40+ commands2.单命令模式
claude-conversation-memory-mcp status
claude-conversation-memory-mcp "search authentication"
claude-conversation-memory-mcp mistakes --limit 53.MCP服务器模式 (由Claude Code CLI使用)
claude-conversation-memory-mcp --server
# Or automatically via stdio from Claude Code CLI快速CLI示例
# View database status
claude-conversation-memory-mcp status
# Index conversations
claude-conversation-memory-mcp index --include-mcp
# Search for topics
claude-conversation-memory-mcp "search database migration" --limit 3
# Find past mistakes
claude-conversation-memory-mcp mistakes "async" --type logic_error
# Check file context before editing
claude-conversation-memory-mcp check src/auth.ts
# Configure embedding model
claude-conversation-memory-mcp config
claude-conversation-memory-mcp set model mxbai-embed-large
claude-conversation-memory-mcp set dimensions 1024
# View help
claude-conversation-memory-mcp help
claude-conversation-memory-mcp "help search"配置管理
CLI包括用于管理嵌入模型和维度的内置命令:
# View current configuration
claude-conversation-memory-mcp config
# Switch to Ollama with mxbai-embed-large (1024 dimensions)
claude-conversation-memory-mcp set provider ollama
claude-conversation-memory-mcp set model mxbai-embed-large
claude-conversation-memory-mcp set dimensions 1024
# Switch to Transformers.js (offline, no setup)
claude-conversation-memory-mcp set provider transformers
claude-conversation-memory-mcp set model Xenova/all-MiniLM-L6-v2
claude-conversation-memory-mcp set dimensions 384
# Get specific config value
claude-conversation-memory-mcp get provider可用命令
- 📥 索引:
index,reindex - 🔍 搜索:
search,decisions,mistakes,similar - 📋 文件:
check,history - 🔗 Git:
commits - 📝 其他:
requirements,tools,docs - ℹ️ 信息:
status,version,help - ⚙️ 配置:
config,get,set - 🧹 维护:
vacuum,reset
👉 看 完整的CLI指南 对于所有命令、示例和工作流
🎯 用法示例
首次设置
You: "Index my conversation history for this project"
Claude: I'll index all conversations for this project...
✓ Indexed 5 conversations with 2,341 messages
✓ Semantic search enabled (embeddings generated)搜索过去的对话
You: "What did we discuss about the authentication system?"
Claude: Let me search our conversation history...
[Returns relevant messages with context and timestamps]修改文件之前
You: "Before I change database.ts, what should I know?"
Claude: Let me check the context for database.ts...
[Shows recent changes, related decisions, and past mistakes]跟踪决策
You: "Why did we choose SQLite over PostgreSQL?"
Claude: Let me check our decision history...
[Returns the decision with rationale and alternatives considered]从错误中吸取教训
You: "Have we had issues with async/await before?"
Claude: Let me search past mistakes...
[Shows previous errors and how they were fixed]查找相关工作
You: "Have we worked on similar API endpoints before?"
Claude: Let me find similar sessions...
[Returns past conversations about similar work]查看文件历史
You: "Show me how auth.ts evolved over time"
Claude: Let me trace the file evolution...
[Shows complete timeline with conversations, commits, and decisions]回忆和应用上下文
You: "Recall how we implemented authentication, now add OAuth support using that same pattern"
Claude: Let me recall the authentication implementation context...
[Returns relevant conversations, decisions, mistakes, file changes, and commits]
[Provides suggestions for applying this context to OAuth implementation]更多示例:
- “记住我们在parser.ts中修复的错误,检查lexer.ts中是否存在类似的问题”
- “回想所有关于数据库模式的决定,现在设计迁移策略”
- “找到我们在async/await中犯的错误,在这个新的async函数中避免它们”
🔧 高级用法
指数特定会议
You: "Index conversation from session a1172af3-ca62-41be-9b90-701cef39daae"排除MCP对话
默认情况下,关于MCP本身的对话被排除在外,以防止自我引用循环。要包括它们:
You: "Index all conversations, including MCP conversations"索引选项
在为对话建立索引时,有几个选项可以控制存储的内容:
包括思维障碍
默认: false (思维障碍除外)
思维块包含克劳德的内部推理过程。他们可以 非常大 (3-5倍的数据),通常不需要搜索。
# Default behavior (recommended)
You: "Index conversations"
# Thinking blocks are excluded
# Include thinking blocks (increases database size significantly)
You: "Index conversations with thinking blocks"何时启用:
- ✅ 你想搜索克劳德的推理过程
- ✅ 你正在分析决策模式
- ❌ 如果您只想搜索可见的对话内容,请不要启用
排除MCP对话
默认: "self-only" (仅排除会话记忆MCP调用)
控制哪些MCP工具交互被索引:
"self-only"(默认):排除有关此对话内存MCP的消息,以防止自我引用循环false:索引来自所有服务器的所有MCP工具调用"all-mcp"或true:从所有服务器中排除所有MCP工具调用["server1", "server2"]:排除特定的MCP服务器
# Default - exclude only conversation-memory MCP
You: "Index conversations"
# Include all MCP conversations (including this one)
You: "Index conversations, include all MCP tools"
# Exclude all MCP tool calls
You: "Index conversations, exclude all MCP interactions"什么被过滤:只有具体的 消息 调用MCP工具的对话被排除在外,而不是整个对话。这保留了对话上下文,同时防止了自我引用循环。
启用Git集成
默认: true (git提交是链接的)
链接git根据时间戳和文件更改提交对话。
# Default behavior
You: "Index conversations"
# Git commits are automatically linked
# Disable git integration
You: "Index conversations without git integration"索引输出
索引后,您将看到:
📁 Indexed from: /path/to/modern-folder, /path/to/legacy-folder
💾 Database: /path/to/.claude-conversations-memory.db这表明:
- 索引文件夹:使用了哪些对话文件夹(包括旧文件夹(如果存在))
- 数据库位置:索引数据的存储位置
使用日期筛选器搜索
You: "What were we working on last week?"生成文档
You: "Generate project documentation from our conversations"Claude将创建综合文档,将代码分析与对话历史相结合。
迁移对话历史记录
当您重命名或移动项目目录时,您的对话历史记录将无法访问,因为Claude Code会为新路径创建一个新文件夹。使用迁移工具恢复您的历史记录:
第一步:查找旧对话文件夹
You: "Discover old conversations for this project"克劳德将扫描 ~/.claude/projects/ 并显示与当前项目匹配的文件夹,按相似性得分排名。输出包括:
- 文件夹名称和路径
- 数据库中存储的原始项目路径
- 对话和文件数量
- 上次活动时间戳
- 相似性得分(越高=匹配越好)
步骤2:迁移历史记录
You: "Migrate conversations from /Users/name/.claude/projects/-old-project-name, old path was /Users/name/old-project, new path is /Users/name/new-project"克劳德将:
- 将所有对话JSONL文件复制到新位置
- 更新
project_path在数据库中 - 创建自动备份(
.claude-conversations-memory.db.bak) - 保留所有原始数据(复制,不移动)
工作流程示例:
# You renamed your project directory
# Old: /Users/alice/code/my-app
# New: /Users/alice/code/my-awesome-app
You: "Discover old conversations for this project"
Claude: Found 1 potential old conversation folder:
- Folder: -Users-alice-code-my-app
- Original path: /Users/alice/code/my-app
- Conversations: 15
- Files: 47
- Score: 95.3
You: "Migrate from /Users/alice/.claude/projects/-Users-alice-code-my-app, old path /Users/alice/code/my-app, new path /Users/alice/code/my-awesome-app"
Claude: Successfully migrated 47 conversation files.
Now you can index and search your full history!干运行模式:
在不进行更改的情况下测试迁移:
You: "Dry run: migrate from [source] old path [old] new path [new]"这显示了在不实际复制文件的情况下迁移的内容。
合并来自不同项目的对话
v0.4.0中的新功能:使用合并模式将不同项目的对话历史记录合并到一个文件夹中。
用例:您想合并来自的对话 /project-a/drafts/2025-01-05 进入您当前的项目 /project-b.
步骤1:查找源文件夹
You: "Discover old conversations for project path /Users/name/project-a/drafts/2025-01-05"步骤2:合并到当前项目中
You: "Merge conversations from /Users/name/.claude/projects/-project-a-drafts-2025-01-05, old path /Users/name/project-a/drafts/2025-01-05, new path /Users/name/project-b, mode merge"克劳德将:
- 仅复制 新 对话文件(跳过重复项)
- ID冲突时保持目标对话(无数据丢失)
- 使用INSERT或IGNORE合并所有数据库条目
- 合并前创建目标数据库的备份
- 保留所有原始源数据
工作流程示例:
# Scenario: You have conversations from different projects to combine
Current project: /Users/alice/main-project (already has 20 conversations)
Source project: /Users/alice/drafts/experiment (has 10 conversations, 3 overlap with main)
You: "Discover old conversations for /Users/alice/drafts/experiment"
Claude: Found 1 folder:
- Folder: -Users-alice-drafts-experiment
- Original path: /Users/alice/drafts/experiment
- Conversations: 10
- Files: 10
You: "Merge from /Users/alice/.claude/projects/-Users-alice-drafts-experiment, old path /Users/alice/drafts/experiment, new path /Users/alice/main-project, mode merge"
Claude: Successfully merged 7 new conversation files into /Users/alice/.claude/projects/-Users-alice-main-project
(3 duplicate conversations were skipped to preserve target data)
Backup created at: .claude-conversations-memory.db.bak
# Result: main-project now has 27 conversations (20 original + 7 new from experiment)迁移和合并之间的主要区别:
| 功能 | 迁移模式(默认) | 合并模式 |
|---|---|---|
| 目标有数据 | ❌ 拒绝(冲突) | ✅ 允许 |
| 重复ID | 覆盖目标 | 跳过源(保留目标) |
| 用例 | 重命名项目 | 组合不同项目 |
| 备份位置 | 源文件夹 | 目标文件夹 |
📚 了解更多
🐛 故障排除
“未找到对话”
确保您在有Claude Code CLI对话的目录中运行此程序。检查 ~/.claude/projects/ 验证对话文件是否存在。
“嵌入失败”
如果嵌入失败,MCP将回退到全文搜索。一切仍然有效,只是没有语义搜索。
“MCP没有响应”
重新启动Claude Code CLI以重新加载MCP服务器。
📄 许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
🙏 致谢
灵感来自 代码图rag-mcp.
______________________________________________________________________
由以下材料制成❤️ Claude Code CLI社区
