mcp-adr-analysis-server 2.0.24 → 2.1.0

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.
Files changed (191) hide show
  1. package/README.md +94 -839
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/config/ai-config.d.ts.map +1 -1
  4. package/dist/src/config/ai-config.js +9 -9
  5. package/dist/src/config/ai-config.js.map +1 -1
  6. package/dist/src/index.d.ts +6 -0
  7. package/dist/src/index.d.ts.map +1 -1
  8. package/dist/src/index.js +218 -60
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/prompts/analysis-prompts.d.ts +4 -1
  11. package/dist/src/prompts/analysis-prompts.d.ts.map +1 -1
  12. package/dist/src/prompts/analysis-prompts.js +61 -30
  13. package/dist/src/prompts/analysis-prompts.js.map +1 -1
  14. package/dist/src/prompts/index.d.ts +17 -1
  15. package/dist/src/prompts/index.d.ts.map +1 -1
  16. package/dist/src/prompts/index.js +325 -1
  17. package/dist/src/prompts/index.js.map +1 -1
  18. package/dist/src/prompts/rule-generation-prompts.d.ts +5 -1
  19. package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -1
  20. package/dist/src/prompts/rule-generation-prompts.js +5 -1
  21. package/dist/src/prompts/rule-generation-prompts.js.map +1 -1
  22. package/dist/src/prompts/security-prompts.d.ts +6 -1
  23. package/dist/src/prompts/security-prompts.d.ts.map +1 -1
  24. package/dist/src/prompts/security-prompts.js +6 -1
  25. package/dist/src/prompts/security-prompts.js.map +1 -1
  26. package/dist/src/prompts/todo-prompts.d.ts +49 -0
  27. package/dist/src/prompts/todo-prompts.d.ts.map +1 -0
  28. package/dist/src/prompts/todo-prompts.js +824 -0
  29. package/dist/src/prompts/todo-prompts.js.map +1 -0
  30. package/dist/src/resources/index.d.ts.map +1 -1
  31. package/dist/src/resources/index.js +9 -7
  32. package/dist/src/resources/index.js.map +1 -1
  33. package/dist/src/tools/adr-bootstrap-validation-tool.d.ts +47 -0
  34. package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -0
  35. package/dist/src/tools/adr-bootstrap-validation-tool.js +979 -0
  36. package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -0
  37. package/dist/src/tools/adr-suggestion-tool.d.ts +1 -0
  38. package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
  39. package/dist/src/tools/adr-suggestion-tool.js +298 -2
  40. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  41. package/dist/src/tools/content-masking-tool.d.ts +1 -0
  42. package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
  43. package/dist/src/tools/content-masking-tool.js +100 -0
  44. package/dist/src/tools/content-masking-tool.js.map +1 -1
  45. package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
  46. package/dist/src/tools/deployment-readiness-tool.js +298 -36
  47. package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
  48. package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
  49. package/dist/src/tools/interactive-adr-planning-tool.js +270 -108
  50. package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
  51. package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
  52. package/dist/src/tools/mcp-planning-tool.js +18 -10
  53. package/dist/src/tools/mcp-planning-tool.js.map +1 -1
  54. package/dist/src/tools/research-integration-tool.d.ts +4 -1
  55. package/dist/src/tools/research-integration-tool.d.ts.map +1 -1
  56. package/dist/src/tools/research-integration-tool.js +5 -1
  57. package/dist/src/tools/research-integration-tool.js.map +1 -1
  58. package/dist/src/tools/review-existing-adrs-tool.d.ts +19 -0
  59. package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -0
  60. package/dist/src/tools/review-existing-adrs-tool.js +1204 -0
  61. package/dist/src/tools/review-existing-adrs-tool.js.map +1 -0
  62. package/dist/src/tools/rule-generation-tool.d.ts +2 -0
  63. package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
  64. package/dist/src/tools/rule-generation-tool.js +274 -33
  65. package/dist/src/tools/rule-generation-tool.js.map +1 -1
  66. package/dist/src/tools/smart-git-push-tool-v2.d.ts +4 -0
  67. package/dist/src/tools/smart-git-push-tool-v2.d.ts.map +1 -1
  68. package/dist/src/tools/smart-git-push-tool-v2.js +423 -229
  69. package/dist/src/tools/smart-git-push-tool-v2.js.map +1 -1
  70. package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
  71. package/dist/src/tools/smart-git-push-tool.js +65 -13
  72. package/dist/src/tools/smart-git-push-tool.js.map +1 -1
  73. package/dist/src/tools/tool-chain-orchestrator.d.ts +2 -2
  74. package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
  75. package/dist/src/tools/tool-chain-orchestrator.js +152 -93
  76. package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
  77. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +6 -6
  78. package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
  79. package/dist/src/tools/troubleshoot-guided-workflow-tool.js +154 -6
  80. package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
  81. package/dist/src/types/ape-framework.d.ts +93 -0
  82. package/dist/src/types/ape-framework.d.ts.map +1 -1
  83. package/dist/src/types/ape-framework.js +10 -10
  84. package/dist/src/types/ape-framework.js.map +1 -1
  85. package/dist/src/types/index.d.ts +129 -3
  86. package/dist/src/types/index.d.ts.map +1 -1
  87. package/dist/src/types/index.js +15 -0
  88. package/dist/src/types/index.js.map +1 -1
  89. package/dist/src/types/knowledge-generation.d.ts +78 -0
  90. package/dist/src/types/knowledge-generation.d.ts.map +1 -1
  91. package/dist/src/types/knowledge-generation.js +10 -6
  92. package/dist/src/types/knowledge-generation.js.map +1 -1
  93. package/dist/src/types/memory-entities.d.ts +36 -36
  94. package/dist/src/types/reflexion-framework.d.ts +44 -0
  95. package/dist/src/types/reflexion-framework.d.ts.map +1 -1
  96. package/dist/src/types/reflexion-framework.js +7 -7
  97. package/dist/src/types/reflexion-framework.js.map +1 -1
  98. package/dist/src/types/tool-arguments.d.ts +224 -0
  99. package/dist/src/types/tool-arguments.d.ts.map +1 -0
  100. package/dist/src/types/tool-arguments.js +6 -0
  101. package/dist/src/types/tool-arguments.js.map +1 -0
  102. package/dist/src/utils/actual-file-operations.d.ts.map +1 -1
  103. package/dist/src/utils/actual-file-operations.js +25 -9
  104. package/dist/src/utils/actual-file-operations.js.map +1 -1
  105. package/dist/src/utils/adr-discovery.d.ts +33 -1
  106. package/dist/src/utils/adr-discovery.d.ts.map +1 -1
  107. package/dist/src/utils/adr-discovery.js +14 -9
  108. package/dist/src/utils/adr-discovery.js.map +1 -1
  109. package/dist/src/utils/adr-suggestions.d.ts +72 -0
  110. package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
  111. package/dist/src/utils/adr-suggestions.js +6 -0
  112. package/dist/src/utils/adr-suggestions.js.map +1 -1
  113. package/dist/src/utils/cache.d.ts.map +1 -1
  114. package/dist/src/utils/cache.js +22 -19
  115. package/dist/src/utils/cache.js.map +1 -1
  116. package/dist/src/utils/chain-of-thought-template.d.ts +13 -1
  117. package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -1
  118. package/dist/src/utils/chain-of-thought-template.js +31 -22
  119. package/dist/src/utils/chain-of-thought-template.js.map +1 -1
  120. package/dist/src/utils/config.d.ts.map +1 -1
  121. package/dist/src/utils/config.js +1 -0
  122. package/dist/src/utils/config.js.map +1 -1
  123. package/dist/src/utils/directory-compat.js +1 -1
  124. package/dist/src/utils/directory-compat.js.map +1 -1
  125. package/dist/src/utils/file-system.d.ts +182 -34
  126. package/dist/src/utils/file-system.d.ts.map +1 -1
  127. package/dist/src/utils/file-system.js +648 -774
  128. package/dist/src/utils/file-system.js.map +1 -1
  129. package/dist/src/utils/gitleaks-detector.d.ts +50 -0
  130. package/dist/src/utils/gitleaks-detector.d.ts.map +1 -0
  131. package/dist/src/utils/gitleaks-detector.js +334 -0
  132. package/dist/src/utils/gitleaks-detector.js.map +1 -0
  133. package/dist/src/utils/interactive-approval.d.ts.map +1 -1
  134. package/dist/src/utils/interactive-approval.js +2 -1
  135. package/dist/src/utils/interactive-approval.js.map +1 -1
  136. package/dist/src/utils/json-safe.d.ts.map +1 -1
  137. package/dist/src/utils/json-safe.js +9 -6
  138. package/dist/src/utils/json-safe.js.map +1 -1
  139. package/dist/src/utils/knowledge-graph-manager.d.ts +14 -0
  140. package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
  141. package/dist/src/utils/knowledge-graph-manager.js +18 -1
  142. package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
  143. package/dist/src/utils/location-filter.d.ts +35 -10
  144. package/dist/src/utils/location-filter.d.ts.map +1 -1
  145. package/dist/src/utils/location-filter.js +360 -94
  146. package/dist/src/utils/location-filter.js.map +1 -1
  147. package/dist/src/utils/mcp-response-validator.d.ts.map +1 -1
  148. package/dist/src/utils/mcp-response-validator.js +34 -19
  149. package/dist/src/utils/mcp-response-validator.js.map +1 -1
  150. package/dist/src/utils/memory-entity-manager.d.ts.map +1 -1
  151. package/dist/src/utils/memory-entity-manager.js +5 -2
  152. package/dist/src/utils/memory-entity-manager.js.map +1 -1
  153. package/dist/src/utils/memory-migration-manager.d.ts.map +1 -1
  154. package/dist/src/utils/memory-migration-manager.js +15 -7
  155. package/dist/src/utils/memory-migration-manager.js.map +1 -1
  156. package/dist/src/utils/memory-relationship-mapper.d.ts.map +1 -1
  157. package/dist/src/utils/memory-relationship-mapper.js +2 -1
  158. package/dist/src/utils/memory-relationship-mapper.js.map +1 -1
  159. package/dist/src/utils/memory-rollback-manager.d.ts +12 -0
  160. package/dist/src/utils/memory-rollback-manager.d.ts.map +1 -1
  161. package/dist/src/utils/memory-rollback-manager.js +36 -3
  162. package/dist/src/utils/memory-rollback-manager.js.map +1 -1
  163. package/dist/src/utils/output-masking.d.ts +12 -0
  164. package/dist/src/utils/output-masking.d.ts.map +1 -1
  165. package/dist/src/utils/output-masking.js +5 -0
  166. package/dist/src/utils/output-masking.js.map +1 -1
  167. package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
  168. package/dist/src/utils/release-readiness-detector.js +43 -42
  169. package/dist/src/utils/release-readiness-detector.js.map +1 -1
  170. package/dist/src/utils/research-integration.d.ts.map +1 -1
  171. package/dist/src/utils/research-integration.js +73 -44
  172. package/dist/src/utils/research-integration.js.map +1 -1
  173. package/dist/src/utils/research-questions.d.ts.map +1 -1
  174. package/dist/src/utils/research-questions.js +40 -14
  175. package/dist/src/utils/research-questions.js.map +1 -1
  176. package/dist/src/utils/ripgrep-wrapper.d.ts +84 -0
  177. package/dist/src/utils/ripgrep-wrapper.d.ts.map +1 -0
  178. package/dist/src/utils/ripgrep-wrapper.js +255 -0
  179. package/dist/src/utils/ripgrep-wrapper.js.map +1 -0
  180. package/dist/src/utils/rule-generation.d.ts.map +1 -1
  181. package/dist/src/utils/rule-generation.js +26 -15
  182. package/dist/src/utils/rule-generation.js.map +1 -1
  183. package/dist/src/utils/tree-sitter-analyzer.d.ts +185 -0
  184. package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -0
  185. package/dist/src/utils/tree-sitter-analyzer.js +885 -0
  186. package/dist/src/utils/tree-sitter-analyzer.js.map +1 -0
  187. package/package.json +31 -6
  188. package/dist/src/utils/enhanced-sensitive-detector.d.ts +0 -61
  189. package/dist/src/utils/enhanced-sensitive-detector.d.ts.map +0 -1
  190. package/dist/src/utils/enhanced-sensitive-detector.js +0 -437
  191. package/dist/src/utils/enhanced-sensitive-detector.js.map +0 -1
package/README.md CHANGED
@@ -6,9 +6,18 @@
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3+-blue)](https://www.typescriptlang.org/)
8
8
 
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.
9
+ > **AI-powered architectural analysis for intelligent development workflows.** Returns actual analysis results, not prompts to submit elsewhere.
10
10
 
11
- **Key Differentiator**: Returns actual analysis results, not prompts to submit elsewhere.
11
+ ## TL;DR
12
+
13
+ **What:** MCP server that provides AI-powered architectural decision analysis and ADR management
14
+ **Who:** AI coding assistants (Claude, Cline, Cursor), enterprise architects, development teams
15
+ **Why:** Get immediate architectural insights instead of prompts, with 95% confidence scoring
16
+ **How:** `npm install -g mcp-adr-analysis-server` → Configure with OpenRouter API → Start analyzing
17
+
18
+ **Key Features:** Tree-sitter AST analysis • Security content masking • Test-driven development • Deployment readiness validation
19
+
20
+ ---
12
21
 
13
22
  **Author**: [Tosin Akinosho](https://github.com/tosin2013) | **Repository**: [GitHub](https://github.com/tosin2013/mcp-adr-analysis-server.git)
14
23
 
@@ -21,96 +30,30 @@ The Model Context Protocol enables seamless integration between AI assistants an
21
30
  🤖 **AI-Powered Analysis** - Immediate architectural insights with OpenRouter.ai integration
22
31
  🏗️ **Technology Detection** - Identify any tech stack and architectural patterns
23
32
  📋 **ADR Management** - Generate, suggest, and maintain Architectural Decision Records
33
+ 🔗 **Smart Code Linking** - AI-powered discovery of code files related to ADRs and decisions
24
34
  🛡️ **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
- 🚀 **Deployment Readiness** - Zero-tolerance test validation with deployment history tracking and hard blocking
29
-
35
+ 🧪 **TDD Integration** - Two-phase Test-Driven Development with validation
36
+ 🚀 **Deployment Readiness** - Zero-tolerance test validation with hard blocking
30
37
 
38
+ 📖 **[View Full Capabilities →](docs/explanation/)**
31
39
 
32
- ## 📦 Installation
40
+ ## 📦 Quick Installation
33
41
 
34
- ### NPM Installation (Recommended)
35
42
  ```bash
36
- # Global installation
43
+ # Global installation (recommended)
37
44
  npm install -g mcp-adr-analysis-server
38
45
 
39
- # Local installation
40
- npm install mcp-adr-analysis-server
41
- ```
42
-
43
- ### RHEL 9/10 Installation (Recommended for RHEL systems)
44
- ```bash
45
- # Download and run the RHEL-specific installer
46
+ # RHEL 9/10 systems (special installer)
46
47
  curl -sSL https://raw.githubusercontent.com/tosin2013/mcp-adr-analysis-server/main/scripts/install-rhel.sh | bash
47
-
48
- # Or if you have the repository cloned:
49
- git clone https://github.com/tosin2013/mcp-adr-analysis-server.git
50
- cd mcp-adr-analysis-server
51
- ./scripts/install-rhel.sh
52
- ```
53
-
54
- **Why RHEL needs special handling:**
55
- - RHEL 9/10 have specific npm PATH and permission issues
56
- - Global npm installations often fail due to SELinux policies
57
- - The script handles npm prefix configuration and PATH setup automatically
58
-
59
- ### From Source
60
- ```bash
61
- git clone https://github.com/tosin2013/mcp-adr-analysis-server.git
62
- cd mcp-adr-analysis-server
63
- npm install
64
- npm run build
65
- npm start
66
48
  ```
67
49
 
68
- ## 🤖 AI Execution Configuration
69
-
70
- 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.
71
-
72
- ### Quick Setup
73
-
74
- 1. **Get OpenRouter API Key**: Visit [https://openrouter.ai/keys](https://openrouter.ai/keys)
75
- 2. **Set Environment Variables**:
76
- ```bash
77
- OPENROUTER_API_KEY=your_openrouter_api_key_here
78
- EXECUTION_MODE=full
79
- AI_MODEL=anthropic/claude-3-sonnet
80
- ```
81
- 3. **Restart MCP Server**: Tools now return actual results instead of prompts!
50
+ 📖 **[Detailed Installation Guide →](docs/tutorials/01-first-steps.md)** | **[RHEL Setup →](scripts/install-rhel.sh)**
82
51
 
83
- ### Environment Variables
52
+ ## ⚡ Quick Setup (3 Steps)
84
53
 
85
- #### **AI Execution (Recommended)**
86
- - **`OPENROUTER_API_KEY`** (Required for AI): OpenRouter API key from https://openrouter.ai/keys
87
- - **`EXECUTION_MODE`** (Optional): `full` (AI execution) or `prompt-only` (legacy)
88
- - **`AI_MODEL`** (Optional): AI model to use (see supported models below)
89
-
90
- #### **Performance Tuning (Optional)**
91
- - **`AI_TEMPERATURE`** (Optional): Response consistency (0-1, default: 0.1)
92
- - **`AI_MAX_TOKENS`** (Optional): Response length limit (default: 4000)
93
- - **`AI_TIMEOUT`** (Optional): Request timeout in ms (default: 60000)
94
- - **`AI_CACHE_ENABLED`** (Optional): Enable response caching (default: true)
95
-
96
- #### **Project Configuration**
97
- - **`PROJECT_PATH`** (Required): Path to the project directory to analyze
98
- - **`ADR_DIRECTORY`** (Optional): Directory containing ADR files (default: `docs/adrs`)
99
- - **`LOG_LEVEL`** (Optional): Logging level (DEBUG, INFO, WARN, ERROR)
100
-
101
- ### Supported AI Models
102
-
103
- | Model | Provider | Use Case | Input Cost | Output Cost |
104
- |-------|----------|----------|------------|-------------|
105
- | `anthropic/claude-3-sonnet` | Anthropic | Analysis, reasoning | $3.00/1K | $15.00/1K |
106
- | `anthropic/claude-3-haiku` | Anthropic | Quick tasks | $0.25/1K | $1.25/1K |
107
- | `openai/gpt-4o` | OpenAI | Versatile analysis | $5.00/1K | $15.00/1K |
108
- | `openai/gpt-4o-mini` | OpenAI | Cost-effective | $0.15/1K | $0.60/1K |
109
-
110
- ## ⚙️ Client Configuration
111
-
112
- ### Claude Desktop (Recommended Setup)
113
- Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
54
+ 1. **Get API Key**: [OpenRouter.ai/keys](https://openrouter.ai/keys)
55
+ 2. **Set Environment**: `OPENROUTER_API_KEY=your_key` + `EXECUTION_MODE=full`
56
+ 3. **Configure Client**: Add to Claude Desktop, Cline, Cursor, or Windsurf
114
57
 
115
58
  ```json
116
59
  {
@@ -119,824 +62,136 @@ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/
119
62
  "command": "mcp-adr-analysis-server",
120
63
  "env": {
121
64
  "PROJECT_PATH": "/path/to/your/project",
122
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
123
- "EXECUTION_MODE": "full",
124
- "AI_MODEL": "anthropic/claude-3-sonnet",
125
- "EXECUTION_MODE": "full",
126
- "ADR_DIRECTORY": "docs/adrs",
127
- "LOG_LEVEL": "ERROR"
65
+ "OPENROUTER_API_KEY": "your_key_here",
66
+ "EXECUTION_MODE": "full"
128
67
  }
129
68
  }
130
69
  }
131
70
  }
132
71
  ```
133
72
 
134
- ### Cline (VS Code Extension)
135
- Add to your `cline_mcp_settings.json`:
73
+ 📖 **[Full Configuration Guide →](docs/reference/mcp-client-config.md)** | **[Client Setup →](docs/reference/environment-config.md)**
136
74
 
137
- ```json
138
- {
139
- "mcpServers": {
140
- "mcp-adr-analysis-server": {
141
- "command": "npx",
142
- "args": ["mcp-adr-analysis-server"],
143
- "env": {
144
- "PROJECT_PATH": "${workspaceFolder}",
145
- "ADR_DIRECTORY": "docs/adrs",
146
- "LOG_LEVEL": "ERROR"
147
- }
148
- }
149
- }
150
- }
151
- ```
75
+ ## 🚀 Usage Examples
152
76
 
153
- ### Cursor
154
- Create `.cursor/mcp.json` in your project:
77
+ **Ask Claude (or any MCP client):**
155
78
 
156
- ```json
157
- {
158
- "mcpServers": {
159
- "adr-analysis": {
160
- "command": "npx",
161
- "args": ["mcp-adr-analysis-server"],
162
- "env": {
163
- "PROJECT_PATH": ".",
164
- "ADR_DIRECTORY": "docs/adrs",
165
- "LOG_LEVEL": "ERROR"
166
- }
167
- }
168
- }
169
- }
170
- ```
79
+ > "Analyze this React project's architecture and suggest ADRs for any implicit decisions"
171
80
 
172
- ### Windsurf
173
- Add to `~/.codeium/windsurf/mcp_config.json`:
81
+ > "Generate ADRs from the PRD.md file and create a todo.md with implementation tasks"
174
82
 
175
- ```json
176
- {
177
- "mcpServers": {
178
- "adr-analysis": {
179
- "command": "mcp-adr-analysis-server",
180
- "args": [],
181
- "env": {
182
- "PROJECT_PATH": "/path/to/your/project",
183
- "ADR_DIRECTORY": "docs/adrs",
184
- "LOG_LEVEL": "ERROR"
185
- }
186
- }
187
- }
188
- }
189
- ```
83
+ > "Check this codebase for security issues and provide masking recommendations"
190
84
 
191
- ## 🚀 Usage Examples
85
+ **The server returns actual analysis results** instead of prompts to submit elsewhere!
192
86
 
193
- ### Basic Project Analysis
194
87
  ```typescript
195
- // Analyze any project's technology stack and architecture
88
+ // Basic project analysis
196
89
  const analysis = await analyzeProjectEcosystem({
197
- projectPath: "/path/to/project",
198
- analysisType: "comprehensive"
90
+ projectPath: '/path/to/project',
91
+ analysisType: 'comprehensive',
199
92
  });
200
93
 
201
- // Get intelligent architectural insights
202
- const context = await getArchitecturalContext({
203
- projectPath: "/path/to/project",
204
- focusAreas: ["security", "scalability", "maintainability"]
205
- });
206
- ```
207
-
208
- ### ADR Generation from Requirements
209
- ```typescript
210
- // Convert PRD to structured ADRs
94
+ // Generate ADRs from requirements
211
95
  const adrs = await generateAdrsFromPrd({
212
- prdPath: "docs/PRD.md",
213
- outputDirectory: "docs/adrs",
214
- template: "nygard"
215
- });
216
-
217
- // Generate actionable todos from ADRs with enhanced TDD approach
218
- const todos = await generateAdrTodo({
219
- adrDirectory: "docs/adrs",
220
- outputPath: "todo.md",
221
- phase: "both", // Two-phase TDD: test + production
222
- linkAdrs: true, // Link all ADRs for system-wide coverage
223
- includeRules: true // Include architectural rules validation
224
- });
225
- ```
226
-
227
- ### Enhanced TDD Workflow
228
- ```typescript
229
- // Phase 1: Generate comprehensive test specifications
230
- const testPhase = await generateAdrTodo({
231
- adrDirectory: "docs/adrs",
232
- outputPath: "todo-tests.md",
233
- phase: "test", // Generate mock test specifications
234
- linkAdrs: true, // Connect all ADRs for complete test coverage
235
- includeRules: true // Validate against architectural rules
236
- });
237
-
238
- // Phase 2: Generate production implementation tasks
239
- const prodPhase = await generateAdrTodo({
240
- adrDirectory: "docs/adrs",
241
- outputPath: "todo-implementation.md",
242
- phase: "production", // Generate production-ready implementation tasks
243
- linkAdrs: true, // Ensure system-wide consistency
244
- includeRules: true // Enforce architectural compliance
245
- });
246
-
247
- // Validate progress and detect mock vs production code
248
- const validation = await compareAdrProgress({
249
- todoPath: "todo.md",
250
- adrDirectory: "docs/adrs",
251
- projectPath: "/path/to/project",
252
- deepCodeAnalysis: true, // Distinguish mock from production code
253
- functionalValidation: true, // Validate code actually works
254
- strictMode: true // Reality-check against LLM overconfidence
255
- });
256
- ```
257
-
258
- ### Security and Compliance
259
- ```typescript
260
- // Analyze and mask sensitive content
261
- const maskedContent = await maskContent({
262
- content: "API_KEY=secret123",
263
- maskingLevel: "strict"
264
- });
265
-
266
- // Validate architectural rules
267
- const validation = await validateRules({
268
- projectPath: "/path/to/project",
269
- ruleSet: "enterprise-security"
270
- });
271
- ```
272
-
273
- ### Research and Documentation
274
- ```typescript
275
- // Generate context-aware research questions
276
- const questions = await generateResearchQuestions({
277
- projectContext: analysis,
278
- focusArea: "microservices-migration"
279
- });
280
-
281
- // Incorporate research findings
282
- const updatedAdrs = await incorporateResearch({
283
- researchFindings: findings,
284
- adrDirectory: "docs/adrs"
285
- });
286
- ```
287
-
288
- ### Advanced Validation & Quality Assurance
289
- ```typescript
290
- // Comprehensive validation with mock detection
291
- const qualityCheck = await compareAdrProgress({
292
- todoPath: "todo.md",
293
- adrDirectory: "docs/adrs",
294
- projectPath: "/path/to/project",
295
-
296
- // Prevent LLM deception about code completeness
297
- deepCodeAnalysis: true, // Detects mock patterns vs real implementation
298
- functionalValidation: true, // Tests if code actually works
299
- strictMode: true, // Reality-check mechanisms
300
-
301
- // Advanced analysis options
302
- includeTestCoverage: true, // Validate test coverage meets ADR goals
303
- validateDependencies: true, // Check cross-ADR dependencies
304
- environmentValidation: true // Test in realistic environments
305
- });
306
-
307
- // Generate architectural rules from ADRs and patterns
308
- const rules = await generateRules({
309
- source: "both", // Extract from ADRs and code patterns
310
- adrDirectory: "docs/adrs",
311
- projectPath: "/path/to/project",
312
- outputFormat: "json" // Machine-readable format
313
- });
96
+ prdPath: 'docs/PRD.md',
97
+ outputDirectory: 'docs/adrs',
98
+ });
99
+
100
+ // Smart Code Linking - Find code related to ADR decisions
101
+ const relatedCode = await findRelatedCode(
102
+ 'docs/adrs/001-auth-system.md',
103
+ 'We will implement JWT authentication with Express middleware',
104
+ '/path/to/project',
105
+ {
106
+ useAI: true, // AI-powered keyword extraction
107
+ useRipgrep: true, // Fast text search
108
+ maxFiles: 10, // Limit results
109
+ includeContent: true, // Include file contents
110
+ }
111
+ );
314
112
  ```
315
113
 
316
- ### Deployment Readiness & Safety
317
- ```typescript
318
- // Comprehensive deployment validation with zero tolerance
319
- const deploymentCheck = await deploymentReadiness({
320
- operation: "full_audit",
321
- projectPath: "/path/to/project",
322
- targetEnvironment: "production",
323
-
324
- // Test validation (zero tolerance by default)
325
- maxTestFailures: 0, // Hard block on any test failures
326
- requireTestCoverage: 80, // Minimum coverage requirement
327
- blockOnFailingTests: true, // Prevent deployment with failing tests
328
-
329
- // Deployment history validation
330
- maxRecentFailures: 2, // Max recent deployment failures
331
- deploymentSuccessThreshold: 80, // Required success rate
332
- rollbackFrequencyThreshold: 20, // Max rollback frequency
333
-
334
- // Integration options
335
- integrateTodoTasks: true, // Auto-create blocking tasks
336
- updateHealthScoring: true, // Update project metrics
337
- strictMode: true // Enable all safety checks
338
- });
339
-
340
- // Enhanced git push with deployment readiness
341
- const pushResult = await smartGitPush({
342
- message: "Deploy feature X",
343
- branch: "main",
344
-
345
- // Deployment readiness integration
346
- checkDeploymentReadiness: true, // Validate before push
347
- enforceDeploymentReadiness: true, // Hard block on issues
348
- targetEnvironment: "production", // Environment-specific checks
349
- strictDeploymentMode: true // Maximum safety
350
- });
351
-
352
- // Emergency override for critical fixes
353
- const override = await deploymentReadiness({
354
- operation: "emergency_override",
355
- businessJustification: "Critical security patch - CVE-2024-XXXX",
356
- approvalRequired: true
357
- });
358
- ```
114
+ 📖 **[Complete Usage Guide →](docs/tutorials/)** | **[API Reference →](docs/reference/)**
359
115
 
360
116
  ## 🎯 Use Cases
361
117
 
362
- ### 👨‍💻 **AI Coding Assistants**
363
- *Enhance AI coding assistants like Cline, Cursor, and Claude Code*
364
-
365
- - **Test-Driven Development**: Two-phase TDD workflow with comprehensive ADR integration
366
- - **Intelligent Code Generation**: Generate code that follows architectural patterns and best practices
367
- - **Mock vs Production Detection**: Prevent AI assistants from claiming mock code is production-ready
368
- - **Architecture-Aware Refactoring**: Refactor code while maintaining architectural integrity
369
- - **Decision Documentation**: Automatically document architectural decisions as you code
370
- - **Pattern Recognition**: Identify and suggest architectural patterns for new features
371
- - **Quality Validation**: Reality-check mechanisms against overconfident AI assessments
372
-
373
- ### 💬 **Conversational AI Assistants**
374
- *Enhance chatbots and business agents with architectural intelligence*
375
-
376
- - **Technical Documentation**: Answer questions about system architecture and design decisions
377
- - **Compliance Checking**: Verify that proposed changes meet architectural standards
378
- - **Knowledge Synthesis**: Combine information from multiple sources for comprehensive answers
379
- - **Decision Support**: Provide data-driven recommendations for architectural choices
380
-
381
- ### 🤖 **Autonomous Development Agents**
382
- *Enable autonomous agents to understand and work with complex architectures*
383
-
384
- - **Automated Analysis**: Continuously analyze codebases for architectural drift
385
- - **Rule Enforcement**: Automatically enforce architectural rules and patterns
386
- - **Documentation Generation**: Generate and maintain architectural documentation
387
- - **Deployment Validation**: Verify deployment readiness and compliance
388
-
389
- ### 🏢 **Enterprise Architecture Management**
390
- *Support enterprise architects and development teams*
118
+ 👨‍💻 **AI Coding Assistants** - Enhance Claude, Cline, Cursor with architectural intelligence
119
+ 💬 **Conversational AI** - Answer architecture questions with confidence scoring
120
+ 🤖 **Autonomous Agents** - Continuous analysis and rule enforcement
121
+ 🏢 **Enterprise Teams** - Portfolio analysis and migration planning
391
122
 
392
- - **Portfolio Analysis**: Analyze multiple projects for consistency and compliance
393
- - **Migration Planning**: Plan and track architectural migrations and modernization
394
- - **Risk Assessment**: Identify architectural risks and technical debt
395
- - **Standards Enforcement**: Ensure compliance with enterprise architectural standards
123
+ 📖 **[Detailed Use Cases →](docs/explanation/mcp-concepts.md)**
396
124
 
397
125
  ## 🛠️ Technology Stack
398
126
 
399
- - **Runtime**: Node.js (>=18.0.0)
400
- - **Language**: TypeScript with strict configuration
401
- - **Core Framework**: @modelcontextprotocol/sdk
402
- - **Validation**: Zod schemas for all data structures
403
- - **Testing**: Jest with >80% coverage target
404
- - **Linting**: ESLint with comprehensive rules
405
- - **Build**: TypeScript compiler with incremental builds
406
- - **CI/CD**: GitHub Actions with automated testing and publishing
127
+ **Runtime:** Node.js 18+ • **Language:** TypeScript • **Framework:** MCP SDK • **Testing:** Jest (>80% coverage)
128
+ **Search:** ripgrep + fast-glob • **AI Integration:** OpenRouter.ai • **Code Analysis:** Smart Code Linking
407
129
 
408
- ## � Project Structure
130
+ 📖 **[Technical Details →](docs/explanation/server-architecture.md)**
131
+
132
+ ## 📁 Project Structure
409
133
 
410
134
  ```
411
- mcp-adr-analysis-server/
412
- ├── src/
413
- │ ├── index.ts # Main MCP server entry point
414
- │ ├── tools/ # MCP tool implementations (23 tools)
415
- │ ├── resources/ # MCP resource implementations
416
- │ ├── prompts/ # MCP prompt implementations
417
- │ ├── types/ # TypeScript interfaces & schemas
418
- │ ├── utils/ # Utility functions and helpers
419
- │ └── cache/ # Intelligent caching system
420
- ├── docs/
421
- │ ├── adrs/ # Architectural Decision Records
422
- │ ├── research/ # Research findings and templates
423
- │ └── NPM_PUBLISHING.md # NPM publishing guide
424
- ├── tests/ # Comprehensive test suite
425
- ├── .github/workflows/ # CI/CD automation
426
- ├── scripts/ # Build and deployment scripts
427
- └── dist/ # Compiled JavaScript output
135
+ src/tools/ # 23 MCP tools for analysis
136
+ docs/adrs/ # Architectural Decision Records
137
+ tests/ # >80% test coverage
138
+ .github/ # CI/CD automation
428
139
  ```
429
140
 
141
+ 📖 **[Full Structure →](docs/diataxis-index.md)**
142
+
430
143
  ## 🧪 Testing
431
144
 
432
145
  ```bash
433
- # Run all tests
434
- npm test
435
-
436
- # Run tests with coverage
437
- npm run test:coverage
438
-
439
- # Run tests in watch mode
440
- npm run test:watch
441
-
442
- # Test MCP server functionality
443
- npm run test:package
146
+ npm test # Run all tests (>80% coverage)
147
+ npm run test:coverage # Coverage report
444
148
  ```
445
149
 
446
- ### Test Coverage
447
- - **Unit Tests**: Individual component testing with >80% coverage
448
- - **Integration Tests**: MCP protocol and file system testing
449
- - **Custom Matchers**: ADR and schema validation helpers
450
- - **Performance Tests**: Caching and optimization validation
150
+ 📖 **[Testing Guide →](docs/how-to-guides/troubleshooting.md)**
451
151
 
452
152
  ## 🔧 Development
453
153
 
454
- ### Prerequisites
455
- - Node.js >= 18.0.0
456
- - npm or yarn
457
- - Git
458
-
459
- ### Setup
460
154
  ```bash
461
- # Clone the repository
462
155
  git clone https://github.com/tosin2013/mcp-adr-analysis-server.git
463
156
  cd mcp-adr-analysis-server
464
-
465
- # Install dependencies
466
- npm install
467
-
468
- # Build the project
469
- npm run build
470
-
471
- # Run tests
472
- npm test
473
-
474
- # Start development server
475
- npm run dev
476
- ```
477
-
478
- ### Available Scripts
479
- ```bash
480
- npm run build # Build TypeScript to JavaScript
481
- npm run dev # Start development server with hot reload
482
- npm test # Run Jest tests with coverage
483
- npm run lint # Run ESLint checks
484
- npm run lint:fix # Fix ESLint issues automatically
485
- npm run clean # Clean build artifacts and cache
486
- npm run format # Format code with Prettier
487
- npm run typecheck # Run TypeScript type checking
488
- ```
489
-
490
- ### Pre-Commit Hook
491
- The repository includes an automated pre-commit hook that ensures code quality:
492
-
493
- ```bash
494
- # The hook is automatically installed in .git/hooks/pre-commit
495
- # It runs automatically on every commit and checks:
496
-
497
- # ✅ TypeScript compilation
498
- # ✅ Related tests (or smoke test fallback)
499
- # ✅ Code formatting (Prettier)
500
- # ✅ Only processes staged TypeScript/JavaScript files
501
-
502
- # If checks fail, the commit is blocked with clear error messages:
503
- # • TypeScript errors: Fix compilation issues
504
- # • Test failures: Address failing tests
505
- # • Formatting issues: Run 'npm run format' to auto-fix
506
-
507
- # For comprehensive pre-release validation:
508
- ./scripts/pre-commit-checklist.sh
509
- ```
510
-
511
- ### Code Quality Standards
512
- - **TypeScript**: Strict mode with comprehensive type checking
513
- - **ESLint**: Enforced code quality and security rules
514
- - **Testing**: Jest with custom matchers for ADR validation
515
- - **Coverage**: Minimum 80% test coverage required
516
- - **Security**: Content masking and secret prevention
517
- - **MCP Compliance**: Strict adherence to Model Context Protocol specification
518
-
519
-
520
-
521
- ## 🚀 Getting Started
522
-
523
- ### Quick Start (3 Steps)
524
-
525
- 1. **Install**: `npm install -g mcp-adr-analysis-server`
526
- 2. **Get API Key**: Visit [https://openrouter.ai/keys](https://openrouter.ai/keys)
527
- 3. **Configure Claude Desktop**: Add to your configuration:
528
-
529
- ```json
530
- {
531
- "mcpServers": {
532
- "adr-analysis": {
533
- "command": "mcp-adr-analysis-server",
534
- "env": {
535
- "PROJECT_PATH": "/path/to/your/project",
536
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
537
- "EXECUTION_MODE": "full",
538
- "AI_MODEL": "anthropic/claude-3-sonnet"
539
- }
540
- }
541
- }
542
- }
543
- ```
544
-
545
- 4. **Restart Claude Desktop** and start getting AI-powered architectural insights!
546
-
547
- ### Example Usage
548
-
549
- Once configured, you can ask Claude:
550
-
551
- > "Analyze this React project's architecture and suggest ADRs for any implicit decisions"
552
-
553
- > "Generate ADRs from the PRD.md file and create a todo.md with implementation tasks"
554
-
555
- > "Check this codebase for security issues and provide masking recommendations"
556
-
557
- The server will now return **actual analysis results** instead of prompts to submit elsewhere!
558
-
559
- ## 🚀 Complete Development Lifecycle
560
-
561
- The MCP server now provides a **complete development lifecycle assistant** with intelligent workflow guidance:
562
-
563
- ### **🎯 Step 1: Get Workflow Guidance**
564
- ```
565
- get_workflow_guidance
566
- ```
567
- **Parameters:**
568
- ```json
569
- {
570
- "goal": "analyze new project and set up architectural documentation",
571
- "projectContext": "new_project",
572
- "availableAssets": ["codebase"],
573
- "timeframe": "thorough_review"
574
- }
575
- ```
576
-
577
- **Result**: Intelligent tool sequence recommendations and workflow guidance.
578
-
579
- ### **🏗️ Step 2: Get Development Guidance**
580
- ```
581
- get_development_guidance
582
- ```
583
- **Parameters:**
584
- ```json
585
- {
586
- "developmentPhase": "implementation",
587
- "adrsToImplement": ["ADR-001: API Design", "ADR-002: Database Schema"],
588
- "technologyStack": ["TypeScript", "React", "Node.js"],
589
- "teamContext": {"size": "small_team", "experienceLevel": "mixed"}
590
- }
157
+ npm install && npm run build && npm test
591
158
  ```
592
159
 
593
- **Result**: Specific coding tasks, implementation patterns, and development roadmap.
594
-
595
- ### **📊 Step 3: Execute Recommended Tools**
596
- Follow the workflow guidance to execute the recommended tool sequence for your specific goals.
597
-
598
- ### **🔄 Complete Workflow Examples**
160
+ **Quality Standards:** TypeScript strict mode • ESLint • >80% test coverage • Pre-commit hooks
599
161
 
600
- #### **New Project Setup**
601
- 1. `get_workflow_guidance` → 2. `analyze_project_ecosystem` → 3. `get_architectural_context` → 4. `suggest_adrs` → 5. `get_development_guidance`
162
+ 📖 **[Development Guide →](docs/how-to-guides/getting-started-workflow-guidance.md)** | **[Contributing →](CONTRIBUTING.md)**
602
163
 
603
- #### **Existing Project Analysis**
604
- 1. `get_workflow_guidance` → 2. `discover_existing_adrs` (initializes cache) → 3. `get_architectural_context` → 4. `generate_adr_todo` → 5. `get_development_guidance`
164
+ ## 🔧 Troubleshooting
605
165
 
606
- #### **Security Audit**
607
- 1. `get_workflow_guidance` → 2. `analyze_content_security` → 3. `generate_content_masking` → 4. `validate_content_masking`
166
+ **Common Issues:**
608
167
 
609
- ### Configuration Examples
610
-
611
- #### Example 1: AI-Powered Project Analysis
612
- ```json
613
- {
614
- "mcpServers": {
615
- "adr-analysis": {
616
- "command": "mcp-adr-analysis-server",
617
- "env": {
618
- "PROJECT_PATH": "/Users/username/my-react-app",
619
- "ADR_DIRECTORY": "docs/decisions",
620
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
621
- "EXECUTION_MODE": "full",
622
- "AI_MODEL": "anthropic/claude-3-sonnet",
623
- "AI_TEMPERATURE": "0.1",
624
- "LOG_LEVEL": "INFO"
625
- }
626
- }
627
- }
628
- }
629
- ```
168
+ - **RHEL Systems**: Use special installer script
169
+ - **Tools return prompts**: Set `EXECUTION_MODE=full` + API key
170
+ - **Module not found**: Run `npm install && npm run build`
171
+ - **Permission denied**: Check file permissions and project path
630
172
 
631
- #### Example 2: Cost-Effective Setup
632
- ```json
633
- {
634
- "mcpServers": {
635
- "adr-analysis": {
636
- "command": "mcp-adr-analysis-server",
637
- "env": {
638
- "PROJECT_PATH": "/Users/username/my-project",
639
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
640
- "EXECUTION_MODE": "full",
641
- "AI_MODEL": "anthropic/claude-3-haiku",
642
- "AI_MAX_TOKENS": "2000",
643
- "AI_TEMPERATURE": "0.05"
644
- }
645
- }
646
- }
647
- }
648
- ```
649
-
650
- #### Example 3: Prompt-Only Mode (Legacy)
651
- ```json
652
- {
653
- "mcpServers": {
654
- "adr-analysis": {
655
- "command": "mcp-adr-analysis-server",
656
- "env": {
657
- "PROJECT_PATH": "/Users/username/my-project",
658
- "EXECUTION_MODE": "prompt-only",
659
- "LOG_LEVEL": "INFO"
660
- }
661
- }
662
- }
663
- }
664
- ```
665
-
666
- #### Example 4: Multi-Project Setup
667
- ```json
668
- {
669
- "mcpServers": {
670
- "adr-analysis-frontend": {
671
- "command": "mcp-adr-analysis-server",
672
- "env": {
673
- "PROJECT_PATH": "/Users/username/frontend-app",
674
- "ADR_DIRECTORY": "docs/adrs",
675
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
676
- "EXECUTION_MODE": "full",
677
- "AI_MODEL": "openai/gpt-4o-mini",
678
- "LOG_LEVEL": "ERROR"
679
- }
680
- },
681
- "adr-analysis-backend": {
682
- "command": "mcp-adr-analysis-server",
683
- "env": {
684
- "PROJECT_PATH": "/Users/username/backend-api",
685
- "ADR_DIRECTORY": "architecture/decisions",
686
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
687
- "EXECUTION_MODE": "full",
688
- "AI_MODEL": "anthropic/claude-3-sonnet",
689
- "LOG_LEVEL": "DEBUG"
690
- }
691
- }
692
- }
693
- }
694
- ```
695
-
696
- #### Example 5: Development Environment
697
- ```json
698
- {
699
- "mcpServers": {
700
- "adr-analysis": {
701
- "command": "mcp-adr-analysis-server",
702
- "env": {
703
- "PROJECT_PATH": "${workspaceFolder}",
704
- "ADR_DIRECTORY": "docs/adrs",
705
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
706
- "EXECUTION_MODE": "full",
707
- "AI_MODEL": "anthropic/claude-3-haiku",
708
- "AI_CACHE_ENABLED": "true",
709
- "AI_CACHE_TTL": "1800",
710
- "LOG_LEVEL": "DEBUG"
711
- }
712
- }
713
- }
714
- }
715
- ```
173
+ 📖 **[Complete Troubleshooting Guide →](docs/troubleshooting.md)**
716
174
 
175
+ ## 🔒 Security & Performance
717
176
 
177
+ **Security:** Automatic secret detection • Content masking • Local processing • Zero trust
178
+ **Performance:** Multi-level caching • Incremental analysis • Parallel processing • Memory optimization
718
179
 
719
- ## � Troubleshooting
720
-
721
- ### 🔴 **RHEL 9/10 Specific Issues**
722
-
723
- **Problem**: "Command 'mcp-adr-analysis-server' not found" on RHEL systems
724
-
725
- **Root Cause**: RHEL has specific npm global installation and PATH issues due to SELinux policies and default npm configuration.
726
-
727
- **Solution**: Use the RHEL-specific installer:
728
- ```bash
729
- curl -sSL https://raw.githubusercontent.com/tosin2013/mcp-adr-analysis-server/main/scripts/install-rhel.sh | bash
730
- ```
731
-
732
- **Manual Fix for RHEL**:
733
- ```bash
734
- # Fix npm prefix for user directory
735
- mkdir -p ~/.npm-global
736
- npm config set prefix ~/.npm-global
737
-
738
- # Add to PATH
739
- echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
740
- source ~/.bashrc
741
-
742
- # Reinstall
743
- npm install -g mcp-adr-analysis-server
744
- ```
745
-
746
- **RHEL MCP Configuration**:
747
- If the command is still not found, use the npx approach:
748
- ```json
749
- {
750
- "mcpServers": {
751
- "adr-analysis": {
752
- "command": "npx",
753
- "args": ["mcp-adr-analysis-server"],
754
- "env": {
755
- "PROJECT_PATH": "/path/to/your/project",
756
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
757
- "EXECUTION_MODE": "full",
758
- "AI_MODEL": "anthropic/claude-3-sonnet",
759
- "ADR_DIRECTORY": "docs/adrs",
760
- "LOG_LEVEL": "ERROR"
761
- }
762
- }
763
- }
764
- }
765
- ```
766
-
767
- ### ⚠️ **CRITICAL**: Tools Return Prompts Instead of Results
768
-
769
- **Symptom**: When calling tools like `suggest_adrs`, you receive large detailed instructions and prompts instead of actual ADR suggestions.
770
-
771
- **Root Cause**: AI execution is not properly configured. The tool is falling back to prompt-only mode.
772
-
773
- **Solution**: Add these **required** environment variables to your MCP configuration:
774
-
775
- ```json
776
- {
777
- "mcpServers": {
778
- "adr-analysis": {
779
- "command": "mcp-adr-analysis-server",
780
- "env": {
781
- "PROJECT_PATH": "/path/to/your/project",
782
- "OPENROUTER_API_KEY": "your_openrouter_api_key_here",
783
- "EXECUTION_MODE": "full",
784
- "AI_MODEL": "anthropic/claude-3-sonnet"
785
- }
786
- }
787
- }
788
- }
789
- ```
790
-
791
- **Verification**: After adding these variables and restarting, tools should return actual results like:
792
- - `suggest_adrs` → Actual ADR suggestions with titles and reasoning
793
- - `analyze_project_ecosystem` → Real technology analysis and recommendations
794
- - `generate_content_masking` → Actual masked content, not masking instructions
795
-
796
- **Quick Diagnostic**: Use the built-in diagnostic tool:
797
- ```
798
- check_ai_execution_status
799
- ```
800
- This will show exactly what's wrong with your configuration and provide step-by-step fix instructions.
801
-
802
- ### Other AI Execution Issues
803
-
804
- **Problem**: "AI execution not available" errors
805
- ```bash
806
- # Check execution mode
807
- echo $EXECUTION_MODE
808
-
809
- # Verify API key is set
810
- echo $OPENROUTER_API_KEY | head -c 10
811
-
812
- # Test AI connectivity
813
- curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \
814
- https://openrouter.ai/api/v1/models
815
- ```
816
-
817
- **Problem**: "AI execution not available" errors
818
- - ✅ Verify `OPENROUTER_API_KEY` is set correctly
819
- - ✅ Check `EXECUTION_MODE=full` in environment
820
- - ✅ Ensure API key has sufficient credits
821
- - ✅ Verify network connectivity to OpenRouter
822
-
823
- **Problem**: Slow AI responses
824
- ```bash
825
- # Reduce token limits for faster responses
826
- AI_MAX_TOKENS=2000
827
- AI_TEMPERATURE=0.05
828
-
829
- # Enable caching for repeated queries
830
- AI_CACHE_ENABLED=true
831
- AI_CACHE_TTL=3600
832
- ```
833
-
834
- **Problem**: High API costs
835
- ```bash
836
- # Use cost-effective models
837
- AI_MODEL=anthropic/claude-3-haiku
838
- # or
839
- AI_MODEL=openai/gpt-4o-mini
840
-
841
- # Reduce token usage
842
- AI_MAX_TOKENS=2000
843
- AI_TEMPERATURE=0.1
844
- ```
845
-
846
- ### Environment Configuration
847
-
848
- **Check current configuration:**
849
- ```bash
850
- # View AI execution status
851
- node -e "
852
- const { getAIExecutionStatus } = require('./dist/utils/prompt-execution.js');
853
- console.log(JSON.stringify(getAIExecutionStatus(), null, 2));
854
- "
855
- ```
856
-
857
- **Reset configuration:**
858
- ```bash
859
- # Clear cache and restart
860
- rm -rf .mcp-adr-cache
861
- npm run build
862
- ```
863
-
864
- ### Common Issues
865
-
866
- | Issue | Solution |
867
- |-------|----------|
868
- | "Module not found" errors | Run `npm install && npm run build` |
869
- | TypeScript compilation errors | Check Node.js version >= 18.0.0 |
870
- | Permission denied | Check file permissions and project path |
871
- | API rate limits | Reduce `AI_MAX_TOKENS` or increase `AI_TIMEOUT` |
872
- | Cache issues | Clear cache with `rm -rf .mcp-adr-cache` |
873
-
874
- ## �🔒 Security Features
875
-
876
- ### Content Protection
877
- - **Automatic Secret Detection**: Identifies API keys, passwords, and sensitive data
878
- - **Intelligent Masking**: Context-aware content masking with configurable levels
879
- - **Security Validation**: Comprehensive security checks and recommendations
880
- - **Compliance Tracking**: Ensure adherence to security standards and best practices
881
-
882
- ### Privacy & Data Handling
883
- - **Local Processing**: All analysis performed locally, no data sent to external services
884
- - **Configurable Masking**: Customize masking rules for your organization's needs
885
- - **Audit Trail**: Track all security-related actions and decisions
886
- - **Zero Trust**: Assume all content may contain sensitive information
887
-
888
- ## 📊 Performance & Scalability
889
-
890
- ### Intelligent Caching
891
- - **Multi-level Caching**: File system, memory, and analysis result caching
892
- - **Cache Invalidation**: Smart cache invalidation based on file changes
893
- - **Performance Optimization**: Optimized for large codebases and complex projects
894
- - **Resource Management**: Efficient memory and CPU usage
895
-
896
- ### Scalability Features
897
- - **Incremental Analysis**: Only analyze changed files and dependencies
898
- - **Parallel Processing**: Multi-threaded analysis for large projects
899
- - **Memory Optimization**: Efficient memory usage for large codebases
900
- - **Streaming Results**: Stream analysis results for real-time feedback
180
+ 📖 **[Security Guide →](docs/explanation/security-philosophy.md)** | **[Performance →](docs/explanation/performance-design.md)**
901
181
 
902
182
  ## 🤝 Contributing
903
183
 
904
- We welcome contributions! This project follows strict development standards to ensure quality and security.
905
-
906
- ### Development Standards
907
- - **TypeScript**: Strict mode with comprehensive type checking
908
- - **Testing**: >80% code coverage with Jest
909
- - **Linting**: ESLint with security-focused rules
910
- - **Security**: All contributions must pass security validation
911
- - **MCP Compliance**: Strict adherence to Model Context Protocol specification
912
-
913
- ### Getting Started
914
- 1. Fork the repository
915
- 2. Create a feature branch
916
- 3. Make your changes with tests
917
- 4. The pre-commit hook will automatically validate your changes
918
- 5. Run the full test suite: `npm test`
919
- 6. For comprehensive validation: `./scripts/pre-commit-checklist.sh`
920
- 7. Submit a pull request
921
-
922
- See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
184
+ We welcome contributions! Fork → Create branch → Add tests → Submit PR
923
185
 
924
- ## 🔗 Related Resources
186
+ **Standards:** TypeScript strict • >80% coverage • ESLint • Security validation • MCP compliance
925
187
 
926
- ### Official Documentation
927
- - [Model Context Protocol Specification](https://modelcontextprotocol.io/)
928
- - [MCP Server Development Guide](https://modelcontextprotocol.io/docs/concepts/servers)
929
- - [TypeScript MCP SDK](https://github.com/modelcontextprotocol/typescript-sdk)
188
+ 📖 **[Contributing Guide →](CONTRIBUTING.md)**
930
189
 
931
- ### Community Resources
932
- - [MCP Servers Registry](https://github.com/modelcontextprotocol/servers)
933
- - [Awesome MCP Servers](https://github.com/punkpeye/awesome-mcp-servers)
934
- - [MCP Community Discord](https://discord.gg/modelcontextprotocol)
190
+ ## 🔗 Resources
935
191
 
936
- ### Project Documentation
937
- - [Implementation Progress](./todo.md)
938
- - [Architecture Decisions](./docs/adrs/)
939
- - [NPM Publishing Guide](./docs/NPM_PUBLISHING.md)
192
+ **Official:** [MCP Specification](https://modelcontextprotocol.io/) • [MCP SDK](https://github.com/modelcontextprotocol/typescript-sdk)
193
+ **Community:** [MCP Registry](https://github.com/modelcontextprotocol/servers) • [Discord](https://discord.gg/modelcontextprotocol)
194
+ **Project:** [ADRs](./docs/adrs/) • [Progress](./docs/release-dashboard.md) • [Publishing Guide](./docs/how-to-guides/NPM_PUBLISHING.md)
940
195
 
941
196
  ## 📄 License
942
197
 
@@ -952,4 +207,4 @@ MIT License - see [LICENSE](LICENSE) file for details.
952
207
 
953
208
  **Built with ❤️ by [Tosin Akinosho](https://github.com/tosin2013) for AI-driven architectural analysis**
954
209
 
955
- *Empowering AI assistants with deep architectural intelligence and decision-making capabilities.*
210
+ _Empowering AI assistants with deep architectural intelligence and decision-making capabilities._