# Bootstrap Process Example This document shows a complete example of the automatic bootstrap process when a new repository is set up with the MCP Local RAG system. ## User Action User copies bootstrap package to repository root, then types: ``` Please bootstrap from MCP_BOOTSTRAP_PACKAGE.md ``` ## Phase 1: Root Context Auto-Population **Claude's Action**: Automatically detects repository structure and populates the root context. ### Discovery Process: ```bash # Claude automatically runs these commands ls -la # Find top-level directories find mcp-docs -name "*.pdf" | head -5 # Check for documentation cat README.md # Read project description cat build.gradle # Detect Java/Gradle grep -r "@SpringBootApplication" # Find Spring Boot ``` ### Claude's Output: ``` I'm bootstrapping the context system for your repository. Phase 1: Creating root context... Auto-detected: - Repository: payment-processor - Purpose: (from README.md) "Payment processing service for handling transactions" - Main modules: api/, core/, processors/, shared/ - Technologies: Java 17, Gradle, Spring Boot, PostgreSQL, Kafka - Documentation: Found 3 PDFs in mcp-docs/ Writing CLAUDE_CONTEXT.md... Root context created (152 lines) ``` **Generated File**: `CLAUDE_CONTEXT.md` ```markdown # Payment Processor - Claude Context ## MCP Documentation System > **Full MCP Rules**: See `mcp-docs/claude-code/MCP_STANDARD_RULES.md` for complete documentation access workflow > > This repository uses MCP Local RAG for semantic search over payment specifications. ### Repository-Specific MCP Configuration - **`{{DOC_TYPE}}`**: Payment specifications - **`{{DOCS_DIR}}`**: `mcp-docs/` - **`{{SETUP_SCRIPT}}`**: `mcp-docs/claude-code/setup.sh` **Available Documentation**: - Payment specs: `mcp-docs/` (3 PDF files found) --- ## Purpose Payment processing service for handling transactions with support for multiple payment networks. ## Repository Structure ### Main Modules - **api/**: REST API endpoints for payment requests - **core/**: Core payment processing logic - **processors/**: Network-specific payment processors - **shared/**: Shared utilities and models [... rest of auto-generated content ...] ``` ## Phase 2: Module Context Auto-Creation **Claude's Action**: Automatically identifies major modules and creates contexts for each. ### Claude's Output: ``` Phase 2: Creating module contexts... Identified modules: 1. api/ (REST API layer) 2. core/ (Payment processing core) 3. processors/ (Network processors) 4. shared/ (Shared utilities) Creating contexts for top 3 modules... ``` ### Module 1: api/ ```bash # Claude runs discovery commands cd api find . -type d -maxdepth 2 # Package structure find . -name "*.java" | head -10 # Find key classes grep -r "@RestController" # Find controllers cat src/main/resources/application.yml # Check config ``` **Output**: ``` api/CLAUDE_CONTEXT.md created (87 lines) - Detected: Spring REST controllers, 3 main endpoints - Key classes: PaymentController, AuthController, WebhookController - Configuration: Port 8080, security config detected ``` ### Module 2: core/ ```bash cd core find . -name "*Service.java" # Service layer find . -name "*Repository.java" # Data layer grep -r "public class.*Processor" # Core processors ``` **Output**: ``` core/CLAUDE_CONTEXT.md created (124 lines) - Detected: Service layer with 5 services - Processing flow: Request → Validation → Authorization → Settlement - Data models: Payment, Transaction, AuthResult ``` ### Module 3: processors/ ```bash cd processors ls -la # Submodules find . -name "*.java" | wc -l # Class count grep -r "extends.*Processor" # Processor hierarchy ``` **Output**: ``` processors/CLAUDE_CONTEXT.md created (156 lines) - Detected: Network-specific processors - Processing flow: Route → Format → Submit → Parse response - External documentation: Links to payment specs in mcp-docs/ ``` ### Claude Asks: ``` I've created contexts for api/, core/, and processors/ (3 modules). Should I continue with shared/ module, or are these three sufficient for now? You can always add more module contexts later using the template. ``` **User responds**: "These three are sufficient" ## Phase 3: Completion Report **Claude's Output**: ``` Context System Bootstrap Complete Root Context: CLAUDE_CONTEXT.md (152 lines) Module Contexts Created: - api/CLAUDE_CONTEXT.md (87 lines) - core/CLAUDE_CONTEXT.md (124 lines) - processors/CLAUDE_CONTEXT.md (156 lines) MCP Documentation System: Configured - Found 3 PDFs in mcp-docs/ - MCP setup script available: mcp-docs/claude-code/setup.sh - Run setup and restart Claude Code to enable documentation queries Git Status: All files staged for commit - mcp-docs/claude-code/ (7 files) - CLAUDE_CONTEXT.md - api/CLAUDE_CONTEXT.md - core/CLAUDE_CONTEXT.md - processors/CLAUDE_CONTEXT.md Next Steps: 1. Review generated contexts for accuracy 2. Run MCP setup: cd mcp-docs && ./claude-code/setup.sh 3. Restart Claude Code 4. Review staged changes: git status 5. Commit when ready: git commit -m "Add Claude Code context system" Total time: ~3 minutes ``` ## What Just Happened? 1. **User ran one command**: "Please bootstrap from MCP_BOOTSTRAP_PACKAGE.md" 2. **Claude automatically**: - Analyzed repository structure - Detected technologies and build tools - Read README for purpose - Found documentation in mcp-docs/ - Created root CLAUDE_CONTEXT.md with all details - Identified 4 major modules - Created 3 module-specific contexts (asked about 4th) - Staged all created files in git - Generated actionable next steps 3. **Result**: Complete context system in ~3 minutes with minimal user interaction 4. **Benefits**: - No manual template filling - No guessing about structure - Documentation automatically linked - Cross-module references included - Files automatically staged in git - Ready to use immediately ## After Bootstrap ### User runs MCP setup: ```bash cd mcp-docs ./claude-code/setup.sh ``` Setup script: 1. Installs Node.js (if needed) 2. Installs mcp-local-rag package 3. Configures ~/.claude.json 4. Verifies PDF files 5. Provides ingestion instructions ### User restarts Claude Code MCP Local RAG is now active. Documentation queries work automatically: ``` User: "What are the field definitions for payment authorization messages?" Claude: 1. Checks if MCP is configured 2. Queries documentation: mcp__local-rag__query_documents("authorization message fields") 3. Returns results from payment specs ``` ## Key Takeaways **Efficiency**: - Bootstrap: 3 minutes (vs 30+ minutes manual) - One user command (vs 10+ manual steps) - 3-5 contexts created automatically **Accuracy**: - Auto-detection from actual code structure - No placeholder mistakes - Consistent formatting **Maintainability**: - Templates stay generic - Easy to propagate updates - Self-documenting system **User Experience**: - Minimal interaction required - Clear progress updates - Actionable next steps