
Trapper Keeper MCP
An MCP server that automatically manages and organizes project documentation using the document reference pattern, keeping CLAUDE.md files clean and under 500 lines while maintaining full context for AI assistants.
README
Trapper Keeper MCP
Keep your AI context organized like a boss 📚✨
An intelligent document extraction and organization system built as a Model Context Protocol (MCP) server using Python and FastMCP. Trapper Keeper watches directories for markdown and text files, extracts categorized content, and organizes it into structured outputs.
🏗️ Architecture
Trapper Keeper MCP is designed with a modular, event-driven architecture that supports both CLI and MCP server modes:
Key Components
- Core: Base classes, type definitions, and configuration management
- Monitoring: File system monitoring with debouncing and pattern matching
- Parser: Extensible document parsing (currently supports Markdown)
- Extractor: Intelligent content extraction with category detection
- Organizer: Flexible output organization and formatting
- MCP Server: FastMCP-based server implementation
- CLI: Rich command-line interface
✅ Features
Intelligent Content Extraction
- Category Detection: Automatically categorizes content using pattern matching and keywords
- Importance Scoring: Assigns importance scores based on content relevance
- Section Parsing: Preserves document structure with hierarchical sections
- Code Block Extraction: Extracts and categorizes code snippets
- Link Extraction: Groups and organizes document links
Real-time File Monitoring
- Directory Watching: Monitors directories for file changes
- Pattern Matching: Configurable file patterns and ignore rules
- Debouncing: Prevents duplicate processing of rapid changes
- Event System: Async event-driven architecture for scalability
Flexible Organization
- Multiple Output Formats: Markdown, JSON, and YAML
- Grouping Options: By category, document, or custom grouping
- Index Generation: Automatic index creation with statistics
- Metadata Preservation: Maintains source information and timestamps
📋 Setup
Prerequisites
- Python 3.8 or higher
- pip or poetry for dependency management
Installation
- Clone the repository:
git clone https://github.com/asachs01/trapper-keeper-mcp.git
cd trapper-keeper-mcp
- Install dependencies:
pip install -e .
- Copy the example configuration:
cp config.example.yaml config.yaml
- Edit
config.yaml
to match your needs
MCP Integration
Add to your MCP settings:
{
"mcpServers": {
"trapper-keeper": {
"command": "python",
"args": ["-m", "trapper_keeper.mcp.server"],
"env": {
"PYTHONPATH": "/path/to/trapper-keeper-mcp/src"
}
}
}
}
🌐 API
CLI Commands
# Process a single file
trapper-keeper process document.md -o ./output
# Process a directory
trapper-keeper process ./docs -c "🏗️ Architecture" -c "🔐 Security" -f json
# Watch a directory
trapper-keeper watch ./docs -p "*.md" -p "*.txt" --recursive
# List categories
trapper-keeper categories
# Run as MCP server
trapper-keeper server
# Show/save configuration
trapper-keeper config
trapper-keeper config -o my-config.yaml
Category Configuration
The system uses emoji-prefixed categories for easy identification:
- 🏗️ Architecture - System design and structure
- 🗄️ Database - Database schemas and queries
- 🔐 Security - Authentication and security concerns
- ✅ Features - Feature descriptions and requirements
- 📊 Monitoring - Logging and observability
- 🚨 Critical - Urgent issues and blockers
- 📋 Setup - Installation and configuration
- 🌐 API - API endpoints and integrations
- 🧪 Testing - Test cases and strategies
- ⚡ Performance - Optimization and speed
- 📚 Documentation - Guides and references
- 🚀 Deployment - Deployment and CI/CD
- ⚙️ Configuration - Settings and options
- 📦 Dependencies - Package management
MCP Tools Available
The MCP server exposes the following tools:
process_file
Process a single file and extract categorized content.
{
"file_path": "/path/to/document.md",
"extract_categories": ["🏗️ Architecture", "🔐 Security"],
"output_format": "markdown"
}
process_directory
Process all matching files in a directory.
{
"directory_path": "/path/to/docs",
"patterns": ["*.md", "*.txt"],
"recursive": true,
"output_dir": "./output",
"output_format": "json"
}
watch_directory
Start watching a directory for changes.
{
"directory_path": "/path/to/docs",
"patterns": ["*.md"],
"recursive": true,
"process_existing": true
}
stop_watching
Stop watching a specific directory.
list_watched_directories
Get information about all watched directories.
get_categories
Get list of available extraction categories.
update_config
Update server configuration at runtime.
📊 Monitoring
Trapper Keeper includes Prometheus metrics for monitoring:
- Files processed (success/failure counts)
- Event publications by type
- Content extraction by category
- Processing duration histograms
- Queue sizes and active watchers
Metrics are exposed on port 9090 by default.
🚨 Critical Configuration
Environment Variables
TRAPPER_KEEPER_LOG_LEVEL
: Logging level (DEBUG, INFO, WARNING, ERROR)TRAPPER_KEEPER_METRICS_PORT
: Prometheus metrics portTRAPPER_KEEPER_MCP_PORT
: MCP server portTRAPPER_KEEPER_OUTPUT_DIR
: Default output directoryTRAPPER_KEEPER_MAX_CONCURRENT
: Maximum concurrent file processing
🔐 Security
- File access is restricted to configured paths
- No remote code execution
- Configurable ignore patterns for sensitive files
- All file operations are read-only by default
Development
Project Structure
src/trapper_keeper/
├── core/ # Base classes and types
├── monitoring/ # File monitoring
├── parser/ # Document parsers
├── extractor/ # Content extraction
├── organizer/ # Output organization
├── mcp/ # MCP server
├── cli/ # CLI interface
└── utils/ # Utilities
Adding a New Parser
- Create a new parser class inheriting from
Parser
- Implement required methods:
parse()
,can_parse()
- Register in
parser_factory.py
Adding a New Category
- Add to
ExtractionCategory
enum intypes.py
- Add detection patterns in
category_detector.py
Plugin System
The architecture supports plugins through the Plugin
protocol. Plugins can:
- Process documents
- Add new extraction categories
- Implement custom output formats
Why "Trapper Keeper"?
Named after the iconic 90s school organizer, Trapper Keeper MCP does for your code documentation what those colorful binders did for school papers - keeps everything organized, accessible, and prevents the chaos of loose papers (or in our case, sprawling documentation) from taking over your project.
Documentation
Getting Started
- Quick Start Guide - Get up and running in 5 minutes
- Installation Guide - Detailed installation instructions
- Configuration Reference - All configuration options
User Guides
- CLI Guide - Complete CLI command reference
- MCP Tools Reference - Using MCP tools effectively
- API Reference - Python API documentation
- Troubleshooting Guide - Common issues and solutions
Tutorials
- Basic Usage - Step-by-step tutorials
- Advanced Workflows - Complex use cases
- Integration Guide - Integrate with other tools
- Custom Categories - Create custom categories
Architecture & Development
- Architecture Overview - System design
- Contributing Guide - How to contribute
- Plugin Development - Extend functionality
Examples
- Example Configurations - Configuration examples
- Python Scripts - API usage examples
- Docker Setup - Docker deployment examples
- CLAUDE.md Examples - Sample documentation files
License
MIT License - see LICENSE file for details.
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。