Skip to main content
Glama
srwlli

Documentation Generator MCP Server

by srwlli
MCP-DEV-LOG-PROPOSAL.txt16.1 kB
# MCP Workflow Proposal: Automated Dev Log Generation ## Executive Summary During our CodeRef scanner fixes session, I created comprehensive session documentation that captured what was done, why, and the measurable impact. This proposal outlines creating an MCP workflow that automatically generates these dev logs for any project, triggered on-demand or at session milestones. --- ## What We Created (Example from Our Session) ### RETEST-COMPARISON.md - Session Impact Report A comprehensive report documenting the work session's results: **Structure:** 1. **Executive Summary**: What was accomplished, overall grade 2. **Metrics Comparison**: Before/after tables with improvement percentages 3. **Issue Resolution Status**: Detailed verification for each fix 4. **Query/Test Results**: Real-world validation 5. **Performance Metrics**: Quantifiable improvements 6. **Success Criteria**: Pass/fail verification 7. **Code Changes Summary**: What files changed and why 8. **Recommendations**: Future work **Real Example:** ```markdown ## Metrics Comparison | Metric | Before Fixes | After Fixes | Improvement | |--------|--------------|-------------|-------------| | **Total Elements** | 444,372 | 1,072 | **99.76% reduction** ✅ | | **File size** | 89 MB | 0.15 MB | **99.83% smaller** ✅ | | **Scan time** | ~30s | ~10s | **Improved** ✅ | ### Final Grade: **A+** **System is production-ready** with 99.76% reduction in scan noise and 100% type classification accuracy. ``` **Value:** - ✅ Instant session summary for stakeholders - ✅ Quantifiable proof of impact - ✅ Professional documentation automatically generated - ✅ No manual report writing needed - ✅ Consistent format across all projects --- ## Proposed MCP Workflow ### Tool: `generate_dev_log` **Description**: Generate comprehensive dev log documenting a work session **When to trigger:** - After completing a feature implementation - After fixing bugs and running validation - At the end of a significant work session - Before/after comparison for any code changes - When user explicitly requests: "create dev log" **Parameters:** ```typescript { project_path: string; // Absolute path to project session_context: string; // What was worked on (e.g., "scanner bug fixes") before_state?: object; // Optional: Metrics/state before changes after_state?: object; // Optional: Metrics/state after changes files_changed?: string[]; // Files modified during session issues_addressed?: string[]; // Issue IDs or descriptions output_path?: string; // Where to save (default: project_root/devlogs/) } ``` **Output:** Creates a markdown file: `devlogs/session-{context}-{timestamp}.md` **Example Usage:** ```typescript mcp__devlog__generate_dev_log({ project_path: "/Users/dev/coderef-system", session_context: "scanner-bug-fixes", before_state: { total_elements: 444372, node_modules_elements: 424906, file_size_mb: 89, scan_time_seconds: 30, type_accuracy_percent: 85 }, after_state: { total_elements: 1072, node_modules_elements: 0, file_size_mb: 0.15, scan_time_seconds: 10, type_accuracy_percent: 100 }, files_changed: [ "packages/core/scanner.ts", "packages/core/types.ts", "packages/core/package.json" ], issues_addressed: [ "ISSUE-001: Exclusion patterns not working", "ISSUE-003: dist/ directory not excluded", "ISSUE-004: Constants misclassified", "ISSUE-005: Duplicate elements" ] }) ``` **Generated Output:** ```markdown # Dev Log: Scanner Bug Fixes **Date**: October 14, 2025, 3:45 PM **Project**: CodeRef System **Duration**: ~4 hours --- ## Executive Summary Successfully fixed all 4 critical scanner issues. System is now production-ready with 99.76% reduction in scan noise and 100% type classification accuracy. ### Overall Grade: A- → A+ (Excellent) --- ## Metrics Comparison | Metric | Before | After | Improvement | |--------|--------|-------|-------------| | Total Elements | 444,372 | 1,072 | **99.76% reduction** ✅ | | node_modules elements | 424,906 | 0 | **100% eliminated** ✅ | | File Size | 89 MB | 0.15 MB | **99.83% smaller** ✅ | | Scan Time | ~30s | ~10s | **3x faster** ✅ | | Type Accuracy | 85% | 100% | **+15%** ✅ | --- ## Issues Addressed ### ISSUE-001: Exclusion patterns not working ✅ FIXED **Impact**: 424,906 node_modules elements eliminated **Fix**: Added minimatch library, implemented shouldExcludePath() helper ### ISSUE-003: dist/ directory not excluded ✅ FIXED **Impact**: ~21,000 dist/ elements eliminated **Fix**: Same exclusion logic fix ### ISSUE-004: Constants misclassified ✅ FIXED **Impact**: 35 constants now correctly classified **Fix**: Added 'constant' type, created ALL_CAPS detection pattern ### ISSUE-005: Duplicate elements ✅ FIXED **Impact**: Each element appears exactly once (1,249 → 1,072) **Fix**: Implemented deduplication with type priority system --- ## Code Changes **Files Modified (3):** 1. `packages/core/scanner.ts` (~80 lines) - Added minimatch import - Created TYPE_PRIORITY constant - Implemented shouldExcludePath() helper - Implemented deduplicateElements() function - Added constant detection patterns 2. `packages/core/types.ts` (1 line) - Added 'constant' to ElementData type union 3. `packages/core/package.json` - Added dependency: minimatch@^10.0.3 --- ## Success Criteria ✅ **All 8/8 criteria met or exceeded:** - ✅ node_modules exclusion: 0 elements - ✅ dist/ exclusion: 0 elements - ✅ Constant classification: 100% accuracy - ✅ Component classification: 100% accuracy - ✅ No duplicates: 1.0x per element - ✅ Performance: ~10s (target: < 60s) - ✅ File size: 0.15MB (target: < 5MB) - ✅ Query accuracy: ~100% (target: > 90%) --- ## Recommendations ### Future Enhancements 1. Add unit tests for scanner functions 2. Improve query pattern matching (word boundaries) 3. Create inverted index for faster searches 4. Detect TypeScript interfaces and type aliases --- **Session completed successfully. System is production-ready.** _Generated automatically by Claude Code MCP Dev Log_ ``` --- ## Integration Points ### 1. Post-Implementation Hook After completing implementation of a feature/fix: ```typescript // AI automatically calls this after marking all todos complete mcp__devlog__generate_dev_log({ project_path: currentProject, session_context: featureName, // Auto-gather metrics from git diff, test results, etc. }) ``` ### 2. User-Triggered Command ```typescript User: "create dev log for this session" // AI calls: mcp__devlog__generate_dev_log({ project_path: currentProject, session_context: "current-session", // Analyze conversation history for context }) ``` ### 3. Checkpoint Commits Before creating checkpoint commits: ```typescript // Generate dev log first const devLog = await mcp__devlog__generate_dev_log({...}); // Then commit with reference to dev log git commit -m "Fix scanner issues\n\nSee devlogs/session-scanner-fixes-20251014.md for details" ``` ### 4. Testing Workflows After running validation/retests: ```typescript // Capture before state const before = captureMetrics(); // Run tests/fixes ... // Capture after state const after = captureMetrics(); // Generate comparison log mcp__devlog__generate_dev_log({ before_state: before, after_state: after, session_context: "validation-retest" }); ``` --- ## File Structure ``` project-root/ ├── devlogs/ # All session dev logs │ ├── session-scanner-fixes-20251014.md # Today's scanner work │ ├── session-api-refactor-20251012.md # Previous session │ ├── session-ui-improvements-20251010.md # Earlier session │ └── index.md # Auto-generated index ├── test-results/ # Test-specific outputs │ └── noted-test/ │ ├── scan-output.json │ └── index.json └── coderef/ └── working/ └── feature-plans/ ``` **Index Generation:** MCP tool can generate `devlogs/index.md`: ```markdown # Dev Log Index ## October 2025 - 2025-10-14: [Scanner Bug Fixes](session-scanner-fixes-20251014.md) - Fixed 4 critical issues ✅ - 2025-10-12: [API Refactor](session-api-refactor-20251012.md) - Improved response time by 40% - 2025-10-10: [UI Improvements](session-ui-improvements-20251010.md) - Added dark mode support ## Statistics - Total sessions: 3 - Total files changed: 47 - Total issues fixed: 12 ``` --- ## Auto-Detection Features The MCP tool should intelligently gather context: ### 1. Git Diff Analysis ```typescript // Automatically detect what changed const gitDiff = execSync('git diff HEAD~1..HEAD').toString(); const filesChanged = parseGitDiff(gitDiff); ``` ### 2. Commit Message Mining ```typescript // Extract context from recent commits const commits = execSync('git log -5 --oneline').toString(); const issues = extractIssueIds(commits); ``` ### 3. Test Result Parsing ```typescript // If test results exist, include metrics const testResults = readJsonFile('test-results/latest.json'); const metrics = { tests_passed: testResults.passed, tests_failed: testResults.failed, coverage_percent: testResults.coverage }; ``` ### 4. Conversation History Analysis ```typescript // AI analyzes conversation for: - What problems were encountered - What solutions were implemented - What decisions were made - What trade-offs were considered ``` --- ## Template Variations ### Template 1: Bug Fix Session ```markdown # Dev Log: {Context} **Date**: {Date} **Type**: Bug Fixes ## Issues Fixed {List of issues with before/after} ## Performance Impact {Metrics comparison} ## Code Changes {Files and summaries} ``` ### Template 2: Feature Implementation ```markdown # Dev Log: {Context} **Date**: {Date} **Type**: Feature Implementation ## Feature Overview {Description of what was built} ## Implementation Highlights {Key decisions and approaches} ## Testing & Validation {How it was verified} ## Code Changes {Files and summaries} ``` ### Template 3: Refactoring Session ```markdown # Dev Log: {Context} **Date**: {Date} **Type**: Refactoring ## Motivation {Why refactoring was needed} ## Changes Made {What was restructured} ## Performance/Quality Impact {Before/after metrics} ## Migration Notes {Any breaking changes or upgrade steps} ``` ### Template 4: Investigation/Analysis ```markdown # Dev Log: {Context} **Date**: {Date} **Type**: Investigation ## Problem Statement {What was being investigated} ## Findings {What was discovered} ## Recommendations {Suggested next steps} ## Evidence {Logs, metrics, test results} ``` --- ## Advanced Features (Phase 2) ### 1. Cross-Project Insights ```typescript mcp__devlog__get_insights({ query: "Show me all performance improvement sessions" }) // Returns: // - Session 1: 40% faster API responses // - Session 2: 99.76% reduction in scan time // - Session 3: 3x faster build time ``` ### 2. Automatic Screenshots ```typescript // If working on UI, auto-capture screenshots mcp__devlog__generate_dev_log({ ... include_screenshots: true // Auto-capture before/after UI }) ``` ### 3. Video Recording ```typescript // For complex workflows mcp__devlog__generate_dev_log({ ... include_screen_recording: true // Loom-style walkthrough }) ``` ### 4. Interactive Comparisons ```typescript // Generate interactive HTML reports mcp__devlog__generate_dev_log({ ... format: "html" // Interactive tables, charts, diffs }) ``` --- ## Real-World Benefits ### For Individual Developers 1. **Memory Aid**: "What did I do last week?" → Read dev log 2. **Portfolio**: Collection of documented accomplishments 3. **Learning**: Patterns emerge across sessions 4. **Context Switching**: Quick re-entry after interruptions ### For Teams 1. **Knowledge Sharing**: Others see what was done and why 2. **Onboarding**: New devs read dev logs to understand history 3. **Code Review**: Reviewers get context beyond commit messages 4. **Retrospectives**: Data-driven sprint reviews ### For Stakeholders 1. **Progress Reports**: Auto-generated, no manual work 2. **Impact Metrics**: Quantifiable improvements 3. **Transparency**: Clear audit trail of work 4. **Decision Context**: Why choices were made --- ## Implementation Checklist ### Phase 1: MVP (1-2 days) - [ ] Create `mcp__devlog__generate_dev_log` tool - [ ] Implement basic markdown template - [ ] Git diff analysis for files changed - [ ] Manual before/after metrics input - [ ] Save to `devlogs/` directory ### Phase 2: Auto-Detection (2-3 days) - [ ] Conversation history analysis - [ ] Test result parsing - [ ] Commit message mining - [ ] Auto-generate index.md ### Phase 3: Advanced Features (3-5 days) - [ ] Multiple template variations - [ ] Cross-project insights - [ ] HTML export option - [ ] Screenshot integration --- ## Configuration Add to project `.claude/settings.json`: ```json { "devlog": { "enabled": true, "auto_generate": true, "trigger": "on_checkpoint_commit", "output_dir": "devlogs", "format": "markdown", "include_metrics": true, "include_git_diff": true, "template": "auto" // or "bug-fix", "feature", "refactor" } } ``` --- ## Example User Flows ### Flow 1: Automatic (No User Action) ``` 1. User works on fixing bugs 2. User creates checkpoint commit 3. MCP detects commit, auto-triggers generate_dev_log 4. Dev log created: devlogs/session-bug-fixes-20251014.md 5. Claude: "Created dev log documenting 4 bug fixes. See devlogs/..." ``` ### Flow 2: Explicit Request ``` User: "create dev log" Claude: I'll generate a dev log for this session. [Analyzes conversation history] [Detects files changed via git diff] [Creates comprehensive dev log] Claude: "Created dev log: devlogs/session-scanner-improvements-20251014.md ## Summary - Fixed 4 critical issues - 99.76% reduction in scan noise - All success criteria met (8/8) Would you like me to commit this to git?" ``` ### Flow 3: Before/After Comparison ``` User: "create dev log comparing before and after" Claude: I'll generate a comparison report. [Captures current state] [Compares to baseline/previous commit] [Generates metrics tables] Claude: "Created comparison report: devlogs/comparison-20251014.md ## Key Improvements - Performance: 30s → 10s (3x faster) - Accuracy: 85% → 100% - File size: 89MB → 0.15MB Grade: A- → A+" ``` --- ## Success Metrics How to measure if this is valuable: 1. **Adoption**: % of sessions that generate dev logs 2. **Retrieval**: How often devs reference past dev logs 3. **Time Saved**: Reduction in manual report writing time 4. **Stakeholder Value**: Positive feedback on documentation quality 5. **Knowledge Retention**: Improved context across session boundaries --- ## Questions for Dev Team 1. **Trigger**: Should dev logs auto-generate on checkpoint commits, or only when explicitly requested? 2. **Naming**: Prefix `mcp__devlog__*` or `mcp__session__*` or something else? 3. **Storage**: Should dev logs be git-tracked or gitignored? 4. **Format**: Start with markdown only, or support HTML/JSON export from day 1? 5. **Integration**: Part of existing docs-mcp server or new devlog-mcp server? 6. **Privacy**: Any sensitive data concerns? (credentials, internal URLs, etc.) --- ## Conclusion This dev log workflow emerged from real work and proved invaluable for: - **Capturing** session accomplishments automatically - **Quantifying** impact with before/after metrics - **Communicating** results without manual report writing - **Preserving** context across session boundaries Making this an MCP workflow would provide automatic session documentation for all projects, turning every work session into a professional, shareable dev log. --- **Document prepared by**: Claude (AI Assistant) **Based on session**: CodeRef Scanner Bug Fixes (October 14, 2025) **Example dev log**: test-results/noted-test/RETEST-COMPARISON.md **Status**: Proposal - Ready for Dev Team Review

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/srwlli/docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server