Token导航 LogoToken导航TokenDH.com
Claude Code Saver MCP logo
文档知识未说明官方级别未说明来源级核验

Claude Code Saver MCP

MCP Server

一个用于保存Claude Code对话响应为Markdown文件的服务,支持元数据管理和检索功能。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
TypeScriptClaude文档处理Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

matt-chlorophyll

提供方

matt-chlorophyll

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

克劳德代码响应保护程序MCP

一种模型上下文协议(MCP)服务器,使Claude Code能够将对话响应保存为带有元数据的markdown文件。使用结构化标记和检索功能创建一个可搜索的克劳德代码交互知识库。

📋 特性

  • 保存响应:将Claude Code响应保存为格式化的markdown文件
  • 元数据管理:自动时间戳、标记和索引
  • 搜索与检索:按标题、内容或标签查找已保存的回复
  • 结构化存储:带有markdown内容的YAML frontmatter
  • 自组织:文件存储在 ~/claude-code-responses/ 有索引管理

🚀 可用工具

  • save_response -保存带有标题和标签的特定响应
  • list_saved_responses -列出所有已保存的响应及其元数据
  • search_responses -按标题或内容搜索响应
  • get_response -按文件名检索特定的已保存响应

📦 先决条件

在开始之前,请确保您已经:

  • 已安装Node.js 18+(node --version)
  • Claude Code已安装并正常工作
  • 终端/命令提示符访问

🛠 安装

步骤1:创建项目目录

# Navigate to a good location (e.g., your projects folder)
cd ~/Projects  # or wherever you keep your code projects

# Create the project directory
mkdir claude-code-saver-mcp
cd claude-code-saver-mcp

步骤2:初始化项目

# Initialize npm project
npm init -y

# Install required dependencies
npm install @modelcontextprotocol/sdk zod

# Install development dependencies
npm install -D @types/node typescript

步骤3:创建项目结构

# Create source directory
mkdir src

# Create TypeScript config
touch tsconfig.json

# You should now have:
# claude-code-saver-mcp/
# ├── src/
# ├── package.json
# ├── tsconfig.json
# └── node_modules/

步骤4:添加配置文件

创建 tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "declaration": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ]
}

更新 package.json (替换现有内容):

{
  "name": "claude-code-saver-mcp",
  "version": "1.0.0",
  "description": "MCP server for saving Claude Code responses as markdown files",
  "main": "dist/index.js",
  "type": "module",
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js",
    "dev": "tsc --watch",
    "prepare": "npm run build"
  },
  "keywords": [
    "mcp",
    "claude-code",
    "documentation",
    "markdown"
  ],
  "author": "Your Name",
  "license": "MIT",
  "dependencies": {
    "@modelcontextprotocol/sdk": "^1.0.0",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "typescript": "^5.0.0"
  },
  "engines": {
    "node": ">=18.0.0"
  }
}

步骤5:添加服务器代码

创建 src/index.ts 使用MCP服务器实现(有关体系结构的详细信息,请参阅CLAUDE.md文件)。

步骤6:构建项目

# Build the TypeScript to JavaScript
npm run build

# Verify the build worked
ls dist/
# You should see: index.js, index.js.map, index.d.ts

第7步:找到项目的绝对路径

# Get the absolute path (you'll need this for Claude Code config)
pwd
# Example output: /Users/yourusername/Projects/claude-code-saver-mcp

# Note down the full path to your built server:
# /Users/yourusername/Projects/claude-code-saver-mcp/dist/index.js

⚙️ 配置

使用Claude Code内置的MCP配置系统 (查看说明https://docs.anthropic.com/en/docs/claude-code/mcp):

选项A:用户范围(推荐-适用于所有项目)

# Add the MCP server with user scope (available everywhere)
claude mcp add claude-code-saver -s user -- node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js
# e.g. claude mcp add claude-code-saver -s user -- node /home/username/projects/claude-code-saver-mcp/dist/index.js

选项B:本地范围(特定于项目)

# Add the MCP server with local scope (only current project)
claude mcp add claude-code-saver -s local -- node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

选项C:项目范围(团队通过.mcp.json共享)

# Add the MCP server with project scope (shared via version control)
claude mcp add claude-code-saver -s project -- node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

重要:替换 /FULL/PATH/TO/YOUR/PROJECT/ 从步骤7开始的实际路径!

验证配置

# List all configured MCP servers (run in cli)
claude mcp list

# You should see:
# claude-code-saver: node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

🧪 测试

添加MCP服务器后,启动一个新的Claude Code会话进行测试:

  1. 在任何项目目录中打开Claude Code (新会议)
  1. 测试MCP服务器连接:
# In Claude Code, run this command to check MCP status
/mcp
  1. 尝试保存响应:
Save this test message as "First Test" with tags "test", "setup"
  1. 检查它是否有效:
# Check if the directory was created
ls ~/claude-code-responses/

# You should see:
# - index.json
# - A .md file with your test message

📖 用法

保存当前响应

Save this explanation about microservices architecture with tags "architecture", "microservices"

使用自定义标题保存

Save this as "Database Performance Optimization Guide"

列出您保存的回复

Show me my last 10 saved responses

搜索以前的保存

Search my saved responses for "authentication"

📁 文件结构

生成的文件:

  • 响应文件: YYYY-MM-DD_HH-MM-SS_sanitized-title.md
  • 索引文件: index.json (包含所有已保存响应的元数据)
  • 默认目录: ~/claude-code-responses/

Markdown格式:

---
title: "Response Title"
created: ISO timestamp
tags: ["tag1", "tag2"]
source: Claude Code
type: response
---

# Response Title

[Content here]

---
*Saved from Claude Code on [timestamp]*

🏗 建筑

核心组件:

  • src/index.ts -主MCP服务器实现 ClaudeCodeSaverServer
  • 提供的工具: save_response、save_last_response,list_saved_responses,search_responses,get_response
  • 储存: 文件保存到 ~/claude-code-responses/ 元数据使用JSON索引
  • 文件格式: 带有包含元数据的YAML frontmatter的Markdown文件

关键依赖关系:

  • @modelcontextprotocol/sdk -用于工具注册和通信的MCP框架
  • zod -架构验证
  • 内置Node.js模块: fs/promises, path, os

🔧 故障排除

如果Claude Code无法识别服务器:

  1. 检查服务器是否已列出:
# List configured MCP servers
claude mcp list
  1. 检查路径是否正确:
# Test if the file exists
ls /FULL/PATH/TO/YOUR/PROJECT/dist/index.js
  1. 删除并重新添加服务器:
# Remove the server
claude mcp remove claude-code-saver

# Add it again
claude mcp add claude-code-saver -s user -- node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

如果您遇到权限错误:

# Make sure the file is executable
chmod +x /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

如果找不到Node.js:

# Check Node.js is in PATH
which node

# If Node.js is not in PATH, use the full path when adding the server:
claude mcp add claude-code-saver -s user -- /usr/local/bin/node /FULL/PATH/TO/YOUR/PROJECT/dist/index.js

🎯 成功指标

在以下情况下,您会知道它正在工作:

  • ✅ Claude Code响应保存命令
  • ✅ 文件出现在 ~/claude-code-responses/
  • ✅ 您可以列出并搜索已保存的回复
  • ✅ Claude代码中没有错误消息

🚀 后续步骤

一旦它开始工作:

  1. 开发标签系统 感谢您的回复
  2. 保存架构决策 以及规划会议
  3. 建立你的知识库 Claude Code见解
  4. 共享标记文件 需要时与您的团队一起

服务器将创建一个强大的、可搜索的库,其中包含您所有有价值的Claude Code交互!

📄 许可证

麻省理工学院

目录标签

目录标签

TypeScriptClaude文档处理对话存档本地部署知识管理元数据处理Markdown工具检索系统

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP