Claude Code Exporter
Export and organize Claude Code conversations with powerful filtering. Supports CLI and MCP server integration for Claude Desktop.
Claude Code Exporter š
Export and aggregate Claude Code conversations with powerful filtering and organization features.
⨠Features
- š¤ Multiple Export Modes - Prompts only, outputs only, or full conversations
- š Multiple Formats - Export to Markdown, JSON, or both
- š Dual Directory Support - Works with
~/.claude
and~/.config/claude
- š Aggregate Mode - Combine prompts across all projects
- š Period Filtering - Filter by days, weeks, months, or years
- šļø Period Grouping - Group exports by time periods
- šÆ Smart Organization - Timestamp-based directories with clear naming
- š¬ Interactive Mode - User-friendly prompts with defaults
- š§ CLI & API - Use as command-line tool or Node.js library
- š¤ MCP Server - Model Context Protocol support for Claude Desktop (v2.0.1+)
š Quick Start
# Install globally
npm install -g claude-code-exporter
# Export current project
claude-prompts
# Export with aggregation
claude-prompts --aggregate
# Export last 7 days
claude-prompts --aggregate --period=7d
# Export grouped by days
claude-prompts --aggregate --period=7d --periodGroup=d --nested
š¦ Installation
Global (Recommended)
npm install -g claude-code-exporter
Local Project
npm install claude-code-exporter
Without Installation
npx claude-code-exporter /path/to/project
š Usage
Basic Commands
# Interactive mode
claude-prompts
# Export specific project
claude-prompts /path/to/project
# Export full conversations
claude-prompts --full /path/to/project
# Export to JSON
claude-prompts --json /path/to/project
# List available sessions
claude-prompts --list /path/to/project
Advanced Aggregation
# Aggregate all projects
claude-prompts --aggregate
# Aggregate with nested structure
claude-prompts --aggregate --nested
# Filter by time period
claude-prompts --aggregate --period=30d # Last 30 days
claude-prompts --aggregate --period=2w # Last 2 weeks
claude-prompts --aggregate --period=3m # Last 3 months
# Group by time period
claude-prompts --aggregate --period=1m --periodGroup=w # Group by weeks
claude-prompts --aggregate --period=1y --periodGroup=m # Group by months
CLI Options
Option | Short | Description |
---|---|---|
--help | -h | Show help |
--version | -v | Show version |
--prompts | -p | Export user prompts only (default) |
--outputs | -o | Export assistant outputs only |
--full | -f | Export full conversations |
--markdown | -m | Export as Markdown (default) |
--json | -j | Export as JSON |
--all-formats | Export in both formats | |
--aggregate | -a | Aggregate prompts across projects |
--nested | Create nested folder structure | |
--period | Filter by time period (e.g., 7d, 2w, 1m) | |
--periodGroup | Group by period (d, w, m, y) | |
--both-dirs | Process both Claude directories | |
--no-interactive | Disable interactive prompts | |
--quiet | -q | Suppress output |
--verbose | -V | Enable verbose logging |
š Export Formats
Prompts Only (Default)
Exports only user messages, perfect for:
- š Creating prompt libraries
- š Analyzing your questions
- š Building documentation
Outputs Only
Exports only assistant responses, ideal for:
- š» Collecting code examples
- š Building knowledge bases
- šÆ Extracting solutions
Full Conversation
Exports complete dialogue, best for:
- š Complete documentation
- š Learning from interactions
- š Debugging conversations
š Output Structure
Standard Export
claude-prompts/
āāā 2d002199-untitled-prompts.md
āāā 33c13f1c-react-hooks-full.md
āāā 73d2983f-api-design-outputs.json
Aggregated Export
aggregated-prompts/
āāā aggregated-20250628-project1.md
āāā aggregated-20250628-project2.json
āāā aggregated-20250628-project3.txt
Nested Aggregate
aggregated-prompts/
āāā project1/
ā āāā session1/
ā āāā prompts.md
ā āāā outputs.txt
ā āāā full.json
āāā project2/
āāā session1/
āāā ...
Period Grouped
aggregated-prompts/
āāā 20250628-Dd/ # Daily groups
ā āāā sessions...
āāā 2025-W26/ # Weekly groups
ā āāā sessions...
āāā 2025-06M/ # Monthly groups
āāā sessions...
š¤ MCP Server Integration (v2.0.1+)
Setup for Claude Desktop
- Install the package globally:
npm install -g claude-code-exporter
- Add to Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"claude-code-exporter": {
"command": "npx",
"args": ["claude-code-exporter", "mcp"]
}
}
}
- Restart Claude Desktop and use the available tools:
Available MCP Tools
š¤ export_conversation
Export Claude Code conversations with advanced filtering:
- projectPath (required): Project directory path
- outputDir: Output directory (default: ./claude-prompts)
- exportMode: "prompts", "full", or "outputs"
- exportFormat: "markdown", "json", or "both"
- period: Time filter (e.g., "7d", "2w", "3m", "1y")
- periodGroup: Group by "d", "w", "m", or "y"
- nested: Create nested directory structure
- verbose: Enable detailed logging
Example: "Export my project at /path/to/project with period 7d and nested structure"
š aggregate_sessions
Aggregate sessions across multiple projects:
- claudeHome: Claude home directory (auto-detected)
- outputDir: Output directory (default: ./aggregated-prompts)
- includeStats: Include detailed statistics
- groupBy: "project", "date", or "none"
- bothDirs: Process both Claude directories
- period: Time filter (e.g., "7d", "2w", "3m")
- verbose: Enable detailed logging
Example: "Aggregate all my Claude sessions from the last 2 weeks with bothDirs enabled"
š list_sessions
List available Claude sessions with metadata:
- projectPath: Specific project (optional, lists all if omitted)
- claudeHome: Claude home directory (auto-detected)
- bothDirs: List from both Claude directories
- period: Time filter (e.g., "7d", "2w", "3m")
- verbose: Include detailed session information
Example: "List all my Claude sessions from the last 7 days with verbose details"
š§ Programmatic API
const ClaudePromptExporter = require('claude-code-exporter');
// Basic usage
const exporter = new ClaudePromptExporter('/path/to/project');
const result = await exporter.export('./output');
// With options
const exporter = new ClaudePromptExporter('/path/to/project', {
exportMode: ClaudePromptExporter.ExportMode.FULL_CONVERSATION,
exportFormat: ClaudePromptExporter.ExportFormat.BOTH,
aggregate: true,
period: '7d',
periodGroup: 'd'
});
// Aggregate multiple projects
const result = await exporter.aggregate('./aggregated-output');
āļø Configuration
Requirements
- Node.js: v20.0.0 or higher (required for MCP server)
- Claude Code: Installed with sessions in standard directories
Environment
CLAUDE_HOME
- Override Claude home directoryAGGREGATE_NESTED=true
- Default to nested structureAGGREGATE_BOTH=true
- Process both directories by default
š Troubleshooting
Common Issues
- "No Claude sessions found" ā Check project path matches Claude usage
- "No sessions with [type] found" ā Try
--full
mode - Multiple directories detected ā Use
--claude-home
to specify - Period validation error ā Ensure period group ⤠period range
Debug Mode
claude-prompts --verbose /path/to/project
š¤ Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing
) - Commit changes (
git commit -m 'feat: add amazing feature'
) - Push branch (
git push origin feature/amazing
) - Open Pull Request
š License
MIT License - see LICENSE for details.
š Links
Made with ā¤ļø for the Claude Code community
Related Servers
Drupal Modules MCP
Retrieve detailed information about Drupal modules from drupal.org, including version compatibility, installation instructions, and documentation.
Cloudflare MCP Server Example
A template for deploying a remote MCP server on Cloudflare Workers without authentication.
Frank Bria MCP Server
A remote MCP server deployable on Cloudflare Workers without authentication.
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
Model Context Protocol servers
A collection of reference implementations for the Model Context Protocol (MCP), showcasing various MCP servers implemented with TypeScript and Python SDKs.
OAuth 2.1 MCP Server
A Next.js template for building MCP servers with OAuth 2.1 authentication, supporting PostgreSQL and Redis.
Ghost MCP
An MCP server for the Ghost blogging platform with Server-Sent Events (SSE) transport support.
AI Pair Programmer (Ruby)
AI-powered tools for code review, brainstorming, performance analysis, and security review in Ruby.
Draw Architecture
Generate draw.io system architecture diagrams from text descriptions using the ZhipuAI large model.
Symphony of One
An MCP server for orchestrating multiple Claude instances to collaborate in a shared workspace with real-time communication.