๐ Getting Started: Projects Without ADRs โ
This guide helps you set up ADR analysis in an existing repository that has no Architectural Decision Records (ADRs). You'll learn how to discover architectural decisions hidden in your codebase and generate your first ADRs automatically.
๐ก NEW: For intelligent workflow recommendations, see the Workflow & Development Guidance guide that provides AI-powered tool sequence recommendations based on your specific goals.
๐ Prerequisites โ
Required Software โ
- Node.js โฅ18.0.0
- MCP Client (Claude Desktop, Cline, Cursor, or Windsurf)
- Git repository with existing code
MCP Server Installation โ
Choose your preferred installation method:
# Global installation (recommended)
npm install -g mcp-adr-analysis-server
# Or use npx for one-time usage
npx mcp-adr-analysis-server@latest
# Or use uvx (Python users)
uvx mcp-adr-analysis-server@latest
โ๏ธ Configuration โ
1. Environment Variables โ
Set up your environment variables. The server needs to know where your project is located:
export PROJECT_PATH="/path/to/your/project"
export ADR_DIRECTORY="docs/adrs"
export LOG_LEVEL="INFO"
export CACHE_ENABLED="true"
2. MCP Client Configuration โ
Claude Desktop โ
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"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"
}
}
}
}
Cline (VS Code) โ
Add to your Cline MCP settings:
{
"mcpServers": {
"adr-analysis": {
"command": "mcp-adr-analysis-server",
"args": [],
"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"
}
}
}
}
3. Project Structure Setup โ
Create the ADR directory in your project:
mkdir -p docs/adrs
๏ฟฝ Step-by-Step Workflow โ
Step 1: Analyze Current Project Architecture โ
Start by understanding your existing codebase and implicit architectural decisions:
Tool Call:
analyze_project_ecosystem
Parameters:
{
"includePatterns": ["*.js", "*.ts", "*.py", "*.java", "*.go", "package.json", "requirements.txt", "pom.xml"]
}
What this does:
- Scans your entire codebase
- Identifies technology stack and frameworks
- Discovers architectural patterns in use
- Analyzes dependencies and their relationships
- Detects implicit architectural decisions
Expected Output:
- Complete technology stack analysis (e.g., TypeScript, Node.js, React, Express)
- Framework and library inventory
- Architectural patterns identification (MVC, Component-based, REST API)
- Dependency analysis
- List of implicit decisions that should be documented
Step 2: Get Detailed Architectural Context โ
Dive deeper into your project's architectural details:
Tool Call:
get_architectural_context
Parameters:
{
"includeCompliance": true
}
What this does:
- Analyzes code structure and design patterns
- Identifies quality attributes (security, performance, maintainability)
- Reviews compliance with best practices
- Provides detailed architectural insights
Expected Output:
- Architectural style analysis (e.g., Layered Architecture, Microservices)
- Design patterns in use (Factory, Observer, Singleton, etc.)
- Code quality and compliance assessment
- Recommendations for improvement
- Security and performance assessment
Step 3: Discover Implicit Architectural Decisions โ
Find architectural decisions that are already embedded in your code but not documented:
Tool Call:
suggest_adrs
Parameters:
{
"analysisType": "implicit_decisions"
}
What this does:
- Analyzes your code for implicit architectural decisions
- Identifies patterns and choices you've already made
- Suggests which decisions should be documented as ADRs
- Prioritizes suggestions based on impact and importance
Expected Output:
- List of suggested ADRs with titles and rationale
- Priority ranking for each suggestion
- Context for why each decision should be documented
Example suggestions you might get:
- "Use TypeScript for Type Safety" - detected TypeScript usage throughout codebase
- "Express.js for REST API" - identified Express framework for server implementation
- "Component-based Architecture" - found React component patterns
Step 4: Create Your First ADRs โ
Transform suggestions into properly formatted ADR documents:
Tool Call:
generate_adr_from_decision
Parameters:
{
"decisionData": {
"title": "Use TypeScript for Type Safety",
"context": "Need to ensure code quality and reduce runtime errors in our JavaScript application",
"decision": "We will use TypeScript for all new code and gradually migrate existing JavaScript",
"consequences": "Better code quality and IDE support, but requires build step and learning curve",
"alternatives": ["Plain JavaScript", "Flow", "JSDoc with type annotations"],
"evidence": ["Existing TypeScript usage in codebase", "Team familiarity", "Industry best practices"]
}
}
What this does:
- Generates a properly formatted ADR document
- Includes all standard ADR sections (Context, Decision, Consequences)
- Saves to your configured ADR directory with proper numbering
- Follows ADR template and formatting standards
Step 5: Generate Enhanced TDD Implementation Tasks โ
Create actionable tasks using the new two-phase TDD approach:
Tool Call:
generate_adr_todo
Parameters:
{
"scope": "all",
"phase": "both",
"linkAdrs": true,
"includeRules": true
}
What this does:
- Reviews all your ADRs for implementation tasks with TDD approach
- Links all ADRs to create system-wide test coverage
- Integrates architectural rules validation
- Creates both test specifications and implementation tasks
- Generates a prioritized todo.md file with validation checkpoints
Expected Output:
todo.md
file with TDD-focused structured task list- Test specifications linking all ADRs for comprehensive coverage
- Implementation tasks with architectural rule compliance checks
- Priority levels, estimated effort, and dependencies
- Production readiness validation criteria
Example tasks you might get:
- Phase 1 (Tests): "Create TypeScript integration tests for all modules" (High priority, 1 week)
- Phase 2 (Implementation): "Implement TypeScript migration with error handling" (High priority, 2 weeks)
- Validation: "Verify production-ready TypeScript setup meets ADR goals" (Critical, 2 days)
Step 6: AI-Powered Workflow Orchestration โ
When starting from scratch, let AI plan your implementation workflow:
Tool Call:
tool_chain_orchestrator
Parameters:
{
"operation": "generate_plan",
"userRequest": "Set up complete ADR infrastructure and generate initial implementations for new project",
"includeContext": true,
"optimizeFor": "comprehensive"
}
What this does:
- AI analyzes your project needs and generates optimal tool execution sequence
- Prevents confusion with structured workflow planning
- Provides clear dependencies and execution order
- Includes confidence scoring and alternative approaches
Step 7: Advanced TODO Management โ
Use the sophisticated TODO management system:
Tool Call:
manage_todo
Parameters:
{
"operation": "add_tasks",
"todoPath": "TODO.md",
"section": "Architecture Implementation",
"tasks": [
{
"title": "Implement TypeScript setup",
"status": "pending",
"priority": "high",
"assignee": "dev-team"
}
]
}
Advanced TODO Features:
- Complete task lifecycle management (pending โ in_progress โ completed)
- Dynamic health scoring integration
- Progress analytics with velocity metrics
- Smart merging with ADR-generated tasks
Step 8: Establish Quality Validation โ
Set up validation to ensure implementations meet ADR goals:
Tool Call:
compare_adr_progress
Parameters:
{
"todoPath": "todo.md",
"adrDirectory": "docs/adrs",
"deepCodeAnalysis": true,
"functionalValidation": true,
"strictMode": true
}
What this does:
- Validates that implementations are production-ready and meet ADR goals
- Distinguishes mock implementations from production code
- Checks functional correctness in realistic environments
- Provides reality-check mechanisms against overconfident assessments
- Validates cross-ADR dependencies and consistency
Expected Output:
- Comprehensive validation report
- Mock vs production code analysis
- ADR goal compliance assessment
- Specific recommendations for improving implementation quality
- Quality gates for deployment readiness
Step 9: Deployment Readiness Validation โ
Before deploying your new architecture, ensure everything is ready:
Tool Call:
deployment_readiness
Parameters:
{
"operation": "full_audit",
"targetEnvironment": "production",
"maxTestFailures": 0,
"requireTestCoverage": 80,
"blockOnFailingTests": true,
"integrateTodoTasks": true,
"requireAdrCompliance": true,
"strictMode": true
}
What this does:
- Validates all tests are passing (zero tolerance)
- Ensures minimum test coverage requirements
- Checks deployment history (if available)
- Validates ADR compliance in implementation
- Creates blocking tasks for any issues found
Expected Output:
- Deployment readiness score (0-100)
- Test validation results with detailed failures
- Code quality analysis (mock vs production)
- Critical blockers that must be resolved
- Clear resolution steps for each issue
Step 10: Safe Deployment with Smart Git Push โ
Deploy your changes with confidence using deployment-aware git push:
Tool Call:
smart_git_push
Parameters:
{
"message": "Initial ADR implementation with TypeScript setup",
"branch": "main",
"checkDeploymentReadiness": true,
"enforceDeploymentReadiness": true,
"targetEnvironment": "production",
"strictDeploymentMode": true
}
What this does:
- Runs comprehensive deployment readiness checks before push
- Blocks push if any critical issues are found
- Validates test results and coverage
- Ensures ADR compliance
- Provides detailed failure reports with fixes
๐ Expected Outputs โ
After completing the workflow, you should have:
Generated Files โ
your-project/
โโโ docs/
โ โโโ adrs/
โ โโโ 0001-use-typescript-for-type-safety.md
โ โโโ 0002-express-js-for-rest-api.md
โ โโโ 0003-component-based-architecture.md
โโโ todo.md
โโโ .mcp-adr-cache/
โโโ analysis-cache.json
ADR Example (Nygard Format) โ
# 1. Use TypeScript for Type Safety
Date: 2024-01-15
## Status
Accepted
## Context
The project requires strong typing to prevent runtime errors and improve developer productivity. JavaScript's dynamic typing has led to several production bugs in the past.
## Decision
We will adopt TypeScript for all new development and gradually migrate existing JavaScript code to TypeScript.
## Consequences
### Positive
- Improved code quality and maintainability
- Better IDE support with autocomplete and refactoring
- Reduced runtime errors through compile-time checking
- Enhanced developer experience
### Negative
- Increased build complexity
- Learning curve for team members unfamiliar with TypeScript
- Additional tooling and configuration required
๐งช TDD Workflow for New ADR Implementation โ
Once you have your initial ADRs, use the enhanced TDD workflow to ensure proper implementation:
Phase 1: Generate Test Specifications from ADRs โ
Create comprehensive test specifications:
Tool: generate_adr_todo
Parameters: {
"phase": "test",
"linkAdrs": true,
"includeRules": true,
"outputPath": "todo-tests.md"
}
Benefits for new projects:
- Establishes clear testing boundaries before implementation
- Links all ADRs to create comprehensive system test coverage
- Defines success criteria for each architectural decision
- Prevents scope creep and implementation drift
Phase 2: Generate Production Implementation Tasks โ
Create implementation roadmap:
Tool: generate_adr_todo
Parameters: {
"phase": "production",
"linkAdrs": true,
"includeRules": true,
"outputPath": "todo-implementation.md"
}
Benefits for new projects:
- Clear implementation path that follows test specifications
- Architectural rule compliance built into every task
- Cross-ADR dependency validation
- Production readiness criteria for each component
Quality Assurance and Mock Detection โ
Prevent common pitfalls in new implementations:
Tool: compare_adr_progress
Parameters: {
"todoPath": "todo.md",
"adrDirectory": "docs/adrs",
"projectPath": "/path/to/project",
"deepCodeAnalysis": true,
"functionalValidation": true,
"strictMode": true
}
Common issues this prevents in new projects:
- Mock implementations being mistaken for production code
- Incomplete implementations that don't meet ADR goals
- Missing error handling and input validation
- Inadequate integration testing
- Configuration issues that prevent real deployment
Validation Patterns for New Projects โ
The validation system will check for:
Mock Implementation Patterns (to avoid):
- Console.log returns instead of real functionality
- Hardcoded values instead of configurable settings
- TODO comments in production paths
- Missing database connections or file I/O
- Stub functions without real implementation
Production-Ready Patterns (to achieve):
- Proper error handling and recovery
- Input validation and sanitization
- Real database or API integrations
- Configuration management
- Logging and monitoring setup
- Performance considerations
๐ค AI-Powered Problem Solving โ
When LLMs Get Confused โ
If you're stuck or LLMs seem confused, use the human override system:
Tool Call:
troubleshoot_guided_workflow
Parameters:
{
"taskDescription": "Create ADRs for new TypeScript project and set up development workflow",
"forceExecution": true,
"includeContext": true
}
What this does:
- Forces AI-powered planning through OpenRouter.ai
- Cuts through LLM confusion with structured execution plans
- Provides clear command schemas for LLM understanding
- Includes confidence scoring and execution notes
Systematic Troubleshooting โ
For comprehensive problem analysis:
Tool Call:
troubleshoot_guided_workflow
Parameters:
{
"operation": "full_workflow",
"failureType": "build_failure",
"description": "New project setup failing during initial ADR implementation",
"severity": "medium"
}
Smart Project Health Monitoring โ
Track your progress with intelligent scoring:
Tool Call:
smart_score
Parameters:
{
"operation": "diagnose_scores",
"includeRecommendations": true,
"focusAreas": ["todo", "architecture", "setup"]
}
๐ Troubleshooting โ
Common Issues โ
1. "No project found" Error โ
Problem: Server can't locate your project Solution:
# Verify PROJECT_PATH is set correctly
echo $PROJECT_PATH
# Or specify path explicitly in tool calls
{
"projectPath": "/absolute/path/to/your/project"
}
2. Empty Analysis Results โ
Problem: No technologies or patterns detected Solution:
# Check if your project has recognizable files
ls package.json tsconfig.json *.config.*
# Include more file patterns
{
"includePatterns": ["**/*", ".*", "Dockerfile", "*.yml"]
}
3. Permission Errors โ
Problem: Can't create ADR directory Solution:
# Create directory manually
mkdir -p docs/adrs
chmod 755 docs/adrs
4. Cache Issues โ
Problem: Outdated analysis results Solution:
# Clear cache
rm -rf .mcp-adr-cache/
# Or disable cache temporarily
export CACHE_ENABLED="false"
5. AI Planning Issues โ
Problem: Tool orchestration not working as expected Solution:
# Use human override to force planning
{
"operation": "troubleshoot_guided_workflow",
"taskDescription": "Your task description",
"forceExecution": true
}
Validation Steps โ
Verify MCP Connection:
- Check if server appears in your MCP client
- Test with a simple tool call
Check Project Analysis:
- Ensure technologies are detected correctly
- Verify file patterns include your main code
Validate ADR Generation:
- Check ADR numbering is sequential
- Verify markdown formatting is correct
๐ Next Steps โ
Enhance Your ADR Practice โ
- Content Security: Use
analyze_content_security
to check for sensitive information in your ADRs - Rule Generation: Create architectural rules with
generate_rules
based on your decisions - Research Integration: Use
generate_research_questions
to identify areas needing investigation
Advanced Workflows โ
- Repository with Existing ADRs - Learn to enhance existing ADR practices
- Blank Repository with PRD - Start fresh with requirements-driven development
Integration with Development Workflow โ
- Set up automated ADR validation in CI/CD
- Integrate with code review processes
- Create templates for common decision types
Related Documentation โ
- Main README - Complete feature overview and installation
- NPM Publishing Guide - Deploy your own MCP server
- Architecture Decisions - Example ADRs from this project
Need Help?
- Check the troubleshooting section above
- Review the main documentation
- Open an issue on GitHub