matt-chlorophyll/Claude-Code-Saver-MCP
If you are the rightful owner of Claude-Code-Saver-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Claude Code Response Saver MCP is a server that allows users to save Claude Code conversation responses as markdown files with metadata, creating a searchable knowledge base.
save_response
Save a specific response with title and tags
list_saved_responses
List all saved responses with metadata
search_responses
Search responses by title or content
get_response
Retrieve a specific saved response by filename
Claude Code Response Saver MCP
A Model Context Protocol (MCP) server that enables Claude Code to save conversation responses as markdown files with metadata. Create a searchable knowledge base of your Claude Code interactions with structured tagging and retrieval capabilities.
๐ Features
- Save Responses: Save Claude Code responses as formatted markdown files
- Metadata Management: Automatic timestamping, tagging, and indexing
- Search & Retrieval: Find saved responses by title, content, or tags
- Structured Storage: YAML frontmatter with markdown content
- Auto-Organization: Files stored in
~/claude-code-responses/
with index management
๐ Tools Available
save_response
- Save a specific response with title and tagslist_saved_responses
- List all saved responses with metadatasearch_responses
- Search responses by title or contentget_response
- Retrieve a specific saved response by filename
๐ฆ Prerequisites
Before starting, ensure you have:
- Node.js 18+ installed (
node --version
) - Claude Code installed and working
- Terminal/Command Prompt access
๐ Installation
Step 1: Create the Project Directory
# 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
Step 2: Initialize the Project
# Initialize npm project
npm init -y
# Install required dependencies
npm install @modelcontextprotocol/sdk zod
# Install development dependencies
npm install -D @types/node typescript
Step 3: Create Project Structure
# 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/
Step 4: Add Configuration Files
Create 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"
]
}
Update package.json
(replace the existing content):
{
"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"
}
}
Step 5: Add the Server Code
Create src/index.ts
with the MCP server implementation (see the CLAUDE.md file for architecture details).
Step 6: Build the Project
# 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
Step 7: Find Your Project's Absolute Path
# 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
โ๏ธ Configuration
Use Claude Code's built-in MCP configuration system (check out instructions at https://docs.anthropic.com/en/docs/claude-code/mcp):
Option A: User Scope (Recommended - Available in all projects)
# 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
Option B: Local Scope (Project-specific)
# 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
Option C: Project Scope (Team sharing via .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
Important: Replace /FULL/PATH/TO/YOUR/PROJECT/
with the actual path from Step 7!
Verify Configuration
# 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
๐งช Testing
After adding the MCP server, start a new Claude Code session to test:
-
Open Claude Code in any project directory (new session)
-
Test the MCP server connection:
# In Claude Code, run this command to check MCP status
/mcp
- Try saving a response:
Save this test message as "First Test" with tags "test", "setup"
- Check if it worked:
# Check if the directory was created
ls ~/claude-code-responses/
# You should see:
# - index.json
# - A .md file with your test message
๐ Usage
Save Current Response
Save this explanation about microservices architecture with tags "architecture", "microservices"
Save with Custom Title
Save this as "Database Performance Optimization Guide"
List Your Saved Responses
Show me my last 10 saved responses
Search Previous Saves
Search my saved responses for "authentication"
๐ File Structure
Generated files:
- Response files:
YYYY-MM-DD_HH-MM-SS_sanitized-title.md
- Index file:
index.json
(contains metadata for all saved responses) - Default directory:
~/claude-code-responses/
Markdown format:
---
title: "Response Title"
created: ISO timestamp
tags: ["tag1", "tag2"]
source: Claude Code
type: response
---
# Response Title
[Content here]
---
*Saved from Claude Code on [timestamp]*
๐ Architecture
Core Components:
src/index.ts
- Main MCP server implementation withClaudeCodeSaverServer
class- Tools provided: save_response, save_last_response, list_saved_responses, search_responses, get_response
- Storage: Files saved to
~/claude-code-responses/
with JSON index for metadata - File format: Markdown files with YAML frontmatter containing metadata
Key Dependencies:
@modelcontextprotocol/sdk
- MCP framework for tool registration and communicationzod
- Schema validation- Built-in Node.js modules:
fs/promises
,path
,os
๐ง Troubleshooting
If Claude Code doesn't recognize the server:
- Check the server is listed:
# List configured MCP servers
claude mcp list
- Check the path is correct:
# Test if the file exists
ls /FULL/PATH/TO/YOUR/PROJECT/dist/index.js
- Remove and re-add the server:
# 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
If you get permission errors:
# Make sure the file is executable
chmod +x /FULL/PATH/TO/YOUR/PROJECT/dist/index.js
If Node.js isn't found:
# 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
๐ฏ Success Indicators
You'll know it's working when:
- โ Claude Code responds to save commands
- โ
Files appear in
~/claude-code-responses/
- โ You can list and search saved responses
- โ No error messages in Claude Code
๐ Next Steps
Once it's working:
- Develop a tagging system for your responses
- Save architectural decisions and planning sessions
- Build your knowledge base of Claude Code insights
- Share markdown files with your team when needed
The server will create a powerful, searchable library of all your valuable Claude Code interactions!
๐ License
MIT