๐ MCP ADR Analysis Server - Usage Guide โ
A comprehensive guide for using the MCP ADR Analysis Server across different project scenarios. This guide provides practical examples with actual tool calls for three common use cases.
๐ Quick Setup โ
Installation โ
# Global installation (recommended)
npm install -g mcp-adr-analysis-server
# Verify installation
mcp-adr-analysis-server --version
MCP Client Configuration โ
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"adr-analysis": {
"command": "mcp-adr-analysis-server",
"env": {
"PROJECT_PATH": "/path/to/your/project",
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
"EXECUTION_MODE": "full",
"AI_MODEL": "anthropic/claude-3-sonnet",
"ADR_DIRECTORY": "docs/adrs",
"LOG_LEVEL": "INFO"
}
}
}
}
๐ฏ Three Main Use Cases โ
1. ๐ Projects with Existing ADRs โ
Scenario: You have a project with existing Architectural Decision Records and want to analyze, enhance, or maintain them.
Key Tools for This Scenario: โ
discover_existing_adrs
- Find and catalog existing ADRsanalyze_project_ecosystem
- Understand current architecturesuggest_adrs
- Identify missing decisionsgenerate_adr_todo
- Create action items from ADRs
Step-by-Step Workflow: โ
Step 1: Discover Existing ADRs
Tool: discover_existing_adrs
Parameters:
{
"adrDirectory": "docs/adrs"
}
This will scan your ADR directory, catalog all existing decisions, and initialize the .mcp-adr-cache
infrastructure (always runs regardless of whether ADRs are found).
Step 2: Analyze Project Architecture
Tool: analyze_project_ecosystem
Parameters: {}
Analyzes your entire project to understand the current technology stack and patterns.
Step 3: Identify Missing Decisions
Tool: suggest_adrs
Parameters:
{
"analysisType": "comprehensive",
"existingAdrs": ["Use React for Frontend", "PostgreSQL for Database"]
}
Suggests new ADRs based on code analysis and existing decisions.
Step 4: Generate Enhanced TDD Action Items
Tool: generate_adr_todo
Parameters:
{
"scope": "all",
"phase": "both",
"linkAdrs": true,
"includeRules": true
}
Creates a comprehensive todo.md with two-phase TDD approach, linking all ADRs and including architectural rules validation.
Step 5: Validate Implementation Progress
Tool: compare_adr_progress
Parameters:
{
"todoPath": "todo.md",
"adrDirectory": "docs/adrs",
"deepCodeAnalysis": true,
"functionalValidation": true,
"strictMode": true
}
Validates that implementations are production-ready and meet ADR goals, with sophisticated mock vs production detection.
2. ๐ Projects Without Any ADRs โ
Scenario: You have an existing codebase but no documented architectural decisions. You want to start documenting your architecture.
Key Tools for This Scenario: โ
analyze_project_ecosystem
- Understand current architecturesuggest_adrs
- Discover implicit decisionsgenerate_adr_from_decision
- Create formal ADRs
Step-by-Step Workflow: โ
Step 1: Analyze Your Project
Tool: analyze_project_ecosystem
Parameters: {
"includePatterns": ["*.js", "*.ts", "*.py", "*.java", "package.json", "requirements.txt"]
}
Discovers your technology stack, frameworks, and architectural patterns.
Step 2: Discover Implicit Decisions
Tool: suggest_adrs
Parameters: {
"analysisType": "implicit_decisions"
}
Identifies architectural decisions that are implicit in your code but not documented.
Step 3: Create Your First ADRs
Tool: generate_adr_from_decision
Parameters: {
"decisionData": {
"title": "Use Express.js for API Server",
"context": "Need a web framework for our Node.js backend API",
"decision": "We will use Express.js as our web application framework",
"consequences": "Fast development, large ecosystem, but requires additional middleware for advanced features",
"alternatives": ["Fastify", "Koa.js", "NestJS"]
}
}
Creates a properly formatted ADR from decision data.
3. ๐ New Projects with PRD.md โ
Scenario: You're starting a new project and have a Product Requirements Document (PRD.md). You want to generate ADRs from your requirements.
Key Tools for This Scenario: โ
generate_adrs_from_prd
- Convert PRD to ADRsanalyze_project_ecosystem
- Validate generated decisionsgenerate_adr_todo
- Create implementation tasks
Step-by-Step Workflow: โ
Step 1: Generate ADRs from PRD
Tool: generate_adrs_from_prd
Parameters: {
"prdPath": "PRD.md",
"outputDirectory": "docs/adrs"
}
Analyzes your PRD.md and generates appropriate ADRs for architectural decisions.
Step 2: Validate Against Project Context
Tool: analyze_project_ecosystem
Parameters: {}
Ensures generated ADRs align with your project structure and constraints.
Step 3: Create Implementation Tasks
Tool: generate_adr_todo
Parameters: {
"scope": "pending"
}
Generates actionable tasks from your newly created ADRs.
๐งช Enhanced TDD Workflow โ
The server now provides a sophisticated Test-Driven Development workflow that integrates all ADRs in your system:
Two-Phase TDD Approach โ
Phase 1: Generate Test Specifications
Tool: generate_adr_todo
Parameters: {
"phase": "test",
"linkAdrs": true,
"includeRules": true,
"outputPath": "todo-tests.md"
}
Generates comprehensive mock test specifications that link all ADRs for complete system coverage.
Phase 2: Generate Production Implementation
Tool: generate_adr_todo
Parameters: {
"phase": "production",
"linkAdrs": true,
"includeRules": true,
"outputPath": "todo-implementation.md"
}
Creates production-ready implementation tasks that pass the mock tests and meet ADR goals.
Advanced Validation System โ
Comprehensive Progress Validation
Tool: compare_adr_progress
Parameters: {
"todoPath": "todo.md",
"adrDirectory": "docs/adrs",
"projectPath": "/path/to/project",
"deepCodeAnalysis": true, // Distinguish mock from production code
"functionalValidation": true, // Validate code actually works
"strictMode": true, // Reality-check mechanisms
"includeTestCoverage": true, // Validate test coverage
"validateDependencies": true, // Check cross-ADR dependencies
"environmentValidation": true // Test in realistic environments
}
Prevents LLM overconfidence by detecting mock implementations masquerading as production code.
Mock vs Production Detection โ
The validation system includes sophisticated patterns to detect:
- Mock Implementations: Console.log returns, hardcoded values, TODO comments
- Production Code: Error handling, input validation, integration tests, real database connections
- ADR Goal Compliance: Validates implementations actually achieve ADR objectives
๐ง Advanced Features โ
Content Security & Masking โ
Protect sensitive information in your analysis:
Tool: analyze_content_security
Parameters: {
"content": "Your code or documentation",
"contentType": "code"
}
Research Integration โ
Incorporate research findings into decisions:
Tool: generate_research_questions
Parameters: {
"context": "Choosing between microservices and monolith",
"scope": "architecture"
}
Rule Generation & Validation โ
Create and enforce architectural rules:
Tool: generate_rules
Parameters: {
"adrDirectory": "docs/adrs",
"includeCompliance": true
}
๐ Available Resources โ
Access structured data through MCP resources:
adr://architectural_knowledge_graph
- Complete project analysis graphadr://analysis_report
- Comprehensive project reportsadr://adr_list
- ADR inventory and metadata
๐ Common Workflows โ
Weekly ADR Review โ
discover_existing_adrs
- Check current statesuggest_adrs
- Find new decisions neededgenerate_adr_todo
- Update action items with TDD approachcompare_adr_progress
- Validate implementation progress
New Feature Planning โ
analyze_project_ecosystem
- Understand current statesuggest_adrs
- Identify decisions needed for featuregenerate_adr_from_decision
- Document decisionsgenerate_adr_todo
- Create TDD implementation plan
Architecture Audit โ
analyze_project_ecosystem
- Full project analysisgenerate_rules
- Extract current rulesvalidate_rules
- Check compliancecompare_adr_progress
- Validate production readiness
TDD Implementation Cycle โ
generate_adr_todo
(phase: "test") - Create test specifications- Implement mock tests based on generated specifications
generate_adr_todo
(phase: "production") - Create implementation tasks- Implement production code to pass tests
compare_adr_progress
- Validate against ADR goals and detect mock patterns
Quality Assurance Review โ
compare_adr_progress
(strictMode: true) - Deep validationgenerate_rules
- Extract architectural rulesvalidate_rules
- Check rule compliance- Address any mock implementations flagged by validation
๐ Next Steps โ
- Detailed Setup Guide - Complete installation and configuration
- ADR Examples - See real ADRs from this project
- NPM Publishing - Deploy your own MCP server
Need Help? Open an issue on GitHub