@codesherlock/codesherlock-alpha-mcp-server 0.0.28 → 0.1.3

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 (87) hide show
  1. package/.env +0 -1
  2. package/README.md +331 -56
  3. package/build/index.js +87 -81
  4. package/package.json +7 -2
  5. package/build/handlers/analyzeCommitHandler.d.ts +0 -36
  6. package/build/handlers/analyzeCommitHandler.d.ts.map +0 -1
  7. package/build/handlers/analyzeCommitHandler.js +0 -397
  8. package/build/handlers/analyzeCommitHandler.js.map +0 -1
  9. package/build/handlers/events.d.ts +0 -7
  10. package/build/handlers/events.d.ts.map +0 -1
  11. package/build/handlers/events.js +0 -15
  12. package/build/handlers/events.js.map +0 -1
  13. package/build/handlers/resources.d.ts +0 -10
  14. package/build/handlers/resources.d.ts.map +0 -1
  15. package/build/handlers/resources.js +0 -14
  16. package/build/handlers/resources.js.map +0 -1
  17. package/build/handlers/tools.d.ts +0 -6
  18. package/build/handlers/tools.d.ts.map +0 -1
  19. package/build/handlers/tools.js +0 -29
  20. package/build/handlers/tools.js.map +0 -1
  21. package/build/index.d.ts +0 -3
  22. package/build/index.d.ts.map +0 -1
  23. package/build/index.js.map +0 -1
  24. package/build/schemas/toolSchemas.d.ts +0 -50
  25. package/build/schemas/toolSchemas.d.ts.map +0 -1
  26. package/build/schemas/toolSchemas.js +0 -48
  27. package/build/schemas/toolSchemas.js.map +0 -1
  28. package/build/services/backendApiService.d.ts +0 -81
  29. package/build/services/backendApiService.d.ts.map +0 -1
  30. package/build/services/backendApiService.js +0 -265
  31. package/build/services/backendApiService.js.map +0 -1
  32. package/build/services/commitReviewService.d.ts +0 -71
  33. package/build/services/commitReviewService.d.ts.map +0 -1
  34. package/build/services/commitReviewService.js +0 -506
  35. package/build/services/commitReviewService.js.map +0 -1
  36. package/build/services/gitService.d.ts +0 -159
  37. package/build/services/gitService.d.ts.map +0 -1
  38. package/build/services/gitService.js +0 -778
  39. package/build/services/gitService.js.map +0 -1
  40. package/build/services/loggingService.d.ts +0 -64
  41. package/build/services/loggingService.d.ts.map +0 -1
  42. package/build/services/loggingService.js +0 -185
  43. package/build/services/loggingService.js.map +0 -1
  44. package/build/services/zipService.d.ts +0 -9
  45. package/build/services/zipService.d.ts.map +0 -1
  46. package/build/services/zipService.js +0 -47
  47. package/build/services/zipService.js.map +0 -1
  48. package/build/tests/analysisFormatter.test.d.ts +0 -2
  49. package/build/tests/analysisFormatter.test.d.ts.map +0 -1
  50. package/build/tests/analysisFormatter.test.js +0 -92
  51. package/build/tests/analysisFormatter.test.js.map +0 -1
  52. package/build/tests/analyzeCommitHandler.test.d.ts +0 -2
  53. package/build/tests/analyzeCommitHandler.test.d.ts.map +0 -1
  54. package/build/tests/analyzeCommitHandler.test.js +0 -111
  55. package/build/tests/analyzeCommitHandler.test.js.map +0 -1
  56. package/build/tests/backendApiService.test.d.ts +0 -2
  57. package/build/tests/backendApiService.test.d.ts.map +0 -1
  58. package/build/tests/backendApiService.test.js +0 -109
  59. package/build/tests/backendApiService.test.js.map +0 -1
  60. package/build/tests/commitReviewService.test.d.ts +0 -2
  61. package/build/tests/commitReviewService.test.d.ts.map +0 -1
  62. package/build/tests/commitReviewService.test.js +0 -120
  63. package/build/tests/commitReviewService.test.js.map +0 -1
  64. package/build/tests/errorExtractor.test.d.ts +0 -2
  65. package/build/tests/errorExtractor.test.d.ts.map +0 -1
  66. package/build/tests/errorExtractor.test.js +0 -61
  67. package/build/tests/errorExtractor.test.js.map +0 -1
  68. package/build/tests/loggingService.test.d.ts +0 -2
  69. package/build/tests/loggingService.test.d.ts.map +0 -1
  70. package/build/tests/loggingService.test.js +0 -153
  71. package/build/tests/loggingService.test.js.map +0 -1
  72. package/build/tests/setup.test.d.ts +0 -2
  73. package/build/tests/setup.test.d.ts.map +0 -1
  74. package/build/tests/setup.test.js +0 -7
  75. package/build/tests/setup.test.js.map +0 -1
  76. package/build/tests/tools.test.d.ts +0 -2
  77. package/build/tests/tools.test.d.ts.map +0 -1
  78. package/build/tests/tools.test.js +0 -58
  79. package/build/tests/tools.test.js.map +0 -1
  80. package/build/utils/analysisFormatter.d.ts +0 -40
  81. package/build/utils/analysisFormatter.d.ts.map +0 -1
  82. package/build/utils/analysisFormatter.js +0 -97
  83. package/build/utils/analysisFormatter.js.map +0 -1
  84. package/build/utils/errorExtractor.d.ts +0 -36
  85. package/build/utils/errorExtractor.d.ts.map +0 -1
  86. package/build/utils/errorExtractor.js +0 -178
  87. package/build/utils/errorExtractor.js.map +0 -1
package/.env CHANGED
@@ -3,7 +3,6 @@
3
3
  # Backend API Configuration
4
4
  BACKEND_API_URL=https://api.dev.codesherlock.ai
5
5
 
6
-
7
6
  # Application Insights Configuration
8
7
  APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=9a687b23-0384-4345-abaa-4e7065b0d103;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=9e40bff2-07af-4326-be55-f5dc98e9e9c3"
9
8
 
package/README.md CHANGED
@@ -1,19 +1,28 @@
1
- # CodeSherlock MCP Server - Setup & Usage Guide
1
+ # CodeSherlock MCP Server Setup & Usage Guide
2
2
 
3
- **Key Features:**
4
- - Analyze uncommitted changes (staged and unstaged files)
5
- - Analyze committed changes (from your latest commit)
6
- - Perform security analysis using OWASP Top 10 and CWE frameworks
7
- - Integration with AI assistants like Claude Desktop, Cline, and other MCP-compatible tools
3
+ Configure the Model Context Protocol server once and keep every commit and working tree scan consistent across your team.
8
4
 
9
- ---
5
+ ## Key Features
6
+
7
+ ### Analyze Uncommitted Changes
8
+ Scan staged and unstaged files before you commit so surprises never reach your repo.
9
+
10
+ ### Analyze Committed Changes
11
+ Review your latest commit to spot issues before pushing to remote or opening a PR.
12
+
13
+ ### Security Framework Coverage
14
+ Run checks aligned to OWASP Top 10 and the CWE catalog for focused security feedback.
15
+
16
+ ### Works With Your AI Assistant
17
+ Connects to AI assistants like Claude Code, Cursor, Windsurf, Cline, VS Code and other MCP-compatible tools via a lightweight server.
10
18
 
11
19
  ## Prerequisites
12
20
 
13
- Before you begin, ensure you have:
14
- - Node.js (version [INSERT VERSION HERE]) and npm installed on your system
21
+ Quick checklist to confirm before you start:
22
+
23
+ - Node.js (version 18.0.0 or higher) and npm installed on your system
15
24
  - A Git repository with code you want to analyze
16
- - An AI coding assistant that supports MCP (e.g., Claude Desktop, Cline, or similar)
25
+ - An AI coding assistant that supports MCP (e.g., Claude Code, Cursor, VS Code, Cline, or similar)
17
26
 
18
27
  The CodeSherlock MCP Server is available on the npm registry and can be used directly with `npx`.
19
28
 
@@ -21,58 +30,264 @@ The CodeSherlock MCP Server is available on the npm registry and can be used dir
21
30
 
22
31
  ## Step 1: Get Your API Key
23
32
 
24
- CodeSherlock requires an API key to analyze your code. This API Key is used to authenticate your requests to the CodeSherlock API.
25
-
26
- ### Obtaining Your API Key
33
+ ### How to obtain it
27
34
 
28
- 1. Visit the CodeSherlock API Key page: **[https://codesherlock.ai/mcp-api-key](https://codesherlock.ai/mcp-api-key)**
29
- 2. Sign in or create an account if you haven't already
30
- 3. Generate a new API key
31
- 4. **Copy and store your API key securely** - you'll need to provide it when prompted
35
+ 1. Visit the API key page: [codesherlock.ai/codesherlock-mcp-server/mcp/api/key](https://codesherlock.ai/codesherlock-mcp-server/mcp/api/key)
36
+ 2. Sign in or create an account.
37
+ 3. Generate a new API key.
38
+ 4. Copy and store the key securely—you will be prompted for it by the MCP server.
32
39
 
33
- ### Important Security Notes
40
+ ### Important security notes
34
41
 
35
- - **Never share your API key** with others
36
- - **Never commit your API key** to version control
37
- - Store it in a secure location (password manager recommended)
38
- - If your key is compromised, regenerate it immediately from the CodeSherlock dashboard
42
+ - Never share your API key or commit it to version control.
43
+ - Store it in a password manager or environment variable.
44
+ - If a key is compromised, regenerate it immediately from your dashboard.
39
45
 
40
46
  ---
41
47
 
42
48
  ## Step 2: Configure Your AI Assistant
43
49
 
44
- You need to add the CodeSherlock MCP Server configuration to your AI assistant's settings. Below given are the documentation links for popular AI assistants to setup MCP server:
50
+ You need to add the CodeSherlock MCP Server configuration to your AI assistant's settings. Follow the instructions for your preferred IDE/assistant below.
51
+
52
+ **Quick Navigation:**
53
+ - [Cursor](#cursor)
54
+ - [Antigravity](#antigravity)
55
+ - [Windsurf](#windsurf)
56
+ - [Claude Code](#claude-code)
57
+ - [VS Code - Co Pilot](#vs-code)
58
+ - [Cline](#cline)
59
+
60
+ ---
45
61
 
46
- - [Cluade Code](https://code.claude.com/docs/en/mcp#option-3%3A-add-a-local-stdio-server)
47
- - [Cursor](https://cursor.com/docs/context/mcp#using-mcpjson)
48
- - [VS Code / GitHub Copilot](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
62
+ ### Cursor
49
63
 
50
- <br/>
64
+ #### Steps to Configure
51
65
 
52
- The general pattern is to specify:
53
- - **Command**: `npx`
54
- - **Args**: `[-y, codesherlock-mcp-server]`
55
- - **Server Name**: `codesherlock`
66
+ 1. Click the **Settings** (gear icon) on the top right corner
67
+ 2. Settings panel opens as a new tab in the center of the screen
68
+ 3. In the settings sidebar, navigate to **Tools & MCP** section
69
+ 4. Click on **New MCP Server/Add a custom MCP Server** button
70
+ 5. This opens the `mcp.json` config file
71
+ 6. Add the configuration below and save
72
+ 7. Restart Cursor
73
+ 8. Verify the installation: You should see the **CodeSherlock MCP Server** listed with 1 tools **Enabled** and in the **Tools & MCP** section .
74
+ 9. Troubleshooting installation issues: If CodeSherlock MCP Server does not show up in Cursor under Settings → Tools & MCP, or if it appears there but is not enabled or fails to start, open your system terminal and run npx -y @codesherlock/codesherlock-mcp-server manually. This helps confirm that the package can be downloaded and executed successfully outside of Cursor. If this command fails, the issue is likely related to your local Node.js / npm / npx setup, network access, or package resolution rather than Cursor itself. If the command runs successfully in the terminal but the server still does not work inside Cursor, re-check your mcp.json configuration for formatting issues, save the file again, and restart Cursor before trying once more.
56
75
 
57
- #### MCP Configuration JSON:
76
+ #### Configuration
58
77
 
59
78
  ```json
60
79
  {
61
80
  "mcpServers": {
62
81
  "codesherlock": {
63
- "name": "CodeSherlock alpha MCP Server",
64
- "description": "CodeSherlock delivers deep code analysis and exposes MCP tools for commit analysis and uncommit analysis.",
82
+ "name": "CodeSherlock MCP Server",
83
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
65
84
  "command": "npx",
66
- "args": ["-y", "@codesherlock/codesherlock-alpha-mcp-server"],
85
+ "args": [
86
+ "-y",
87
+ "@codesherlock/codesherlock-mcp-server"
88
+ ],
67
89
  "env": {
68
- "CODESHERLOCK_API_KEY": "your-api-key-here"
90
+ "MCP_API_KEY": "your-api-key-here"
69
91
  }
70
92
  }
71
93
  }
72
94
  }
73
95
  ```
74
96
 
75
- *After adding the configuration, restart your AI assistant to load the MCP server.*
97
+ ---
98
+
99
+ ### Antigravity
100
+
101
+ #### Steps to Configure
102
+
103
+ 1. In the Antigravity agent chat window, click the **three dots (...)** menu.
104
+ 2. This opens the **Manage MCP Servers** page.
105
+ 3. On the Manage MCP Servers page, click **View raw config**.
106
+ 4. Paste the JSON configuration below into the raw config and save.
107
+ 5. Click the **Refresh** button on the same **Manage MCP Servers** page.
108
+ 6. Restart Antigravity if needed.
109
+ 7. Verify the installation: Open the Antigravity chat and you should see the **CodeSherlock MCP Server** tools available when you type `@`. Additionally, you can check the **Manage MCP Servers** page to see if it's listed and connected.
110
+
111
+ #### Configuration
112
+
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "codesherlock": {
117
+ "name": "CodeSherlock MCP Server",
118
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
119
+ "command": "npx",
120
+ "args": [
121
+ "-y",
122
+ "@codesherlock/codesherlock-mcp-server"
123
+ ],
124
+ "env": {
125
+ "MCP_API_KEY": "your-api-key-here"
126
+ }
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ ---
133
+
134
+ ### Windsurf
135
+
136
+ #### Steps to Configure
137
+
138
+ 1. Click on the **Settings** (gear icon) on the top right corner and select **Windsurf Settings** (or press `Ctrl+,`)
139
+ 2. In the settings search box, type **mcp**
140
+ 3. Find the **MCP Servers** section
141
+ 4. Click on **Open MCP Marketplace**
142
+ 5. In the MCP Marketplace, click the **Settings** (gear icon) to add a custom server
143
+ 6. This opens the `mcp_config.json` config file
144
+ 7. Add the configuration below and save
145
+ 8. Restart Windsurf
146
+ 9. Verify the installation: Go to **Windsurf Settings** > **MCP Servers** and ensure the **CodeSherlock MCP Server** is listed and shows a connected or active status.
147
+
148
+ #### Configuration
149
+
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "codesherlock": {
154
+ "name": "CodeSherlock MCP Server",
155
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
156
+ "command": "npx",
157
+ "args": [
158
+ "-y",
159
+ "@codesherlock/codesherlock-mcp-server"
160
+ ],
161
+ "env": {
162
+ "MCP_API_KEY": "your-api-key-here"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ ---
170
+
171
+ ### Claude Code
172
+
173
+ #### Steps to Configure
174
+
175
+ 1. Run the following command in your terminal:
176
+
177
+ ```bash
178
+ claude mcp add --transport stdio codesherlock --env MCP_API_KEY=cs_mcp_abcdef -- cmd /c npx -y @codesherlock/codesherlock-mcp-server
179
+ ```
180
+
181
+ 2. Verify the configuration by running:
182
+
183
+ ```bash
184
+ claude mcp list
185
+ ```
186
+
187
+ 3. If the connection is successful, start Claude. If `claude mcp list` fails to connect, try reopening your terminal as an optional troubleshooting step.
188
+
189
+ **Other useful commands:**
190
+
191
+ ```bash
192
+ claude mcp remove codesherlock # Remove a server
193
+ ```
194
+
195
+ #### Configuration
196
+
197
+ **Manually add to config file (optional):**
198
+
199
+ ```json
200
+ {
201
+ "mcpServers": {
202
+ "codesherlock": {
203
+ "name": "CodeSherlock MCP Server",
204
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
205
+ "command": "npx",
206
+ "args": [
207
+ "-y",
208
+ "@codesherlock/codesherlock-mcp-server"
209
+ ],
210
+ "env": {
211
+ "MCP_API_KEY": "your-api-key-here"
212
+ }
213
+ }
214
+ }
215
+ }
216
+ ```
217
+
218
+ ---
219
+
220
+ ### VS Code
221
+
222
+ #### Steps to Configure
223
+
224
+ *Requires GitHub Copilot extension installed*
225
+
226
+ 1. Press `Ctrl+Shift+P` (Windows) or `Cmd+Shift+P` (macOS) to open Command Palette
227
+ 2. Type **MCP:Open User Configuration**
228
+ 3. This opens the MCP configuration file
229
+ 4. Add the configuration below and save
230
+ 5. Restart VS Code
231
+ 6. Verify the installation: Open the GitHub Copilot Chat panel and type `@`. You should see the **CodeSherlock MCP Server** tools listed and available for use.
232
+
233
+ #### Configuration
234
+
235
+ ```json
236
+ {
237
+ "servers": {
238
+ "codesherlock": {
239
+ "name": "CodeSherlock MCP Server",
240
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
241
+ "command": "npx",
242
+ "args": [
243
+ "-y",
244
+ "@codesherlock/codesherlock-mcp-server"
245
+ ],
246
+ "env": {
247
+ "MCP_API_KEY": "your-api-key-here"
248
+ }
249
+ }
250
+ }
251
+ }
252
+ ```
253
+
254
+ ---
255
+
256
+ ### Cline
257
+
258
+ *Cline is a VS Code extension. Install it from the VS Code marketplace or other supported IDEs.*
259
+
260
+ #### Steps to Configure
261
+
262
+ 1. Open Cline panel in VS Code
263
+ 2. Click on **Manage MCP Servers**
264
+ 3. Click on the **Settings** (gear icon)
265
+ 4. Click on **Configure MCP Servers** button
266
+ 5. This opens the `cline_mcp_settings.json` config file
267
+ 6. Add the configuration below and save
268
+ 7. Restart VS Code
269
+ 8. Verify the installation: Open the Cline panel and go to the **MCP Servers** section. You should see the **CodeSherlock MCP Server** listed with a green status indicator, confirming it is connected and active.
270
+
271
+ #### Configuration
272
+
273
+ ```json
274
+ {
275
+ "mcpServers": {
276
+ "codesherlock": {
277
+ "name": "CodeSherlock MCP Server",
278
+ "description": "CodeSherlock is an AI- based code analysis tool that validates unstaged changes and commits directly inside IDEs and AI Agents. It helps developers catch security, quality, and design issues early by combining deep analysis with compliance-aware checks OWASP, CWE, SOC-2 at the moment code is written. CodeSherlock also performs other security vulnerability reviews along with Maintainability, Reliability and Scalability checks. Use CodeSherlock to review and validate code especially generated via AI.",
279
+ "command": "npx",
280
+ "args": [
281
+ "-y",
282
+ "@codesherlock/codesherlock-mcp-server"
283
+ ],
284
+ "env": {
285
+ "MCP_API_KEY": "your-api-key-here"
286
+ }
287
+ }
288
+ }
289
+ }
290
+ ```
76
291
 
77
292
  ---
78
293
 
@@ -82,34 +297,37 @@ Once configured, you can start using CodeSherlock by prompting your AI assistant
82
297
 
83
298
  ### Analysis Types
84
299
 
85
- CodeSherlock supports three analysis factors:
300
+ CodeSherlock supports four analysis factors:
86
301
 
87
302
  | Factor | Description |
88
303
  |--------|-------------|
89
- | **power analysis** | A A full-spectrum scan that covers the most essential and critical issues |
304
+ | **power_analysis** | A full-spectrum scan that covers the most essential and critical issues |
90
305
  | **owasp** | Security analysis based on OWASP Top 10 vulnerabilities |
91
- | **cwe** | Analyzes code against Common Weakness Enumeration (CWE) framework |
306
+ | **cwe_mitre** | Analyzes code against Common Weakness Enumeration (CWE) MITRE framework |
307
+ | **cwe_kev** | Analyzes code against CWE Known Exploited Vulnerabilities (KEV) catalog |
92
308
 
93
309
  ---
94
310
 
95
311
  ## Example Prompts
96
312
 
97
- Here are practical examples of how to prompt your AI assistant to perform code analysis:
313
+ Drop these into your AI assistant to kick off a scan:
98
314
 
99
315
  ```
100
316
  "Review my uncommitted changes using CodeSherlock"
101
317
  ```
102
318
 
103
319
  ```
104
- "Use CodeSherlock to check my uncommitted code for CWE vulnerabilities"
320
+ "Use CodeSherlock to check my uncommitted code for CWE MITRE vulnerabilities"
105
321
  ```
106
322
 
107
323
  ```
108
324
  "Analyze my latest commit for OWASP vulnerabilities using CodeSherlock"
109
325
  ```
326
+
110
327
  ```
111
- "Check the last commit in my current repo for CWE issues with CodeSherlock"
328
+ "Check the last commit in my current repo for CWE KEV issues with CodeSherlock"
112
329
  ```
330
+
113
331
  ---
114
332
 
115
333
  ## Understanding the Results
@@ -128,52 +346,109 @@ The AI assistant will present the analysis results in a readable format, typical
128
346
 
129
347
  ## Troubleshooting
130
348
 
131
- ### Common Issues
349
+ ### "Server not found" or "MCP server failed to start"
350
+
351
+ If the server does not show up in your IDE or fails to start, follow these steps:
352
+
353
+ 1. **Manual Verification**: Run `npx -y @codesherlock/codesherlock-mcp-server` in your system terminal.
354
+ - **If this fails**: The issue is with your local Node.js/npm configuration or network access, rather than the IDE itself.
355
+ - **If this succeeds**: The issue is likely with your IDE's MCP configuration.
356
+ 2. **Check Configuration**: Ensure your configuration file (e.g., `mcp.json`, `cline_mcp_settings.json`) is valid JSON and matches the format provided in the instructions above.
357
+ 3. **Restart your IDE**: Most AI assistants and IDEs require a full restart to pick up changes in MCP configuration files.
132
358
 
133
- #### "Server not found" or "MCP server failed to start"
134
- **Solution:**
135
359
  - Verify the configuration file path is correct
136
360
  - Check that Node.js and npm are properly installed
137
361
 
138
- #### "Authentication failed" or "Invalid API key"
139
- **Solution:**
362
+ ### "Authentication failed" or "Invalid API key"
363
+
140
364
  - Verify your API key is correctly added to the configuration
141
365
  - Check for any extra spaces or characters in the API key
142
366
  - Regenerate your API key from the CodeSherlock dashboard
143
367
  - Ensure you've restarted your AI assistant after adding the key
144
368
 
145
- #### "Not a Git repository"
146
- **Solution:**
369
+ ### "Not a Git repository"
370
+
147
371
  - Ensure you're analyzing a directory that contains a `.git` folder
148
372
  - Initialize a Git repository if needed: `git init`
149
373
 
150
- #### "No changes to analyze"
151
- **Solution:**
374
+ ### "No changes to analyze"
375
+
152
376
  - For uncommitted analysis: Make sure you have modified files
153
377
  - For commit analysis: Verify the commit exists using `git log`
154
378
  - Check that you're in the correct Git repository
155
379
 
156
- #### Analysis takes too long or times out
157
- **Solution:**
380
+ ### Analysis takes too long or times out
381
+
158
382
  - Start with analyzing specific files or smaller changesets
159
383
  - Check your internet connection
160
384
  - Break large changes into smaller commits for analysis
161
385
 
386
+ ### General MCP host installation/run issues
387
+
388
+ If you encounter errors while installing or running the CodeSherlock MCP Server in any MCP host (Cursor, VS Code, etc.), try the following steps:
389
+
390
+ 1. **Clear NPX cache**
391
+
392
+ Remove the cached package to force a fresh download:
393
+
394
+ - **macOS/Linux**
395
+
396
+ ```bash
397
+ rm -rf ~/.npm/_npx
398
+ ```
399
+
400
+ - **Windows (PowerShell)**
401
+
402
+ ```powershell
403
+ Remove-Item -Recurse -Force "$env:LOCALAPPDATA\npm-cache\_npx"
404
+ ```
405
+
406
+ 2. **Restart the MCP host**
407
+
408
+ Close and reopen your MCP host application (Cursor, VS Code, etc.) to ensure all connections are reset and the server is reloaded properly.
409
+
410
+ 3. **Verify Node.js version**
411
+
412
+ Ensure you have Node.js v18 or higher installed:
413
+
414
+ ```bash
415
+ node --version
416
+ ```
417
+
418
+ 4. **Contact support**
419
+
420
+ If the issue persists after trying the above steps, please contact us at [contact@fintechglobal.center](mailto:contact@fintechglobal.center).
421
+
422
+ ### Debugging NPX Execution
423
+
424
+ If you need to troubleshoot how the MCP client executes the server, understanding the internal `npx` behavior can be helpful:
425
+
426
+ - **Execution Flow:** The MCP client runs `npx -y @codesherlock/codesherlock-mcp-server`. The `-y` flag ensures non-interactive execution by automatically skipping installation prompts.
427
+ - **Cache Location:** `npx` does not install the package globally. Instead, it downloads and caches it temporarily:
428
+ - **Windows:** `%LOCALAPPDATA%\npm-cache\_npx\`
429
+ - **Mac/Linux:** `~/.npm/_npx/`
430
+ - **Executable Resolution:** `npx` reads the downloaded package's `bin` field and maps it to execute `build/index.js` under the hood.
431
+ - **Environment Variables:** The `MCP_API_KEY` configured in your client settings is securely injected into the isolated Node.js process at runtime.
432
+
162
433
  ---
163
434
 
164
435
  ## Best Practices
165
436
 
166
437
  ### 1. Integrate into Your Workflow
438
+
167
439
  - **Before committing**: Analyze uncommitted changes to catch issues early
168
440
  - **After committing**: Review commits before pushing to remote
169
441
  - **During code review**: Use analysis results to supplement manual reviews
170
442
 
171
443
  ### 2. Choose the Right Analysis Factor
444
+
172
445
  - **Use OWASP** Best for web applications and APIs; focuses on the OWASP Top 10 and other common web security risks.
173
- - **Use CWE** Ideal when you need deeper, classification-based coverage of software weaknesses across all domains.
446
+ - **Use CWE MITRE** Ideal when you need deeper, classification-based coverage of software weaknesses across all domains.
447
+ - **Use CWE KEV** Best for identifying known exploited vulnerabilities that are actively being used in attacks.
174
448
  - **Use Power Analysis** A broad, high-coverage analysis designed to catch the most essential and critical issues across any type of project (web, mobile, backend, etc.)
175
449
 
176
450
  ### 3. Act on Results
451
+
177
452
  - Prioritize **Critical** and **High** severity issues immediately
178
453
  - Create tickets for **Medium** severity issues
179
454
  - Document **Low** severity issues for future refactoring
@@ -182,4 +457,4 @@ The AI assistant will present the analysis results in a readable format, typical
182
457
 
183
458
  ## Getting Help
184
459
 
185
- If you face any issues, please send us a mail at [support@codesherlock.ai](mailto:support@codesherlock.ai). We will help you resolve the issue as soon as possible.
460
+ If you face any issues, please send us a mail at [support@codesherlock.ai](mailto:support@codesherlock.ai). We will help you resolve the issue as soon as possible.