Skip to main content

๐Ÿ”ง Environment Configuration Reference

Complete guide to configuring the MCP ADR Analysis Server environment variables and settings.


๐Ÿ“‹ Quick Referenceโ€‹

VariableRequiredDefaultDescription
PROJECT_PATHโŒ.Path to project directory (defaults to current directory)
EXECUTION_MODEโŒce-mcpce-mcp (default), full (legacy, needs API key), or prompt-only
ADR_DIRECTORYโŒdocs/adrsDirectory for ADR files relative to project path
LOG_LEVELโŒINFOLogging verbosity
OPENROUTER_API_KEYโŒ-OpenRouter API key (only needed for legacy full execution mode)
ADR_AGGREGATOR_API_KEYโŒ-API key for ADR Aggregator platform

Legend: โŒ Optional โ€” CE-MCP mode (the default) requires no API key. Your host LLM executes analysis via orchestration directives.


๐ŸŽฏ Essential Configurationโ€‹

PROJECT_PATH (Required)โ€‹

Purpose: Tells the server which project to analyze

# โœ… Correct - absolute path
PROJECT_PATH="/Users/username/my-project"

# โŒ Wrong - relative path
PROJECT_PATH="."
PROJECT_PATH="../my-project"

Common Issues:

  • Relative paths cause file access errors
  • Non-existent paths cause startup failures
  • Paths with spaces need proper escaping

Validation:

# Test your path
ls -la "$PROJECT_PATH"
# Should show your project files

EXECUTION_MODEโ€‹

Purpose: Controls how tools return results

# โœ… CE-MCP mode (default, recommended โ€” no API key needed)
EXECUTION_MODE="ce-mcp"

# Legacy: server-side AI execution (requires OPENROUTER_API_KEY)
EXECUTION_MODE="full"

# Legacy: returns prompts you can paste into any AI chat
EXECUTION_MODE="prompt-only"

Mode Comparison:

ModeReturnsRequires API Key?
ce-mcpOrchestration directives for your host LLMNo
fullServer-side AI analysis resultsYes
prompt-onlyPrompts you can paste into any AI chatNo

CE-MCP mode is recommended for all users. Your host LLM (Claude, GPT, etc.) executes the analysis using orchestration directives returned by the tools โ€” zero additional API cost and better results because the LLM already has your conversation context.

OPENROUTER_API_KEY (Legacy โ€” Full Mode Only)โ€‹

Purpose: Only needed if you set EXECUTION_MODE=full for server-side AI execution

# Get your key from: https://openrouter.ai/keys
OPENROUTER_API_KEY="sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Not needed in CE-MCP mode (the default). In CE-MCP mode, your host LLM provides all AI capabilities.


๐Ÿค– AI Configuration (Legacy Full Mode Only)โ€‹

Note: The settings below only apply when EXECUTION_MODE=full. In CE-MCP mode (default), your host LLM handles all AI execution and these settings are ignored.

AI_MODELโ€‹

Purpose: Choose which AI model to use for server-side analysis (full mode only)

AI_MODEL="anthropic/claude-3-sonnet" # Default
AI_MODEL="anthropic/claude-3-haiku" # Faster/cheaper
AI_MODEL="openai/gpt-4o" # Alternative

๐Ÿ“ Project Configurationโ€‹

ADR_DIRECTORYโ€‹

Purpose: Where to store Architectural Decision Records

# Default location
ADR_DIRECTORY="./adrs"

# Custom locations
ADR_DIRECTORY="architecture/decisions"
ADR_DIRECTORY="./architecture/adrs"

Directory Structure Created:

./adrs/
โ”œโ”€โ”€ README.md # ADR index
โ”œโ”€โ”€ 001-first-decision.md
โ”œโ”€โ”€ 002-second-decision.md
โ””โ”€โ”€ template.md # ADR template

File Patternsโ€‹

# Include/exclude patterns for analysis
INCLUDE_PATTERNS="*.ts,*.js,*.py,*.md"
EXCLUDE_PATTERNS="node_modules,dist,coverage"

# Maximum file size to analyze (bytes)
MAX_FILE_SIZE="1048576" # 1MB

๐Ÿ” Logging and Debuggingโ€‹

LOG_LEVELโ€‹

Purpose: Control logging verbosity

LOG_LEVEL="ERROR" # Only errors
LOG_LEVEL="WARN" # Warnings and errors
LOG_LEVEL="INFO" # General information (default)
LOG_LEVEL="DEBUG" # Detailed debugging info

When to Use Each Level:

  • ERROR: Production deployments
  • WARN: Normal usage
  • INFO: Development and troubleshooting
  • DEBUG: Investigating issues

Advanced Debuggingโ€‹

# Enable verbose output
VERBOSE="true"

# Enable performance timing
TIMING_ENABLED="true"

# Enable memory usage tracking
MEMORY_TRACKING="true"

๐Ÿ”’ Security Configurationโ€‹

Content Maskingโ€‹

# Enable automatic content masking
ENABLE_CONTENT_MASKING="true"

# Masking sensitivity level
MASKING_LEVEL="strict" # Most secure
MASKING_LEVEL="moderate" # Balanced (default)
MASKING_LEVEL="lenient" # Minimal masking

Custom Security Patternsโ€‹

# Additional patterns to detect as sensitive
CUSTOM_SECRET_PATTERNS="company-api-key-.*,internal-token-.*"

# Whitelist patterns (never mask these)
WHITELIST_PATTERNS="example-.*,demo-.*,test-.*"

โšก Performance Configurationโ€‹

Cachingโ€‹

# Cache directory location
CACHE_DIRECTORY=".mcp-adr-cache"

# Cache size limits
MAX_CACHE_SIZE="100MB"
MAX_CACHE_AGE="7d" # 7 days

# Cache cleanup frequency
CACHE_CLEANUP_INTERVAL="24h"

Analysis Limitsโ€‹

# Maximum recursion depth for project analysis
MAX_RECURSION_DEPTH="10"

# Maximum files to analyze in one operation
MAX_FILES_PER_ANALYSIS="1000"

# Timeout for individual file analysis (ms)
FILE_ANALYSIS_TIMEOUT="30000"

ADR Aggregator Configuration (Optional)โ€‹

# Enable ADR Aggregator integration for cross-team visibility
# Get your API key at https://adraggregator.com
ADR_AGGREGATOR_API_KEY="agg_your_key_here"

ADR Aggregator Configuration Options:

Available Tiers:

TierFeatures
FreeSync ADRs, get context, staleness reports, templates
Pro++ Mermaid diagrams, compliance validation
Team+ Cross-repository knowledge graph

๐ŸŒ Environment-Specific Configurationsโ€‹

Development Environmentโ€‹

# .env.development โ€” CE-MCP mode (default), no API key needed
PROJECT_PATH="/Users/developer/current-project"
LOG_LEVEL="DEBUG"

Production Environmentโ€‹

# .env.production
PROJECT_PATH="/app/project"
LOG_LEVEL="ERROR"

CI/CD Environmentโ€‹

# .env.ci
PROJECT_PATH="${GITHUB_WORKSPACE}"
LOG_LEVEL="INFO"

Legacy Full Mode (server-side AI)โ€‹

# Only needed if you explicitly want server-side AI execution
PROJECT_PATH="/Users/developer/current-project"
OPENROUTER_API_KEY="your-key"
EXECUTION_MODE="full"

๐Ÿ“ฑ MCP Client Configurationโ€‹

Claude Desktopโ€‹

{
"mcpServers": {
"adr-analysis": {
"command": "npx",
"args": ["-y", "mcp-adr-analysis-server"],
"env": {
"PROJECT_PATH": "/absolute/path/to/project"
}
}
}
}

That's it โ€” CE-MCP mode is the default, so no API key or EXECUTION_MODE is needed.

Cline (VS Code)โ€‹

{
"mcpServers": {
"mcp-adr-analysis-server": {
"command": "npx",
"args": ["-y", "mcp-adr-analysis-server"],
"env": {
"PROJECT_PATH": "${workspaceFolder}"
}
}
}
}

Cursorโ€‹

{
"mcpServers": {
"adr-analysis": {
"command": "npx",
"args": ["-y", "mcp-adr-analysis-server"],
"env": {
"PROJECT_PATH": "."
}
}
}
}

๐Ÿ”ง Configuration Validationโ€‹

Test Your Configurationโ€‹

# 1. Test server startup
mcp-adr-analysis-server --test

# 2. Validate environment
echo "Project: $PROJECT_PATH"
echo "ADR Dir: $ADR_DIRECTORY"
echo "Mode: $EXECUTION_MODE"

# 3. Test API key (safely)
echo $OPENROUTER_API_KEY | head -c 10

Common Configuration Errorsโ€‹

ErrorCauseSolution
"Project path not found"Invalid PROJECT_PATHUse a valid absolute or relative path
"Permission denied"Wrong directory permissionsCheck file permissions
"Module not found"Server not installed properlyReinstall with npm install -g mcp-adr-analysis-server

Diagnostic Toolโ€‹

{
"tool": "analyze_project_ecosystem",
"parameters": {}
}

๐Ÿš€ Optimization Tipsโ€‹

For Large Projectsโ€‹

# Reduce analysis scope
MAX_FILES_PER_ANALYSIS="500"
MAX_RECURSION_DEPTH="5"

# Enable aggressive caching
AI_CACHE_ENABLED="true"
AI_CACHE_TTL="86400"

For Team Environmentsโ€‹

# Shared cache location
CACHE_DIRECTORY="/shared/mcp-cache"

# Standardized ADR location
ADR_DIRECTORY="./architecture/decisions"

For Security-Sensitive Projectsโ€‹

# Strict content masking
ENABLE_CONTENT_MASKING="true"
MASKING_LEVEL="strict"

# Custom security patterns
CUSTOM_SECRET_PATTERNS="company-.*,internal-.*,private-.*"

# Disable caching of sensitive content
AI_CACHE_ENABLED="false"


Need help with configuration? โ†’ Troubleshooting Guide or File an Issue