๐ Tutorial 1: Your First MCP ADR Analysis
Learning Goal: By the end of this tutorial, you'll understand MCP basics and have created your first architectural decision record.
Prerequisites:
- Node.js โฅ20.0.0 installed
- Basic understanding of software architecture
- Text editor or IDE
Time Required: 30 minutes
๐ What You'll Learnโ
- MCP Fundamentals - What is Model Context Protocol and how it works
- Server Setup - Installing and configuring the MCP ADR Analysis Server
- First Analysis - Running your first project analysis
- Creating ADRs - Generating your first architectural decision record
- Next Steps - Where to go from here
๐ง Step 1: Understanding MCPโ
Model Context Protocol (MCP) connects AI assistants to external tools and data sources. Think of it as a bridge that lets your AI assistant:
- Access Files - Read and write files in your project
- Run Analysis - Execute specialized analysis tools
- Generate Content - Create documents, code, and recommendations
- Maintain Context - Remember information across conversations
How MCP ADR Analysis Server Fits Inโ
The MCP ADR Analysis Server specializes in:
- Project Analysis - Understanding your codebase and architecture
- Decision Discovery - Finding architectural decisions that need documentation
- ADR Generation - Creating professional architectural decision records
- Progress Tracking - Monitoring implementation of architectural decisions
๐ Step 2: Installation and Setupโ
Install the Serverโ
# Global installation (recommended for learning)
npm install -g mcp-adr-analysis-server
# Verify installation
mcp-adr-analysis-server --version
You should see output like: MCP ADR Analysis Server v2.1.0
Configure Your MCP Clientโ
Add this configuration to your MCP client (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": "./adrs",
"LOG_LEVEL": "ERROR"
}
}
}
}
Important Configuration Notes:
- Replace
/path/to/your/projectwith your actual project path - Get your OpenRouter API key from https://openrouter.ai/keys
EXECUTION_MODE: "full"enables AI-powered analysis (use"prompt-only"for basic mode)AI_MODELspecifies which AI model to use (optional, defaults to claude-3-sonnet)LOG_LEVEL: "ERROR"reduces console output (use "INFO" or "DEBUG" for more details)
Test the Connectionโ
In your MCP client, try this simple command:
analyze_project_ecosystem
If you see detailed analysis output, you're ready to proceed! ๐
Initialize the Memory Systemโ
Important: To enable the intelligent memory features (pattern recognition, relationship inference, etc.), you need to load your ADRs into the memory system first:
{
"tool": "memory_loading",
"parameters": {
"action": "load_adrs",
"forceReload": true
}
}
This command will:
- Discover all ADRs in your configured directory
- Transform them into memory entities
- Build relationship graphs between decisions
- Enable intelligent pattern recognition
- Populate the
.mcp-adr-memorydirectory
After running this, your memory system will be actively learning from your architectural decisions and providing intelligent insights!
Note: The server works in two modes:
EXECUTION_MODE: "full"- AI-powered analysis with intelligent insights (requires OpenRouter API key)EXECUTION_MODE: "prompt-only"- Basic analysis with structured prompts for manual AI use
For the full learning experience, we recommend using "full" mode with an OpenRouter API key.
๐ Step 3: Your First Project Analysisโ
Let's analyze a project to understand what the server can do. The MCP ADR Analysis Server uses research-driven architecture to query your live environment instead of relying on static analysis alone.
What is Research-Driven Analysis?โ
Research-driven analysis works by:
-
Cascading through multiple sources in order of reliability:
- Your project files and code
- Existing knowledge graph of ADRs and decisions
- Live environment resources (Docker, Kubernetes, OpenShift, Ansible)
- Web search (fallback for external context)
-
Confidence scoring (0-1 scale) determines result reliability
-
Live environment detection automatically discovers available tools
-
Red Hat ecosystem support for OpenShift (
oc), Podman, and Ansible
Why Research-Driven? This approach helps LLMs with less domain knowledge by providing real-time context from your actual infrastructure instead of guessing or hallucinating.
First: Load ADRs into Memory (If You Have Any)โ
If your project already has ADRs in the ./adrs directory (or your configured ADR directory), load them into the memory system first:
{
"tool": "memory_loading",
"parameters": {
"action": "load_adrs",
"forceReload": true
}
}
This populates the .mcp-adr-memory directory and enables intelligent pattern recognition.
Create a Sample Projectโ
If you don't have a project ready, create a simple one:
mkdir my-learning-project
cd my-learning-project
# Create a simple Node.js project
npm init -y
# Add some basic files
echo "const express = require('express');" > server.js
echo "# My Learning Project" > README.md
mkdir src docs
Run Comprehensive Analysisโ
In your MCP client, run:
{
"tool": "analyze_project_ecosystem",
"parameters": {
"projectPath": ".",
"enhancedMode": true,
"recursiveDepth": "comprehensive"
}
}
Understanding the Resultsโ
The analysis will show you:
- ๐๏ธ Technology Stack - Languages, frameworks, and tools detected
- ๐ Project Structure - Directory organization and patterns
- ๐ Architecture Patterns - Design patterns and architectural styles found
- โ ๏ธ Identified Issues - Potential problems or improvements
- ๐ก Recommendations - Suggested next steps and improvements
Exercise: Look through the analysis results and identify:
- What programming language(s) were detected?
- What project structure pattern was identified?
- What recommendations were made?
Research-Driven Analysis in Actionโ
Now let's explore the perform_research tool, which uses the research-orchestrator to answer questions about your project:
{
"tool": "perform_research",
"parameters": {
"question": "What deployment infrastructure is currently available in this project?",
"projectPath": ".",
"adrDirectory": "./adrs"
}
}
What You'll See:
## Research Results
**Confidence**: 85.0% โ
### Answer
The project has Docker and Kubernetes available. Found docker-compose.yml
configuration for local development and Kubernetes manifests in k8s/ directory.
### Sources Consulted
โ Project Files: Analyzed 45 files
โ Knowledge Graph: Found 2 related ADRs
โ Environment: Detected docker, kubectl
โ Web Search: Not needed (confidence above threshold)
### Key Findings
- Docker: Container orchestration available
- Kubernetes: kubectl configured and accessible
- Infrastructure decisions documented in ADR-003
Understanding Confidence Scores:
- โฅ70%: High confidence, results are reliable
- 60-69%: Medium confidence, consider web search fallback
- <60%: Low confidence, automatic web search triggered
Exercise: Try asking research questions about:
- "What database technology is used in this project?"
- "Are there any container orchestration tools configured?"
- "What testing frameworks are available?"
๐ Step 4: Creating Your First ADRโ
Now let's create an architectural decision record based on your project analysis.
Discover What Decisions Need Documentationโ
{
"tool": "suggest_adrs",
"parameters": {
"projectPath": ".",
"analysisScope": "all",
"maxSuggestions": 3
}
}
This will suggest 3 architectural decisions that should be documented.
Generate Your First ADRโ
Pick one of the suggested decisions and create an ADR:
{
"tool": "generate_adr_from_decision",
"parameters": {
"decisionData": {
"title": "Web Framework Selection",
"context": "Need to choose a web framework for the HTTP API",
"decision": "Express.js",
"rationale": "Widely adopted, excellent ecosystem, team familiarity",
"consequences": [
"Fast development",
"Large community support",
"Potential performance limitations for high-scale scenarios"
]
},
"adrDirectory": "./adrs"
}
}
Review Your ADRโ
Check the ././adrs/ directory. You should see a new file like 001-web-framework-selection.md.
Exercise: Open the ADR file and review:
- Is the structure clear and professional?
- Does the rationale make sense for your project?
- Are the consequences realistic?
Load Your New ADR into Memoryโ
Now that you've created an ADR, load it into the memory system to enable intelligent insights:
{
"tool": "memory_loading",
"parameters": {
"action": "load_adrs",
"forceReload": true
}
}
This will process your new ADR and start building the knowledge graph that powers the intelligent features.
Validate ADR Against Realityโ
Use the new research-driven ADR validation to check if your documented decision matches actual implementation:
{
"tool": "validate_adr",
"parameters": {
"adrPath": "././adrs/001-web-framework-selection.md",
"projectPath": ".",
"includeEnvironmentCheck": true,
"confidenceThreshold": 0.6
}
}
What This Does:
- Reads your ADR to understand the documented decision
- Researches live environment to check actual implementation
- Compares documentation vs reality with confidence scoring
- Reports gaps or drift between decision and implementation
Example Result:
## ADR Validation: Web Framework Selection
**Research Confidence**: 78.0% โ
### Implementation Status: โ MATCHES
- Express.js detected in package.json (v4.18.2)
- Express routes found in src/routes/
- Middleware patterns consistent with documented decision
### Environment Check: โ PASSED
- Node.js v20.0.0 (meets requirements)
- npm packages installed correctly
- No conflicting frameworks detected
### Validation Result: ADR accurately reflects current implementation
Exercise: Validate all your ADRs at once:
{
"tool": "validate_all_adrs",
"parameters": {
"projectPath": ".",
"adrDirectory": "./adrs",
"includeEnvironmentCheck": true,
"minConfidence": 0.6
}
}
๐ Step 5: Track Implementation Progressโ
ADRs aren't just documentation - they're implementation roadmaps.
Generate TODO Itemsโ
{
"tool": "generate_adr_todo",
"parameters": {
"adrDirectory": "./adrs",
"todoFormat": "both",
"includePriorities": true
}
}
This creates a TODO.md file with actionable tasks based on your ADR.
Check Progressโ
As you implement the decisions, track progress:
{
"tool": "compare_adr_progress",
"parameters": {
"todoPath": "TODO.md",
"adrDirectory": "./adrs"
}
}
๐ฏ Step 6: Understanding What You've Accomplishedโ
Congratulations! You've just:
โ
Set up MCP - Connected an AI assistant to powerful analysis tools
โ
Analyzed Architecture - Used AI to understand your project structure
โ
Created Professional ADRs - Generated industry-standard architectural documentation
โ
Established Process - Set up a system for tracking architectural decisions
Key Concepts You've Learnedโ
- MCP Protocol - How AI assistants connect to external tools
- Project Analysis - Automated discovery of architectural patterns
- ADR Generation - Creating structured architectural decision records
- Implementation Tracking - Monitoring progress on architectural decisions
๐ Next Stepsโ
Now that you understand the basics, you can:
Immediate Next Stepsโ
- Tutorial 2: Working with Existing Projects - Learn to analyze codebases with existing architecture
- Tutorial 3: Advanced Analysis Techniques - Explore security scanning, deployment readiness, and more
Explore Specific Use Casesโ
- How-To: Handle Security Concerns - Scan for sensitive content and credentials
- How-To: Prepare for Deployment - Validate your project is ready for production
Deep Dive into Featuresโ
- API Reference - Complete documentation of all 37 available tools
- Architecture Concepts - Understand the deeper architectural principles
๐ Need Help?โ
Common Issuesโ
"Tool not found" error
- Verify MCP server installation:
mcp-adr-analysis-server --version - Check MCP client configuration
- Ensure environment variables are set correctly
"Permission denied" errors
- Check file permissions in your project directory
- Ensure
ADR_DIRECTORYexists or can be created
Analysis seems incomplete
- Try
enhancedMode: truefor more comprehensive analysis - Increase
recursiveDepthto "comprehensive" - Check that
PROJECT_PATHpoints to your project root
Get Supportโ
- Troubleshooting Guide - Solutions to common problems
- GitHub Issues - Report bugs or request features
- Main Documentation - Complete project overview
API Key Issuesโ
"AI execution not enabled" errors
- Check that
OPENROUTER_API_KEYis set in your MCP configuration - Verify your API key is valid at https://openrouter.ai/keys
- Ensure
EXECUTION_MODEis set to"full"
"Permission denied" or rate limit errors
- Check your OpenRouter account has sufficient credits
- Try a different AI model (e.g., "openai/gpt-4o-mini" for lower cost)
- Reduce analysis scope with
enhancedMode: false
๐ก Bonus: Track Your Learning with @.mcp-server-context.mdโ
Your Project's Living Memoryโ
As you've been working through this tutorial, the MCP server has been quietly building a memory of your progress in a special file called .mcp-server-context.md. This auto-generated file is like your project's brain - it remembers everything!
What's Inside?โ
The context file tracks:
- โ Tools you've used and how often
- โ Patterns discovered in your project
- โ Active intents and what you're working on
- โ Architecture scores and improvements
- โ Recommendations for next steps
- โ Memory entities and relationships
Try It Now!โ
In your AI assistant, use the @ symbol to reference the file:
@.mcp-server-context.md What have I learned in this tutorial?
Show me the patterns discovered and my current project score.
Your AI assistant will respond with:
- Summary of what tools you used
- Patterns detected in your project
- Your current architecture score
- Recommended next actions
Real-World Examplesโ
Checking Progress:
@.mcp-server-context.md How has my architecture score improved?
Understanding Discoveries:
@.mcp-server-context.md What architectural patterns did you find?
Planning Next Steps:
@.mcp-server-context.md What should I focus on next?
Why This Mattersโ
- Continuity - Resume work seamlessly by seeing what you were doing
- Learning - Track your progress and see patterns emerge
- Guidance - Get AI-powered recommendations based on your project
- Team Sharing - Share context with team members (they can
@it too!)
Learn Moreโ
Want to master the context file? Check out:
- Server Context File Guide - Complete documentation
- Tutorial 2 - See it in action with existing projects
Ready for Tutorial 2? โ Working with Existing Projects
This tutorial is part of the MCP ADR Analysis Server learning path. Each tutorial builds on the previous one while being useful on its own.