r-strawser/prompt-log
If you are the rightful owner of prompt-log 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 Prompt Log MCP Server is a lightweight tool designed to log prompts from Claude Code and Claude Desktop for reflection and journaling purposes, with a focus on privacy and local data storage.
query_prompts
Search through your historical prompts.
export_prompts
Export prompts to various formats.
get_stats
View usage statistics.
tag_prompt
Add tags to organize prompts.
Prompt Log MCP Server
A lightweight Model Context Protocol (MCP) server that logs prompts from Claude Code and Claude Desktop for reflection and journaling purposes.
Features
- ð Privacy-First: All data stored locally by default
- ð Workflow-Based Logging: Integrate logging into your Claude workflow via CLAUDE.md
- ð Search & Query: Find historical prompts with powerful search
- ð Statistics: Track usage patterns and prompt frequency
- ð·ïļ Tagging System: Organize prompts with custom tags
- ðĪ Export Options: Export to JSON, CSV, or Markdown
- ðŠķ Lightweight: Minimal resource usage with SQLite backend
Installation
Prerequisites
- Node.js 18+
- npm or yarn
- Claude Code and/or Claude Desktop with MCP support
Quick Start
- Clone this repository:
git clone https://github.com/r-strawser/prompt-log.git
cd prompt-log
- Install dependencies:
npm install
- Build the project:
npm run build
- Create the data directory (for first-time setup):
mkdir -p data
- (Optional) Configure environment variables:
cp .env.example .env
# Edit .env to customize settings
Important Notes
- The SQLite database will be created automatically on first use
- Default database location:
./data/prompts.db
- You can change the location via
PROMPT_LOG_DB_PATH
environment variable
Configuration
Claude Code Configuration
Add the following to your Claude Code settings:
{
"mcpServers": {
"prompt-log": {
"command": "node",
"args": ["/path/to/prompt-log/dist/index.js"],
"env": {
"PROMPT_LOG_DB_PATH": "~/.prompt-log/prompts.db"
}
}
}
}
Claude Desktop Configuration
- Open Claude Desktop settings
- Navigate to MCP Servers section
- Add a new server with:
- Name:
prompt-log
- Command:
node
- Arguments:
/path/to/prompt-log/dist/index.js
- Name:
Usage
Once configured, the server provides logging tools that can be called manually or integrated into your workflow.
Available MCP Tools
Query Prompts
Search through your historical prompts:
Use the query_prompts tool to search for "function" from claude-code with limit 10
Export Prompts
Export prompts to various formats:
Use the export_prompts tool with format "markdown" and startDate "2024-01-01"
Get Statistics
View usage statistics:
Use the get_stats tool
Tag Prompts
Add tags to organize prompts:
Use the tag_prompt tool with promptId 123 and tags ["javascript", "async"]
Environment Variables
Variable | Description | Default |
---|---|---|
PROMPT_LOG_DB_PATH | Database file location | ./data/prompts.db |
DEBUG | Enable debug logging | false |
MAX_PROMPTS | Maximum prompts to keep | 0 (unlimited) |
RETENTION_DAYS | Auto-delete after X days | 0 (disabled) |
Database Schema
The SQLite database uses the following schema:
prompts (
id: INTEGER PRIMARY KEY,
timestamp: TEXT,
app_source: TEXT,
prompt_text: TEXT,
session_id: TEXT,
tags: TEXT (JSON array),
metadata: TEXT (JSON object)
)
Development
Run in development mode with auto-reload:
npm run dev
Security Considerations
- All data is stored locally by default
- No external network requests are made
- Database file permissions should be set appropriately
- Consider enabling encryption for sensitive prompts
Making Logging Feel Automatic
While MCP servers can't intercept prompts automatically, you can create a workflow that feels automatic:
Using CLAUDE.md for Workflow Integration
Create a CLAUDE.md
file in your project root:
# Project Assistant Instructions
When I provide a new prompt or task:
1. First, log it using: Use the log_prompt tool with prompt "[the user's prompt]" and appSource "claude-code"
2. Then proceed with the actual task
This helps maintain a complete history of our interactions.
This way, Claude will log prompts as part of its normal workflow when working in that project.
Troubleshooting
Prompts not being logged
- Remember: logging requires explicit tool calls (manual or via CLAUDE.md workflow)
- Check that the server is listed in your Claude app's MCP configuration
- Verify the database path is writable
- Check logs for any error messages
Database locked errors
- The server uses WAL mode for better concurrent access
- If issues persist, ensure only one instance is running
License
MIT