README.mdβ’16.9 kB
# π Scribe MCP Server
<div align="center">
**[](tests/)**
**[](docs/whitepapers/)**
**[](LICENSE)**
*Enterprise-grade documentation governance for AI-powered development*
**Drop-in ready** β’ **13+ specialized templates** β’ **Zero-config SQLite** β’ **Production-tested**
</div>
---
## π Why Scribe MCP?
Scribe transforms how AI agents and developers maintain project documentation. Instead of scattered notes and outdated docs, Scribe provides **bulletproof audit trails**, **automated template generation**, and **cross-project intelligence** that keeps your entire development ecosystem in sync.
**Perfect for:**
- π€ **AI Agent Teams** - Structured workflows and quality grading
- π’ **Enterprise Teams** - Audit trails and compliance documentation
- π¨βπ» **Solo Developers** - Automatic documentation that actually works
- π **Research Projects** - Structured logs and reproducible reports
**Immediate Value:**
- β
**30-second setup** - Drop into any repository and start logging
- π― **18+ specialized templates** - From architecture guides to bug reports
- π **Cross-project search** - Find patterns across your entire codebase
- π **Agent report cards** - Performance grading for AI workflows
- π‘οΈ **Bulletproof storage** - Atomic operations with crash recovery
## β‘ Quick Start
**Get Scribe running in under 60 seconds:**
### 1οΈβ£ Install Dependencies
```bash
# Clone and navigate to Scribe
git clone <your-repo-url>
cd scribe_mcp
# Set up Python environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install 16 production-ready dependencies
pip install -r requirements.txt
```
### 2οΈβ£ Start Logging Immediately
```bash
# From the parent directory (MCP_SPINE/)
python -m scribe_mcp.scripts.scribe "π My project is ready!" --status success --emoji π
```
**That's it!** You've just created your first structured log entry. Scribe automatically:
- β
Created a project configuration
- β
Generated documentation templates
- β
Started your progress log
- β
Provided intelligent reminders
### 3οΈβ£ Launch MCP Server (Optional)
```bash
# Start the MCP server for Claude/Claude Code integration
export SCRIBE_ROOT=$(pwd) # Set your project root
python -m scribe_mcp.server
```
---
## π― Try These Examples
**Project Management:**
```bash
# Log project milestones
python -m scribe_mcp.scripts.scribe "Completed authentication module" --status success --meta component=auth,tests=47
# Track bugs and issues
python -m scribe_mcp.scripts.scribe "Fixed JWT token expiry bug" --status bug --meta severity=high,component=security
```
**Research Workflows:**
```bash
# Document research findings
python -m scribe_mcp.scripts.scribe "Discovered performance bottleneck in database queries" --status info --meta research=true,impact=high
```
**Team Collaboration:**
```bash
# List all projects
python -m scribe_mcp.scripts.scribe --list-projects
# Switch between projects
python -m scribe_mcp.scripts.scribe "Starting new feature work" --project frontend --status plan
```
---
## π οΈ Installation Options
### Prerequisites
- **Python 3.11+** - Modern Python with async support
- **pip** - Standard Python package manager
- **Optional:** PostgreSQL for team deployments (SQLite works out of the box)
### Storage Backends
**ποΈ SQLite (Default - Zero Config)**
- Perfect for solo developers and small teams
- No setup required - just run and go
- Automatic database creation and management
**π PostgreSQL (Enterprise)**
- Ideal for large teams and production deployments
- Set environment variables before starting:
```bash
export SCRIBE_STORAGE_BACKEND=postgres
export SCRIBE_DB_URL=postgresql://user:pass@host:port/database
```
### MCP Integration
**For Claude Desktop:**
```json
{
"mcpServers": {
"scribe": {
"command": "python",
"args": ["/absolute/path/to/scribe_mcp/server.py"],
"env": {
"SCRIBE_ROOT": "/absolute/path/to/scribe_mcp",
"SCRIBE_STORAGE_BACKEND": "sqlite"
}
}
}
}
```
**For Claude Code CLI:**
```bash
codex mcp add scribe \
--env SCRIBE_ROOT=/path/to/scribe_mcp \
--env SCRIBE_STORAGE_BACKEND=sqlite \
-- python -m scribe_mcp.server
```
---
## π¨ Template System Showcase
**Scribe includes 13+ specialized templates** that auto-generate professional documentation:
### π Document Templates
- **π Architecture Guides** - System design and technical blueprints
- **π
Phase Plans** - Development roadmaps with milestones
- **β
Checklists** - Verification ledgers with acceptance criteria
- **π¬ Research Reports** - Structured investigation documentation
- **π Bug Reports** - Automated issue tracking with indexing
- **π Agent Report Cards** - Performance grading and quality metrics
- **π Progress Logs** - Append-only audit trails with UTC timestamps
- **π Security Logs** - Compliance and security event tracking
### π Template Features
- **π Security Sandboxing** - Jinja2 templates run in restricted environments
- **π Template Inheritance** - Create custom template families
- **π― Smart Discovery** - Project β Repository β Built-in template hierarchy
- **β‘ Atomic Generation** - Bulletproof template creation with integrity verification
### Example: Generate Architecture Guide
```bash
# Auto-generate a complete architecture document
python -m scribe_mcp.scripts.scribe "Generated architecture guide for new project" --status success --meta template=architecture,auto_generated=true
```
---
## π» CLI Power Tools
**Scribe's command-line interface (386 lines of pure functionality)** gives you complete control:
### π― Core Commands
```bash
# List all available projects
python -m scribe_mcp.scripts.scribe --list-projects
# Log with rich metadata
python -m scribe_mcp.scripts.scribe "Fixed critical bug" \
--status success \
--emoji π§ \
--meta component=auth,tests=12,severity=high
# Dry run to preview entries
python -m scribe_mcp.scripts.scribe "Test message" --dry-run
# Switch between projects
python -m scribe_mcp.scripts.scribe "Starting frontend work" \
--project mobile_app \
--status plan
```
### π¨ Rich Features
- **π Emoji Support** - Built-in emoji mapping for all status types
- **π Metadata Tracking** - Rich key=value metadata for organization
- **π Multiple Log Types** - Progress, bugs, security, and custom logs
- **π
Timestamp Control** - Override timestamps for bulk imports
- **π― Project Discovery** - Automatic project configuration detection
### Status Types & Emojis
- `info` βΉοΈ - General information and updates
- `success` β
- Completed tasks and achievements
- `warn` β οΈ - Warning messages and cautions
- `error` β - Errors and failures
- `bug` π - Bug reports and issues
- `plan` π - Planning and roadmap entries
---
## π Enterprise Features
### π Agent Report Cards
**Performance grading infrastructure** for AI workflows:
- Quality metrics tracking and trend analysis
- Performance levels with UPSERT operations
- Automated agent evaluation and reporting
### π Security & Compliance
- **π‘οΈ Security Sandboxing** - Restricted Jinja2 environments with 22+ built-in controls
- **π Audit Trails** - Complete change tracking with metadata
- **π Access Control** - Path validation and input sanitization
- **π Compliance Reporting** - Structured logs for regulatory requirements
### β‘ Advanced Search
**Phase 4 Enhanced Search** capabilities:
- π **Cross-Project Validation** - Find patterns across your entire codebase
- π **Relevance Scoring** - 0.0-1.0 quality filtering
- π― **Code Reference Verification** - Validate referenced code exists
- π
**Temporal Filtering** - Search by time ranges ("last_30d", "last_7d")
### πΎ Bulletproof Storage
- **ποΈ Multi-Backend Support** - SQLite (zero-config) + PostgreSQL (enterprise)
- **β‘ Atomic Operations** - Temp-file-then-rename with fsync guarantees
- **π Write-Ahead Logging** - Bulletproof crash recovery with journaling
- **β
Integrity Verification** - Automatic corruption detection and recovery
---
## π§ Intelligent Reminders
**Scribe keeps your documentation in sync** with intelligent context awareness:
### π Smart Reminders
Every MCP tool response includes contextual reminders about:
- π
**Stale Documentation** - When architecture docs need updates
- β° **Overdue Logs** - Gentle nudges to maintain progress tracking
- π― **Project Context** - Active project status and recent activity
- π **Drift Detection** - When implementation deviates from plans
### βοΈ Customization
```json
{
"name": "my_project",
"defaults": {
"reminder": {
"tone": "friendly",
"log_warning_minutes": 15,
"log_urgent_minutes": 30,
"severity_weights": {"warning": 7, "urgent": 10}
}
}
}
```
### π Environment Variables
- `SCRIBE_REMINDER_IDLE_MINUTES` - Work session reset timeout (default: 45)
- `SCRIBE_REMINDER_WARMUP_MINUTES` - Grace period after resuming (default: 5)
- `SCRIBE_REMINDER_DEFAULTS` - JSON configuration for all projects
---
## ποΈ Project Structure
```
scribe_mcp/ # ποΈ Main Scribe MCP server
βββ π config/
β βββ π projects/ # Per-project configurations
β βββ π mcp_config.json # Sample MCP configuration
βββ π docs/dev_plans/ # Auto-generated documentation
β βββ π ARCHITECTURE_GUIDE.md
β βββ π PHASE_PLAN.md
β βββ π CHECKLIST.md
β βββ π PROGRESS_LOG.md
βββ π templates/ # π¨ Jinja2 template system
β βββ π documents/ # 13+ specialized templates
β βββ π fragments/ # Reusable template pieces
β βββ π custom/ # Your custom templates
βββ π tools/ # π§ MCP tool implementations
βββ π storage/ # πΎ Multi-backend storage layer
βββ π scripts/ # π» CLI utilities
βββ π tests/ # π§ͺ Comprehensive test suite
βββ π server.py # π MCP server entrypoint
```
---
## π§ͺ Testing & Quality
**Comprehensive testing infrastructure** with 79+ test files:
### π§ͺ Run Tests
```bash
# Run all functional tests (69 tests)
pytest
# Run performance tests with file size benchmarks
pytest -m performance
# Run specific test categories
pytest tests/test_tools.py
pytest tests/test_storage.py
```
### β
Quality Assurance
- **π¬ Functional Testing** - 69 comprehensive tests covering all core functionality
- **β‘ Performance Testing** - Optimized benchmarks for file operations
- **π‘οΈ Security Testing** - Template sandboxing and access control validation
- **π Integration Testing** - MCP server protocol compliance verification
### π Smoke Test
```bash
# Quick MCP server validation
python scripts/test_mcp_server.py
```
---
## π‘ Real-World Use Cases
### π€ AI Agent Teams
**Structured workflows for AI development:**
```bash
# Research phase
python -m scribe_mcp.scripts.scribe "Research completed: authentication patterns" --status info --meta phase=research,confidence=0.9
# Architecture phase
python -m scribe_mcp.scripts.scribe "Architecture guide updated with auth design" --status success --meta phase=architecture,sections=5
# Implementation phase
python -m scribe_mcp.scripts.scribe "JWT authentication implemented" --status success --meta phase=implementation,tests=47,coverage=95%
```
### π’ Enterprise Documentation
**Compliance and audit trails:**
```bash
# Security events
python -m scribe_mcp.scripts.scribe "Security audit completed - all controls verified" --log security --status success --meta auditor=external,findings=0
# Change management
python -m scribe_mcp.scripts.scribe "Production deployment completed" --status success --meta version=v2.1.0,rollback_available=true
```
### π Research Projects
**Structured research documentation:**
```bash
# Research findings
python -m scribe_mcp.scripts.scribe "Performance bottleneck identified in database queries" --status info --meta research=true,impact=high,evidence=query_analysis
# Experiment results
python -m scribe_mcp.scripts.scribe "A/B test results: new algorithm 23% faster" --status success --meta experiment=performance_optimization,improvement=23%
```
---
## π§ Troubleshooting
### Common Issues & Solutions
**π¨ MCP SDK Missing**
```bash
# Install the MCP Python SDK
pip install mcp
```
**π§ No Tools Returned**
```bash
# Ensure all modules are properly imported
# Check that your virtual environment is active
source .venv/bin/activate
# Verify tool imports
python -c "from scribe_mcp.tools import *; print('All tools loaded')"
```
**ποΈ SQLite Permission Issues**
```bash
# Check SCRIBE_ROOT is writable
ls -la $SCRIBE_ROOT
# Set proper permissions if needed
chmod 755 $SCRIBE_ROOT
```
**π Python Path Issues**
```bash
# Ensure you're running from the correct directory
# Run from MCP_SPINE parent directory, not inside scribe_mcp/
pwd # Should show .../MCP_SPINE/
# Test import path
python -c "import sys; sys.path.insert(0, '.'); from scribe_mcp.config.settings import settings; print('β
Imports working')"
```
**β‘ Server Not Starting**
```bash
# Check required dependencies
pip install -r requirements.txt
# Verify server startup with timeout
timeout 5 python -m scribe_mcp.server || echo "β
Server starts correctly"
```
### Getting Help
- **π Documentation**: Check `docs/whitepapers/scribe_mcp_whitepaper.md` for comprehensive technical details
- **π§ͺ Test Suite**: Run `pytest` to verify system functionality
- **π Project Templates**: Use `--list-projects` to see available configurations
- **π Smoke Test**: Run `python scripts/test_mcp_server.py` for MCP validation
---
## π€ Contributing
**We welcome contributions!** Here's how to get started:
### π§ͺ Development Workflow
```bash
# 1. Run the test suite
pytest
# 2. Verify MCP server functionality
python scripts/test_mcp_server.py
# 3. Test your changes
python -m scribe_mcp.scripts.scribe "Testing new feature" --dry-run
# 4. Log your contribution
python -m scribe_mcp.scripts.scribe "Added new feature: description" --status success --meta contribution=true,feature_type=enhancement
```
### π Development Guidelines
- **β
Test Coverage**: All new features must include tests
- **π Documentation**: Update relevant documentation sections
- **π§ Integration**: Ensure MCP server compatibility
- **π‘οΈ Security**: Follow security best practices for templates and inputs
### π Quality Standards
- **π§ͺ 69+ functional tests** must pass
- **β‘ Performance benchmarks** for file operations
- **π Security validation** for template sandboxing
- **π MCP protocol compliance** verification
---
## π Further Reading
### π Technical Documentation
- **[π Whitepaper v2.1](docs/whitepapers/scribe_mcp_whitepaper.md)** - Comprehensive technical architecture
- **[π§ API Reference](docs/api/)** - Complete MCP tool documentation
- **[π¨ Template Guide](docs/templates/)** - Custom template development
- **[ποΈ Architecture Patterns](docs/architecture/)** - System design and integration
### π Advanced Features
- **π€ Claude Code Integration** - Structured workflows and subagent coordination
- **π Agent Report Cards** - Performance grading and quality metrics
- **π Vector Search** - FAISS integration for semantic search
- **π Security Framework** - Comprehensive access control and audit trails
### π Production Deployment
- **π PostgreSQL Setup** - Enterprise-scale deployment guide
- **π Monitoring** - Performance tracking and alerting
- **π Backup & Recovery** - Data protection strategies
- **π Multi-tenant** - Organizational deployment patterns
---
## π License
MIT License - see [LICENSE](LICENSE) file for details.
---
## π Acknowledgments
Built with passion for better documentation and AI-human collaboration. Special thanks to:
- The **MCP protocol** team for the standardized AI tool interface
- **Jinja2** for the powerful and secure templating system
- Our **early adopters** for invaluable feedback and feature suggestions
---
<div align="center">
**π Ready to transform your documentation?**
[Start Logging](#-quick-start) β’ [Explore Templates](#-template-system-showcase) β’ [Read Whitepaper](docs/whitepapers/scribe_mcp_whitepaper.md)
*Join thousands of developers and AI teams using Scribe for bulletproof documentation governance*
</div>