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โœ…-Absolute path to project directory
OPENROUTER_API_KEYโšก-API key for AI-powered analysis
EXECUTION_MODEโšกprompt-onlyfull or prompt-only
AI_MODELโŒanthropic/claude-3-sonnetAI model to use
ADR_DIRECTORYโŒ./adrsDirectory for ADR files
LOG_LEVELโŒINFOLogging verbosity
FIRECRAWL_API_KEYโŒ-API key for Firecrawl web scraping
FIRECRAWL_BASE_URLโŒhttp://localhost:3000Base URL for self-hosted Firecrawl
FIRECRAWL_ENABLEDโŒfalseEnable Firecrawl integration

Legend: โœ… Required โ€ข โšก Required for AI features โ€ข โŒ Optional


๐ŸŽฏ 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

OPENROUTER_API_KEY (Required for AI)โ€‹

Purpose: Enables AI-powered analysis instead of prompt-only mode

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

Without this key:

  • Tools return prompts instead of analysis results
  • No AI-powered insights or suggestions
  • Limited to basic file operations

Validation:

# Test API key (first 10 characters only for security)
echo $OPENROUTER_API_KEY | head -c 10
# Should show: sk-or-v1-x

EXECUTION_MODE (Critical for AI)โ€‹

Purpose: Controls whether tools execute AI analysis or return prompts

# โœ… AI-powered execution (recommended)
EXECUTION_MODE="full"

# โŒ Legacy prompt-only mode
EXECUTION_MODE="prompt-only"

Mode Comparison:

Modesuggest_adrs Returnsanalyze_project_ecosystem Returns
fullActual ADR suggestions with reasoningComplete technology analysis
prompt-onlyInstructions to analyze architectureInstructions to examine project

๐Ÿค– AI Configurationโ€‹

AI_MODELโ€‹

Purpose: Choose which AI model to use for analysis

# Recommended models
AI_MODEL="anthropic/claude-3-sonnet" # Best quality
AI_MODEL="anthropic/claude-3-haiku" # Fastest/cheapest
AI_MODEL="openai/gpt-4o" # Alternative quality option
AI_MODEL="openai/gpt-4o-mini" # Alternative fast option

Model Comparison:

ModelSpeedQualityCostBest For
claude-3-sonnetMediumExcellentHighComplex analysis
claude-3-haikuFastGoodLowQuick tasks
gpt-4oMediumExcellentHighAlternative to Claude
gpt-4o-miniFastGoodLowCost-effective

AI Performance Tuningโ€‹

# Response consistency (0-1, lower = more consistent)
AI_TEMPERATURE="0.1"

# Maximum response length
AI_MAX_TOKENS="4000"

# Request timeout (milliseconds)
AI_TIMEOUT="60000"

# Enable response caching
AI_CACHE_ENABLED="true"
AI_CACHE_TTL="3600" # 1 hour

๐Ÿ“ 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"

Firecrawl Configurationโ€‹

# Enable Firecrawl integration for web search
FIRECRAWL_ENABLED="true"

# Firecrawl API key (get from https://firecrawl.dev)
FIRECRAWL_API_KEY="fc-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Self-hosted Firecrawl base URL (if not using API key)
FIRECRAWL_BASE_URL="http://localhost:3000"

Firecrawl Configuration Options:

  • FIRECRAWL_ENABLED: Set to true to enable Firecrawl integration
  • FIRECRAWL_API_KEY: API key for Firecrawl service (optional, enables cloud service)
  • FIRECRAWL_BASE_URL: Base URL for self-hosted Firecrawl (default: http://localhost:3000)

Usage Modes:

  1. Cloud Service: Set FIRECRAWL_API_KEY to use Firecrawl cloud service
  2. Self-Hosted: Set FIRECRAWL_BASE_URL to point to your self-hosted instance
  3. Disabled: Leave FIRECRAWL_ENABLED unset or set to false (default)

๐ŸŒ Environment-Specific Configurationsโ€‹

Development Environmentโ€‹

# .env.development
PROJECT_PATH="/Users/developer/current-project"
OPENROUTER_API_KEY="your-dev-key"
EXECUTION_MODE="full"
AI_MODEL="anthropic/claude-3-haiku" # Faster for dev
LOG_LEVEL="DEBUG"
AI_CACHE_ENABLED="true"
TIMING_ENABLED="true"
FIRECRAWL_ENABLED="true"
FIRECRAWL_API_KEY="your-firecrawl-key"

Production Environmentโ€‹

# .env.production
PROJECT_PATH="/app/project"
OPENROUTER_API_KEY="your-prod-key"
EXECUTION_MODE="full"
AI_MODEL="anthropic/claude-3-sonnet" # Best quality
LOG_LEVEL="ERROR"
AI_CACHE_ENABLED="true"
AI_CACHE_TTL="86400" # 24 hours
FIRECRAWL_ENABLED="true"
FIRECRAWL_BASE_URL="http://firecrawl:3000" # Self-hosted

CI/CD Environmentโ€‹

# .env.ci
PROJECT_PATH="${GITHUB_WORKSPACE}"
OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" # From secrets
EXECUTION_MODE="full"
AI_MODEL="anthropic/claude-3-haiku" # Fast for CI
LOG_LEVEL="INFO"
AI_CACHE_ENABLED="false" # Fresh analysis each time
FIRECRAWL_ENABLED="false" # Disable for CI performance

๐Ÿ“ฑ MCP Client Configurationโ€‹

Claude Desktopโ€‹

{
"mcpServers": {
"adr-analysis": {
"command": "mcp-adr-analysis-server",
"env": {
"PROJECT_PATH": "/absolute/path/to/project",
"OPENROUTER_API_KEY": "your_key_here",
"EXECUTION_MODE": "full",
"AI_MODEL": "anthropic/claude-3-sonnet",
"ADR_DIRECTORY": "./adrs",
"LOG_LEVEL": "ERROR",
"FIRECRAWL_ENABLED": "true",
"FIRECRAWL_API_KEY": "your_firecrawl_key"
}
}
}
}

Cline (VS Code)โ€‹

{
"mcpServers": {
"mcp-adr-analysis-server": {
"command": "npx",
"args": ["mcp-adr-analysis-server"],
"env": {
"PROJECT_PATH": "${workspaceFolder}",
"OPENROUTER_API_KEY": "your_key_here",
"EXECUTION_MODE": "full",
"ADR_DIRECTORY": "./adrs",
"LOG_LEVEL": "ERROR"
}
}
}
}

Cursorโ€‹

{
"mcpServers": {
"adr-analysis": {
"command": "npx",
"args": ["mcp-adr-analysis-server"],
"env": {
"PROJECT_PATH": ".",
"OPENROUTER_API_KEY": "your_key_here",
"EXECUTION_MODE": "full",
"ADR_DIRECTORY": "./adrs",
"LOG_LEVEL": "ERROR"
}
}
}
}

๐Ÿ”ง 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"Relative or invalid PROJECT_PATHUse absolute path
"Tools return prompts"Missing EXECUTION_MODE=fullSet execution mode
"AI execution not available"Missing OPENROUTER_API_KEYAdd API key
"Permission denied"Wrong directory permissionsCheck file permissions
"Module not found"Server not installed properlyReinstall server

Diagnostic Toolโ€‹

{
"tool": "check_ai_execution_status",
"parameters": {}
}

Expected Response:

{
"aiExecutionAvailable": true,
"executionMode": "full",
"apiKeyConfigured": true,
"model": "anthropic/claude-3-sonnet",
"projectPath": "/absolute/path/to/project",
"adrDirectory": "./adrs"
}

๐Ÿš€ Optimization Tipsโ€‹

For Large Projectsโ€‹

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

# Use faster model for initial analysis
AI_MODEL="anthropic/claude-3-haiku"

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

For Team Environmentsโ€‹

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

# Consistent model across team
AI_MODEL="anthropic/claude-3-sonnet"

# 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