mcp-adr-analysis-server 1.1.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +367 -150
- package/dist/src/config/ai-config.d.ts +81 -0
- package/dist/src/config/ai-config.d.ts.map +1 -0
- package/dist/src/config/ai-config.js +134 -0
- package/dist/src/config/ai-config.js.map +1 -0
- package/dist/src/index.d.ts +97 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2430 -186
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.d.ts +2 -2
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.js +25 -17
- package/dist/src/prompts/adr-suggestion-prompts.js.map +1 -1
- package/dist/src/prompts/analysis-prompts.js +1 -1
- package/dist/src/prompts/analysis-prompts.js.map +1 -1
- package/dist/src/resources/index.d.ts +1 -1
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +52 -44
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/templates/domain-knowledge-templates.d.ts +36 -0
- package/dist/src/templates/domain-knowledge-templates.d.ts.map +1 -0
- package/dist/src/templates/domain-knowledge-templates.js +376 -0
- package/dist/src/templates/domain-knowledge-templates.js.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts +8 -3
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +561 -172
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
- package/dist/src/tools/content-masking-tool.js +168 -22
- package/dist/src/tools/content-masking-tool.js.map +1 -1
- package/dist/src/tools/deployment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-analysis-tool.js +64 -27
- package/dist/src/tools/deployment-analysis-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +65 -29
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/research-question-tool.d.ts.map +1 -1
- package/dist/src/tools/research-question-tool.js +150 -49
- package/dist/src/tools/research-question-tool.js.map +1 -1
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
- package/dist/src/tools/rule-generation-tool.js +328 -143
- package/dist/src/tools/rule-generation-tool.js.map +1 -1
- package/dist/src/types/ape-framework.d.ts +566 -0
- package/dist/src/types/ape-framework.d.ts.map +1 -0
- package/dist/src/types/ape-framework.js +98 -0
- package/dist/src/types/ape-framework.js.map +1 -0
- package/dist/src/types/index.d.ts +96 -93
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/knowledge-generation.d.ts +671 -0
- package/dist/src/types/knowledge-generation.d.ts.map +1 -0
- package/dist/src/types/knowledge-generation.js +107 -0
- package/dist/src/types/knowledge-generation.js.map +1 -0
- package/dist/src/types/reflexion-framework.d.ts +652 -0
- package/dist/src/types/reflexion-framework.d.ts.map +1 -0
- package/dist/src/types/reflexion-framework.js +85 -0
- package/dist/src/types/reflexion-framework.js.map +1 -0
- package/dist/src/utils/adr-suggestions.d.ts +1 -1
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
- package/dist/src/utils/adr-suggestions.js +8 -50
- package/dist/src/utils/adr-suggestions.js.map +1 -1
- package/dist/src/utils/ai-executor.d.ts +125 -0
- package/dist/src/utils/ai-executor.d.ts.map +1 -0
- package/dist/src/utils/ai-executor.js +292 -0
- package/dist/src/utils/ai-executor.js.map +1 -0
- package/dist/src/utils/automatic-prompt-engineering.d.ts +72 -0
- package/dist/src/utils/automatic-prompt-engineering.d.ts.map +1 -0
- package/dist/src/utils/automatic-prompt-engineering.js +820 -0
- package/dist/src/utils/automatic-prompt-engineering.js.map +1 -0
- package/dist/src/utils/cache.d.ts +54 -22
- package/dist/src/utils/cache.d.ts.map +1 -1
- package/dist/src/utils/cache.js +1234 -143
- package/dist/src/utils/cache.js.map +1 -1
- package/dist/src/utils/config.d.ts +2 -2
- package/dist/src/utils/config.js +3 -3
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/deployment-analysis.d.ts.map +1 -1
- package/dist/src/utils/deployment-analysis.js +57 -38
- package/dist/src/utils/deployment-analysis.js.map +1 -1
- package/dist/src/utils/environment-analysis.d.ts.map +1 -1
- package/dist/src/utils/environment-analysis.js +113 -100
- package/dist/src/utils/environment-analysis.js.map +1 -1
- package/dist/src/utils/file-system.d.ts +42 -13
- package/dist/src/utils/file-system.d.ts.map +1 -1
- package/dist/src/utils/file-system.js +795 -89
- package/dist/src/utils/file-system.js.map +1 -1
- package/dist/src/utils/index.d.ts +9 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +13 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/knowledge-generation.d.ts +79 -0
- package/dist/src/utils/knowledge-generation.d.ts.map +1 -0
- package/dist/src/utils/knowledge-generation.js +646 -0
- package/dist/src/utils/knowledge-generation.js.map +1 -0
- package/dist/src/utils/output-masking.d.ts.map +1 -1
- package/dist/src/utils/output-masking.js +2 -1
- package/dist/src/utils/output-masking.js.map +1 -1
- package/dist/src/utils/prompt-composition.d.ts +234 -0
- package/dist/src/utils/prompt-composition.d.ts.map +1 -0
- package/dist/src/utils/prompt-composition.js +379 -0
- package/dist/src/utils/prompt-composition.js.map +1 -0
- package/dist/src/utils/prompt-execution.d.ts +88 -0
- package/dist/src/utils/prompt-execution.d.ts.map +1 -0
- package/dist/src/utils/prompt-execution.js +227 -0
- package/dist/src/utils/prompt-execution.js.map +1 -0
- package/dist/src/utils/reflexion.d.ts +92 -0
- package/dist/src/utils/reflexion.d.ts.map +1 -0
- package/dist/src/utils/reflexion.js +1100 -0
- package/dist/src/utils/reflexion.js.map +1 -0
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +156 -100
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +85 -24
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +92 -108
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -6,84 +6,27 @@
|
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### 📋 **ADR Management & Generation**
|
|
31
|
-
- **ADR Generation from PRD**: Convert Product Requirements Documents to structured ADRs
|
|
32
|
-
- **Intelligent ADR Suggestions**: Auto-suggest ADRs from implicit code decisions
|
|
33
|
-
- **ADR Lifecycle Management**: Complete ADR creation, analysis, and maintenance workflows
|
|
34
|
-
- **Template Support**: Multiple ADR formats (Nygard, MADR, custom templates)
|
|
35
|
-
|
|
36
|
-
### 🔍 **Research & Documentation Intelligence**
|
|
37
|
-
- **Research Integration**: Monitor and incorporate research findings into architectural decisions
|
|
38
|
-
- **Context-Aware Research Questions**: Generate targeted research questions based on project context
|
|
39
|
-
- **Documentation Analysis**: Extract insights from existing documentation and codebases
|
|
40
|
-
- **Knowledge Synthesis**: Combine multiple information sources for comprehensive analysis
|
|
41
|
-
|
|
42
|
-
### 🛡️ **Enterprise Security & Compliance**
|
|
43
|
-
- **Content Masking**: Automatic detection and masking of sensitive information
|
|
44
|
-
- **Secret Prevention**: Proactive guidance to prevent secret exposure
|
|
45
|
-
- **Security Hardening**: Built-in security best practices and validation
|
|
46
|
-
- **Compliance Tracking**: Ensure architectural decisions meet enterprise standards
|
|
47
|
-
|
|
48
|
-
### 📊 **Development Workflow Automation**
|
|
49
|
-
- **Todo Management**: Generate actionable task lists from ADRs and project analysis
|
|
50
|
-
- **Deployment Tracking**: Monitor deployment progress and completion verification
|
|
51
|
-
- **Environment Analysis**: Analyze and optimize deployment environments
|
|
52
|
-
- **Rule Generation & Validation**: Extract and validate architectural rules from decisions
|
|
53
|
-
|
|
54
|
-
## 🛠️ Available MCP Tools
|
|
55
|
-
|
|
56
|
-
### Core Analysis Tools
|
|
57
|
-
- **`analyze_project_ecosystem`** - Comprehensive technology and pattern detection
|
|
58
|
-
- **`get_architectural_context`** - Generate intelligent architectural insights
|
|
59
|
-
- **`generate_adrs_from_prd`** - Convert requirements to structured ADRs
|
|
60
|
-
- **`generate_adr_todo`** - Create actionable task lists from ADRs
|
|
61
|
-
|
|
62
|
-
### Advanced Intelligence Tools
|
|
63
|
-
- **`suggest_adrs`** - Auto-suggest ADRs from implicit decisions
|
|
64
|
-
- **`generate_adr_from_decision`** - Create ADRs from specific decisions
|
|
65
|
-
- **`discover_existing_adrs`** - Intelligent ADR discovery and analysis
|
|
66
|
-
- **`incorporate_research`** - Integrate research findings into decisions
|
|
67
|
-
- **`generate_research_questions`** - Create context-aware research questions
|
|
68
|
-
|
|
69
|
-
### Security & Compliance Tools
|
|
70
|
-
- **`analyze_sensitive_content`** - Detect sensitive information patterns
|
|
71
|
-
- **`mask_content`** - Intelligent content masking and protection
|
|
72
|
-
- **`configure_masking`** - Customize security and masking settings
|
|
73
|
-
- **`validate_content_security`** - Comprehensive security validation
|
|
74
|
-
- **`apply_security_guidance`** - Proactive security recommendations
|
|
75
|
-
|
|
76
|
-
### Workflow & Management Tools
|
|
77
|
-
- **`generate_rules`** - Extract architectural rules from ADRs
|
|
78
|
-
- **`validate_rules`** - Validate code against architectural rules
|
|
79
|
-
- **`create_rule_set`** - Create comprehensive rule management systems
|
|
80
|
-
- **`analyze_environment`** - Environment analysis and optimization
|
|
81
|
-
- **`analyze_deployment_progress`** - Deployment tracking and verification
|
|
82
|
-
|
|
83
|
-
### Utility & Integration Tools
|
|
84
|
-
- **`clear_cache`** - Cache management and optimization
|
|
85
|
-
- **`create_research_template`** - Generate research documentation templates
|
|
86
|
-
- **`request_action_confirmation`** - Interactive user confirmation workflows
|
|
9
|
+
**AI-powered architectural analysis for intelligent development workflows.** This Model Context Protocol (MCP) server provides immediate, actionable architectural insights instead of prompts. Get real ADR suggestions, technology analysis, and security recommendations through OpenRouter.ai integration.
|
|
10
|
+
|
|
11
|
+
**Key Differentiator**: Returns actual analysis results, not prompts to submit elsewhere.
|
|
12
|
+
|
|
13
|
+
**Author**: [Tosin Akinosho](https://github.com/tosin2013) | **Repository**: [GitHub](https://github.com/tosin2013/mcp-adr-analysis-server.git)
|
|
14
|
+
|
|
15
|
+
## What is MCP?
|
|
16
|
+
|
|
17
|
+
The Model Context Protocol enables seamless integration between AI assistants and external tools. This server enhances AI assistants with deep architectural analysis capabilities, enabling intelligent code generation, decision tracking, and development workflow automation.
|
|
18
|
+
|
|
19
|
+
## ✨ Core Capabilities
|
|
20
|
+
|
|
21
|
+
🤖 **AI-Powered Analysis** - Immediate architectural insights with OpenRouter.ai integration
|
|
22
|
+
🏗️ **Technology Detection** - Identify any tech stack and architectural patterns
|
|
23
|
+
📋 **ADR Management** - Generate, suggest, and maintain Architectural Decision Records
|
|
24
|
+
🛡️ **Security & Compliance** - Detect and mask sensitive content automatically
|
|
25
|
+
📊 **Workflow Automation** - Todo generation, deployment tracking, and rule validation
|
|
26
|
+
🧪 **TDD Integration** - Two-phase Test-Driven Development with ADR linking and validation
|
|
27
|
+
🔍 **Mock Detection** - Sophisticated analysis to distinguish mock from production code
|
|
28
|
+
|
|
29
|
+
|
|
87
30
|
|
|
88
31
|
## 📦 Installation
|
|
89
32
|
|
|
@@ -96,12 +39,6 @@ npm install -g mcp-adr-analysis-server
|
|
|
96
39
|
npm install mcp-adr-analysis-server
|
|
97
40
|
```
|
|
98
41
|
|
|
99
|
-
### Using with uvx (Python-style)
|
|
100
|
-
```bash
|
|
101
|
-
# Run directly with uvx
|
|
102
|
-
uvx mcp-adr-analysis-server@latest
|
|
103
|
-
```
|
|
104
|
-
|
|
105
42
|
### From Source
|
|
106
43
|
```bash
|
|
107
44
|
git clone https://github.com/tosin2013/mcp-adr-analysis-server.git
|
|
@@ -111,32 +48,51 @@ npm run build
|
|
|
111
48
|
npm start
|
|
112
49
|
```
|
|
113
50
|
|
|
114
|
-
##
|
|
51
|
+
## 🤖 AI Execution Configuration
|
|
52
|
+
|
|
53
|
+
The MCP server supports **AI-powered execution** that transforms tools from returning prompts to returning actual results. This solves the fundamental UX issue where AI agents receive prompts instead of actionable data.
|
|
54
|
+
|
|
55
|
+
### Quick Setup
|
|
56
|
+
|
|
57
|
+
1. **Get OpenRouter API Key**: Visit [https://openrouter.ai/keys](https://openrouter.ai/keys)
|
|
58
|
+
2. **Set Environment Variables**:
|
|
59
|
+
```bash
|
|
60
|
+
OPENROUTER_API_KEY=your_openrouter_api_key_here
|
|
61
|
+
EXECUTION_MODE=full
|
|
62
|
+
AI_MODEL=anthropic/claude-3-sonnet
|
|
63
|
+
```
|
|
64
|
+
3. **Restart MCP Server**: Tools now return actual results instead of prompts!
|
|
115
65
|
|
|
116
66
|
### Environment Variables
|
|
117
67
|
|
|
118
|
-
|
|
68
|
+
#### **AI Execution (Recommended)**
|
|
69
|
+
- **`OPENROUTER_API_KEY`** (Required for AI): OpenRouter API key from https://openrouter.ai/keys
|
|
70
|
+
- **`EXECUTION_MODE`** (Optional): `full` (AI execution) or `prompt-only` (legacy)
|
|
71
|
+
- **`AI_MODEL`** (Optional): AI model to use (see supported models below)
|
|
119
72
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
73
|
+
#### **Performance Tuning (Optional)**
|
|
74
|
+
- **`AI_TEMPERATURE`** (Optional): Response consistency (0-1, default: 0.1)
|
|
75
|
+
- **`AI_MAX_TOKENS`** (Optional): Response length limit (default: 4000)
|
|
76
|
+
- **`AI_TIMEOUT`** (Optional): Request timeout in ms (default: 60000)
|
|
77
|
+
- **`AI_CACHE_ENABLED`** (Optional): Enable response caching (default: true)
|
|
124
78
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
79
|
+
#### **Project Configuration**
|
|
80
|
+
- **`PROJECT_PATH`** (Required): Path to the project directory to analyze
|
|
81
|
+
- **`ADR_DIRECTORY`** (Optional): Directory containing ADR files (default: `docs/adrs`)
|
|
82
|
+
- **`LOG_LEVEL`** (Optional): Logging level (DEBUG, INFO, WARN, ERROR)
|
|
128
83
|
|
|
129
|
-
|
|
130
|
-
- Options: `DEBUG`, `INFO`, `WARN`, `ERROR`
|
|
131
|
-
- Default: `INFO`
|
|
84
|
+
### Supported AI Models
|
|
132
85
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
86
|
+
| Model | Provider | Use Case | Input Cost | Output Cost |
|
|
87
|
+
|-------|----------|----------|------------|-------------|
|
|
88
|
+
| `anthropic/claude-3-sonnet` | Anthropic | Analysis, reasoning | $3.00/1K | $15.00/1K |
|
|
89
|
+
| `anthropic/claude-3-haiku` | Anthropic | Quick tasks | $0.25/1K | $1.25/1K |
|
|
90
|
+
| `openai/gpt-4o` | OpenAI | Versatile analysis | $5.00/1K | $15.00/1K |
|
|
91
|
+
| `openai/gpt-4o-mini` | OpenAI | Cost-effective | $0.15/1K | $0.60/1K |
|
|
136
92
|
|
|
137
|
-
|
|
93
|
+
## ⚙️ Client Configuration
|
|
138
94
|
|
|
139
|
-
### Claude Desktop
|
|
95
|
+
### Claude Desktop (Recommended Setup)
|
|
140
96
|
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
141
97
|
|
|
142
98
|
```json
|
|
@@ -146,6 +102,10 @@ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/
|
|
|
146
102
|
"command": "mcp-adr-analysis-server",
|
|
147
103
|
"env": {
|
|
148
104
|
"PROJECT_PATH": "/path/to/your/project",
|
|
105
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
106
|
+
"EXECUTION_MODE": "full",
|
|
107
|
+
"AI_MODEL": "anthropic/claude-3-sonnet",
|
|
108
|
+
"EXECUTION_MODE": "full",
|
|
149
109
|
"ADR_DIRECTORY": "docs/adrs",
|
|
150
110
|
"LOG_LEVEL": "ERROR"
|
|
151
111
|
}
|
|
@@ -211,25 +171,6 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
211
171
|
}
|
|
212
172
|
```
|
|
213
173
|
|
|
214
|
-
### Amazon Q CLI
|
|
215
|
-
Add to `~/.aws/amazonq/mcp.json`:
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"mcpServers": {
|
|
220
|
-
"adr-analysis": {
|
|
221
|
-
"command": "uvx",
|
|
222
|
-
"args": ["mcp-adr-analysis-server@latest"],
|
|
223
|
-
"env": {
|
|
224
|
-
"PROJECT_PATH": "/path/to/your/project",
|
|
225
|
-
"ADR_DIRECTORY": "docs/adrs",
|
|
226
|
-
"LOG_LEVEL": "ERROR"
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
174
|
## 🚀 Usage Examples
|
|
234
175
|
|
|
235
176
|
### Basic Project Analysis
|
|
@@ -256,10 +197,44 @@ const adrs = await generateAdrsFromPrd({
|
|
|
256
197
|
template: "nygard"
|
|
257
198
|
});
|
|
258
199
|
|
|
259
|
-
// Generate actionable todos from ADRs
|
|
200
|
+
// Generate actionable todos from ADRs with enhanced TDD approach
|
|
260
201
|
const todos = await generateAdrTodo({
|
|
261
202
|
adrDirectory: "docs/adrs",
|
|
262
|
-
outputPath: "todo.md"
|
|
203
|
+
outputPath: "todo.md",
|
|
204
|
+
phase: "both", // Two-phase TDD: test + production
|
|
205
|
+
linkAdrs: true, // Link all ADRs for system-wide coverage
|
|
206
|
+
includeRules: true // Include architectural rules validation
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Enhanced TDD Workflow
|
|
211
|
+
```typescript
|
|
212
|
+
// Phase 1: Generate comprehensive test specifications
|
|
213
|
+
const testPhase = await generateAdrTodo({
|
|
214
|
+
adrDirectory: "docs/adrs",
|
|
215
|
+
outputPath: "todo-tests.md",
|
|
216
|
+
phase: "test", // Generate mock test specifications
|
|
217
|
+
linkAdrs: true, // Connect all ADRs for complete test coverage
|
|
218
|
+
includeRules: true // Validate against architectural rules
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// Phase 2: Generate production implementation tasks
|
|
222
|
+
const prodPhase = await generateAdrTodo({
|
|
223
|
+
adrDirectory: "docs/adrs",
|
|
224
|
+
outputPath: "todo-implementation.md",
|
|
225
|
+
phase: "production", // Generate production-ready implementation tasks
|
|
226
|
+
linkAdrs: true, // Ensure system-wide consistency
|
|
227
|
+
includeRules: true // Enforce architectural compliance
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Validate progress and detect mock vs production code
|
|
231
|
+
const validation = await compareAdrProgress({
|
|
232
|
+
todoPath: "todo.md",
|
|
233
|
+
adrDirectory: "docs/adrs",
|
|
234
|
+
projectPath: "/path/to/project",
|
|
235
|
+
deepCodeAnalysis: true, // Distinguish mock from production code
|
|
236
|
+
functionalValidation: true, // Validate code actually works
|
|
237
|
+
strictMode: true // Reality-check against LLM overconfidence
|
|
263
238
|
});
|
|
264
239
|
```
|
|
265
240
|
|
|
@@ -293,15 +268,46 @@ const updatedAdrs = await incorporateResearch({
|
|
|
293
268
|
});
|
|
294
269
|
```
|
|
295
270
|
|
|
271
|
+
### Advanced Validation & Quality Assurance
|
|
272
|
+
```typescript
|
|
273
|
+
// Comprehensive validation with mock detection
|
|
274
|
+
const qualityCheck = await compareAdrProgress({
|
|
275
|
+
todoPath: "todo.md",
|
|
276
|
+
adrDirectory: "docs/adrs",
|
|
277
|
+
projectPath: "/path/to/project",
|
|
278
|
+
|
|
279
|
+
// Prevent LLM deception about code completeness
|
|
280
|
+
deepCodeAnalysis: true, // Detects mock patterns vs real implementation
|
|
281
|
+
functionalValidation: true, // Tests if code actually works
|
|
282
|
+
strictMode: true, // Reality-check mechanisms
|
|
283
|
+
|
|
284
|
+
// Advanced analysis options
|
|
285
|
+
includeTestCoverage: true, // Validate test coverage meets ADR goals
|
|
286
|
+
validateDependencies: true, // Check cross-ADR dependencies
|
|
287
|
+
environmentValidation: true // Test in realistic environments
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// Generate architectural rules from ADRs and patterns
|
|
291
|
+
const rules = await generateRules({
|
|
292
|
+
source: "both", // Extract from ADRs and code patterns
|
|
293
|
+
adrDirectory: "docs/adrs",
|
|
294
|
+
projectPath: "/path/to/project",
|
|
295
|
+
outputFormat: "json" // Machine-readable format
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
296
299
|
## 🎯 Use Cases
|
|
297
300
|
|
|
298
301
|
### 👨💻 **AI Coding Assistants**
|
|
299
302
|
*Enhance AI coding assistants like Cline, Cursor, and Claude Code*
|
|
300
303
|
|
|
304
|
+
- **Test-Driven Development**: Two-phase TDD workflow with comprehensive ADR integration
|
|
301
305
|
- **Intelligent Code Generation**: Generate code that follows architectural patterns and best practices
|
|
306
|
+
- **Mock vs Production Detection**: Prevent AI assistants from claiming mock code is production-ready
|
|
302
307
|
- **Architecture-Aware Refactoring**: Refactor code while maintaining architectural integrity
|
|
303
308
|
- **Decision Documentation**: Automatically document architectural decisions as you code
|
|
304
309
|
- **Pattern Recognition**: Identify and suggest architectural patterns for new features
|
|
310
|
+
- **Quality Validation**: Reality-check mechanisms against overconfident AI assessments
|
|
305
311
|
|
|
306
312
|
### 💬 **Conversational AI Assistants**
|
|
307
313
|
*Enhance chatbots and business agents with architectural intelligence*
|
|
@@ -428,30 +434,99 @@ npm run typecheck # Run TypeScript type checking
|
|
|
428
434
|
- **Security**: Content masking and secret prevention
|
|
429
435
|
- **MCP Compliance**: Strict adherence to Model Context Protocol specification
|
|
430
436
|
|
|
437
|
+
|
|
438
|
+
|
|
431
439
|
## 🚀 Getting Started
|
|
432
440
|
|
|
433
|
-
### Quick Start
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
### Quick Start (3 Steps)
|
|
442
|
+
|
|
443
|
+
1. **Install**: `npm install -g mcp-adr-analysis-server`
|
|
444
|
+
2. **Get API Key**: Visit [https://openrouter.ai/keys](https://openrouter.ai/keys)
|
|
445
|
+
3. **Configure Claude Desktop**: Add to your configuration:
|
|
438
446
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
+
```json
|
|
448
|
+
{
|
|
449
|
+
"mcpServers": {
|
|
450
|
+
"adr-analysis": {
|
|
451
|
+
"command": "mcp-adr-analysis-server",
|
|
452
|
+
"env": {
|
|
453
|
+
"PROJECT_PATH": "/path/to/your/project",
|
|
454
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
455
|
+
"EXECUTION_MODE": "full",
|
|
456
|
+
"AI_MODEL": "anthropic/claude-3-sonnet"
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
447
460
|
}
|
|
448
461
|
```
|
|
449
462
|
|
|
450
|
-
|
|
463
|
+
4. **Restart Claude Desktop** and start getting AI-powered architectural insights!
|
|
464
|
+
|
|
465
|
+
### Example Usage
|
|
466
|
+
|
|
467
|
+
Once configured, you can ask Claude:
|
|
468
|
+
|
|
469
|
+
> "Analyze this React project's architecture and suggest ADRs for any implicit decisions"
|
|
470
|
+
|
|
471
|
+
> "Generate ADRs from the PRD.md file and create a todo.md with implementation tasks"
|
|
472
|
+
|
|
473
|
+
> "Check this codebase for security issues and provide masking recommendations"
|
|
474
|
+
|
|
475
|
+
The server will now return **actual analysis results** instead of prompts to submit elsewhere!
|
|
476
|
+
|
|
477
|
+
## 🚀 Complete Development Lifecycle
|
|
478
|
+
|
|
479
|
+
The MCP server now provides a **complete development lifecycle assistant** with intelligent workflow guidance:
|
|
480
|
+
|
|
481
|
+
### **🎯 Step 1: Get Workflow Guidance**
|
|
482
|
+
```
|
|
483
|
+
get_workflow_guidance
|
|
484
|
+
```
|
|
485
|
+
**Parameters:**
|
|
486
|
+
```json
|
|
487
|
+
{
|
|
488
|
+
"goal": "analyze new project and set up architectural documentation",
|
|
489
|
+
"projectContext": "new_project",
|
|
490
|
+
"availableAssets": ["codebase"],
|
|
491
|
+
"timeframe": "thorough_review"
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Result**: Intelligent tool sequence recommendations and workflow guidance.
|
|
496
|
+
|
|
497
|
+
### **🏗️ Step 2: Get Development Guidance**
|
|
498
|
+
```
|
|
499
|
+
get_development_guidance
|
|
500
|
+
```
|
|
501
|
+
**Parameters:**
|
|
502
|
+
```json
|
|
503
|
+
{
|
|
504
|
+
"developmentPhase": "implementation",
|
|
505
|
+
"adrsToImplement": ["ADR-001: API Design", "ADR-002: Database Schema"],
|
|
506
|
+
"technologyStack": ["TypeScript", "React", "Node.js"],
|
|
507
|
+
"teamContext": {"size": "small_team", "experienceLevel": "mixed"}
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Result**: Specific coding tasks, implementation patterns, and development roadmap.
|
|
512
|
+
|
|
513
|
+
### **📊 Step 3: Execute Recommended Tools**
|
|
514
|
+
Follow the workflow guidance to execute the recommended tool sequence for your specific goals.
|
|
515
|
+
|
|
516
|
+
### **🔄 Complete Workflow Examples**
|
|
517
|
+
|
|
518
|
+
#### **New Project Setup**
|
|
519
|
+
1. `get_workflow_guidance` → 2. `analyze_project_ecosystem` → 3. `get_architectural_context` → 4. `suggest_adrs` → 5. `get_development_guidance`
|
|
520
|
+
|
|
521
|
+
#### **Existing Project Analysis**
|
|
522
|
+
1. `get_workflow_guidance` → 2. `discover_existing_adrs` → 3. `get_architectural_context` → 4. `generate_adr_todo` → 5. `get_development_guidance`
|
|
523
|
+
|
|
524
|
+
#### **Security Audit**
|
|
525
|
+
1. `get_workflow_guidance` → 2. `analyze_content_security` → 3. `generate_content_masking` → 4. `validate_content_masking`
|
|
451
526
|
|
|
452
527
|
### Configuration Examples
|
|
453
528
|
|
|
454
|
-
#### Example 1:
|
|
529
|
+
#### Example 1: AI-Powered Project Analysis
|
|
455
530
|
```json
|
|
456
531
|
{
|
|
457
532
|
"mcpServers": {
|
|
@@ -460,6 +535,10 @@ npm run typecheck # Run TypeScript type checking
|
|
|
460
535
|
"env": {
|
|
461
536
|
"PROJECT_PATH": "/Users/username/my-react-app",
|
|
462
537
|
"ADR_DIRECTORY": "docs/decisions",
|
|
538
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
539
|
+
"EXECUTION_MODE": "full",
|
|
540
|
+
"AI_MODEL": "anthropic/claude-3-sonnet",
|
|
541
|
+
"AI_TEMPERATURE": "0.1",
|
|
463
542
|
"LOG_LEVEL": "INFO"
|
|
464
543
|
}
|
|
465
544
|
}
|
|
@@ -467,7 +546,42 @@ npm run typecheck # Run TypeScript type checking
|
|
|
467
546
|
}
|
|
468
547
|
```
|
|
469
548
|
|
|
470
|
-
#### Example 2:
|
|
549
|
+
#### Example 2: Cost-Effective Setup
|
|
550
|
+
```json
|
|
551
|
+
{
|
|
552
|
+
"mcpServers": {
|
|
553
|
+
"adr-analysis": {
|
|
554
|
+
"command": "mcp-adr-analysis-server",
|
|
555
|
+
"env": {
|
|
556
|
+
"PROJECT_PATH": "/Users/username/my-project",
|
|
557
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
558
|
+
"EXECUTION_MODE": "full",
|
|
559
|
+
"AI_MODEL": "anthropic/claude-3-haiku",
|
|
560
|
+
"AI_MAX_TOKENS": "2000",
|
|
561
|
+
"AI_TEMPERATURE": "0.05"
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
#### Example 3: Prompt-Only Mode (Legacy)
|
|
569
|
+
```json
|
|
570
|
+
{
|
|
571
|
+
"mcpServers": {
|
|
572
|
+
"adr-analysis": {
|
|
573
|
+
"command": "mcp-adr-analysis-server",
|
|
574
|
+
"env": {
|
|
575
|
+
"PROJECT_PATH": "/Users/username/my-project",
|
|
576
|
+
"EXECUTION_MODE": "prompt-only",
|
|
577
|
+
"LOG_LEVEL": "INFO"
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
#### Example 4: Multi-Project Setup
|
|
471
585
|
```json
|
|
472
586
|
{
|
|
473
587
|
"mcpServers": {
|
|
@@ -476,6 +590,9 @@ npm run typecheck # Run TypeScript type checking
|
|
|
476
590
|
"env": {
|
|
477
591
|
"PROJECT_PATH": "/Users/username/frontend-app",
|
|
478
592
|
"ADR_DIRECTORY": "docs/adrs",
|
|
593
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
594
|
+
"EXECUTION_MODE": "full",
|
|
595
|
+
"AI_MODEL": "openai/gpt-4o-mini",
|
|
479
596
|
"LOG_LEVEL": "ERROR"
|
|
480
597
|
}
|
|
481
598
|
},
|
|
@@ -484,6 +601,9 @@ npm run typecheck # Run TypeScript type checking
|
|
|
484
601
|
"env": {
|
|
485
602
|
"PROJECT_PATH": "/Users/username/backend-api",
|
|
486
603
|
"ADR_DIRECTORY": "architecture/decisions",
|
|
604
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
605
|
+
"EXECUTION_MODE": "full",
|
|
606
|
+
"AI_MODEL": "anthropic/claude-3-sonnet",
|
|
487
607
|
"LOG_LEVEL": "DEBUG"
|
|
488
608
|
}
|
|
489
609
|
}
|
|
@@ -491,7 +611,7 @@ npm run typecheck # Run TypeScript type checking
|
|
|
491
611
|
}
|
|
492
612
|
```
|
|
493
613
|
|
|
494
|
-
#### Example
|
|
614
|
+
#### Example 5: Development Environment
|
|
495
615
|
```json
|
|
496
616
|
{
|
|
497
617
|
"mcpServers": {
|
|
@@ -500,33 +620,130 @@ npm run typecheck # Run TypeScript type checking
|
|
|
500
620
|
"env": {
|
|
501
621
|
"PROJECT_PATH": "${workspaceFolder}",
|
|
502
622
|
"ADR_DIRECTORY": "docs/adrs",
|
|
503
|
-
"
|
|
504
|
-
"
|
|
505
|
-
"
|
|
623
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
624
|
+
"EXECUTION_MODE": "full",
|
|
625
|
+
"AI_MODEL": "anthropic/claude-3-haiku",
|
|
626
|
+
"AI_CACHE_ENABLED": "true",
|
|
627
|
+
"AI_CACHE_TTL": "1800",
|
|
628
|
+
"LOG_LEVEL": "DEBUG"
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
## � Troubleshooting
|
|
638
|
+
|
|
639
|
+
### ⚠️ **CRITICAL**: Tools Return Prompts Instead of Results
|
|
640
|
+
|
|
641
|
+
**Symptom**: When calling tools like `suggest_adrs`, you receive large detailed instructions and prompts instead of actual ADR suggestions.
|
|
642
|
+
|
|
643
|
+
**Root Cause**: AI execution is not properly configured. The tool is falling back to prompt-only mode.
|
|
644
|
+
|
|
645
|
+
**Solution**: Add these **required** environment variables to your MCP configuration:
|
|
646
|
+
|
|
647
|
+
```json
|
|
648
|
+
{
|
|
649
|
+
"mcpServers": {
|
|
650
|
+
"adr-analysis": {
|
|
651
|
+
"command": "mcp-adr-analysis-server",
|
|
652
|
+
"env": {
|
|
653
|
+
"PROJECT_PATH": "/path/to/your/project",
|
|
654
|
+
"OPENROUTER_API_KEY": "your_openrouter_api_key_here",
|
|
655
|
+
"EXECUTION_MODE": "full",
|
|
656
|
+
"AI_MODEL": "anthropic/claude-3-sonnet"
|
|
506
657
|
}
|
|
507
658
|
}
|
|
508
659
|
}
|
|
509
660
|
}
|
|
510
661
|
```
|
|
511
662
|
|
|
512
|
-
|
|
663
|
+
**Verification**: After adding these variables and restarting, tools should return actual results like:
|
|
664
|
+
- `suggest_adrs` → Actual ADR suggestions with titles and reasoning
|
|
665
|
+
- `analyze_project_ecosystem` → Real technology analysis and recommendations
|
|
666
|
+
- `generate_content_masking` → Actual masked content, not masking instructions
|
|
513
667
|
|
|
514
|
-
**
|
|
668
|
+
**Quick Diagnostic**: Use the built-in diagnostic tool:
|
|
669
|
+
```
|
|
670
|
+
check_ai_execution_status
|
|
515
671
|
```
|
|
516
|
-
|
|
672
|
+
This will show exactly what's wrong with your configuration and provide step-by-step fix instructions.
|
|
673
|
+
|
|
674
|
+
### Other AI Execution Issues
|
|
675
|
+
|
|
676
|
+
**Problem**: "AI execution not available" errors
|
|
677
|
+
```bash
|
|
678
|
+
# Check execution mode
|
|
679
|
+
echo $EXECUTION_MODE
|
|
680
|
+
|
|
681
|
+
# Verify API key is set
|
|
682
|
+
echo $OPENROUTER_API_KEY | head -c 10
|
|
683
|
+
|
|
684
|
+
# Test AI connectivity
|
|
685
|
+
curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \
|
|
686
|
+
https://openrouter.ai/api/v1/models
|
|
517
687
|
```
|
|
518
688
|
|
|
519
|
-
**
|
|
689
|
+
**Problem**: "AI execution not available" errors
|
|
690
|
+
- ✅ Verify `OPENROUTER_API_KEY` is set correctly
|
|
691
|
+
- ✅ Check `EXECUTION_MODE=full` in environment
|
|
692
|
+
- ✅ Ensure API key has sufficient credits
|
|
693
|
+
- ✅ Verify network connectivity to OpenRouter
|
|
694
|
+
|
|
695
|
+
**Problem**: Slow AI responses
|
|
696
|
+
```bash
|
|
697
|
+
# Reduce token limits for faster responses
|
|
698
|
+
AI_MAX_TOKENS=2000
|
|
699
|
+
AI_TEMPERATURE=0.05
|
|
700
|
+
|
|
701
|
+
# Enable caching for repeated queries
|
|
702
|
+
AI_CACHE_ENABLED=true
|
|
703
|
+
AI_CACHE_TTL=3600
|
|
520
704
|
```
|
|
521
|
-
|
|
705
|
+
|
|
706
|
+
**Problem**: High API costs
|
|
707
|
+
```bash
|
|
708
|
+
# Use cost-effective models
|
|
709
|
+
AI_MODEL=anthropic/claude-3-haiku
|
|
710
|
+
# or
|
|
711
|
+
AI_MODEL=openai/gpt-4o-mini
|
|
712
|
+
|
|
713
|
+
# Reduce token usage
|
|
714
|
+
AI_MAX_TOKENS=2000
|
|
715
|
+
AI_TEMPERATURE=0.1
|
|
522
716
|
```
|
|
523
717
|
|
|
524
|
-
|
|
718
|
+
### Environment Configuration
|
|
719
|
+
|
|
720
|
+
**Check current configuration:**
|
|
721
|
+
```bash
|
|
722
|
+
# View AI execution status
|
|
723
|
+
node -e "
|
|
724
|
+
const { getAIExecutionStatus } = require('./dist/utils/prompt-execution.js');
|
|
725
|
+
console.log(JSON.stringify(getAIExecutionStatus(), null, 2));
|
|
726
|
+
"
|
|
525
727
|
```
|
|
526
|
-
|
|
728
|
+
|
|
729
|
+
**Reset configuration:**
|
|
730
|
+
```bash
|
|
731
|
+
# Clear cache and restart
|
|
732
|
+
rm -rf .mcp-adr-cache
|
|
733
|
+
npm run build
|
|
527
734
|
```
|
|
528
735
|
|
|
529
|
-
|
|
736
|
+
### Common Issues
|
|
737
|
+
|
|
738
|
+
| Issue | Solution |
|
|
739
|
+
|-------|----------|
|
|
740
|
+
| "Module not found" errors | Run `npm install && npm run build` |
|
|
741
|
+
| TypeScript compilation errors | Check Node.js version >= 18.0.0 |
|
|
742
|
+
| Permission denied | Check file permissions and project path |
|
|
743
|
+
| API rate limits | Reduce `AI_MAX_TOKENS` or increase `AI_TIMEOUT` |
|
|
744
|
+
| Cache issues | Clear cache with `rm -rf .mcp-adr-cache` |
|
|
745
|
+
|
|
746
|
+
## �🔒 Security Features
|
|
530
747
|
|
|
531
748
|
### Content Protection
|
|
532
749
|
- **Automatic Secret Detection**: Identifies API keys, passwords, and sensitive data
|