@codesherlock/codesherlock-alpha-mcp-server 0.0.27 → 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.
- package/.env +0 -1
- package/README.md +331 -56
- package/build/index.js +87 -81
- package/package.json +8 -4
- package/build/handlers/analyzeCommitHandler.d.ts +0 -36
- package/build/handlers/analyzeCommitHandler.d.ts.map +0 -1
- package/build/handlers/analyzeCommitHandler.js +0 -397
- package/build/handlers/analyzeCommitHandler.js.map +0 -1
- package/build/handlers/events.d.ts +0 -7
- package/build/handlers/events.d.ts.map +0 -1
- package/build/handlers/events.js +0 -15
- package/build/handlers/events.js.map +0 -1
- package/build/handlers/resources.d.ts +0 -10
- package/build/handlers/resources.d.ts.map +0 -1
- package/build/handlers/resources.js +0 -14
- package/build/handlers/resources.js.map +0 -1
- package/build/handlers/tools.d.ts +0 -6
- package/build/handlers/tools.d.ts.map +0 -1
- package/build/handlers/tools.js +0 -29
- package/build/handlers/tools.js.map +0 -1
- package/build/index.d.ts +0 -3
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/build/schemas/toolSchemas.d.ts +0 -50
- package/build/schemas/toolSchemas.d.ts.map +0 -1
- package/build/schemas/toolSchemas.js +0 -48
- package/build/schemas/toolSchemas.js.map +0 -1
- package/build/services/backendApiService.d.ts +0 -81
- package/build/services/backendApiService.d.ts.map +0 -1
- package/build/services/backendApiService.js +0 -265
- package/build/services/backendApiService.js.map +0 -1
- package/build/services/commitReviewService.d.ts +0 -71
- package/build/services/commitReviewService.d.ts.map +0 -1
- package/build/services/commitReviewService.js +0 -506
- package/build/services/commitReviewService.js.map +0 -1
- package/build/services/gitService.d.ts +0 -159
- package/build/services/gitService.d.ts.map +0 -1
- package/build/services/gitService.js +0 -778
- package/build/services/gitService.js.map +0 -1
- package/build/services/loggingService.d.ts +0 -64
- package/build/services/loggingService.d.ts.map +0 -1
- package/build/services/loggingService.js +0 -185
- package/build/services/loggingService.js.map +0 -1
- package/build/services/zipService.d.ts +0 -9
- package/build/services/zipService.d.ts.map +0 -1
- package/build/services/zipService.js +0 -47
- package/build/services/zipService.js.map +0 -1
- package/build/tests/analysisFormatter.test.d.ts +0 -2
- package/build/tests/analysisFormatter.test.d.ts.map +0 -1
- package/build/tests/analysisFormatter.test.js +0 -92
- package/build/tests/analysisFormatter.test.js.map +0 -1
- package/build/tests/analyzeCommitHandler.test.d.ts +0 -2
- package/build/tests/analyzeCommitHandler.test.d.ts.map +0 -1
- package/build/tests/analyzeCommitHandler.test.js +0 -111
- package/build/tests/analyzeCommitHandler.test.js.map +0 -1
- package/build/tests/backendApiService.test.d.ts +0 -2
- package/build/tests/backendApiService.test.d.ts.map +0 -1
- package/build/tests/backendApiService.test.js +0 -109
- package/build/tests/backendApiService.test.js.map +0 -1
- package/build/tests/commitReviewService.test.d.ts +0 -2
- package/build/tests/commitReviewService.test.d.ts.map +0 -1
- package/build/tests/commitReviewService.test.js +0 -120
- package/build/tests/commitReviewService.test.js.map +0 -1
- package/build/tests/errorExtractor.test.d.ts +0 -2
- package/build/tests/errorExtractor.test.d.ts.map +0 -1
- package/build/tests/errorExtractor.test.js +0 -61
- package/build/tests/errorExtractor.test.js.map +0 -1
- package/build/tests/loggingService.test.d.ts +0 -2
- package/build/tests/loggingService.test.d.ts.map +0 -1
- package/build/tests/loggingService.test.js +0 -153
- package/build/tests/loggingService.test.js.map +0 -1
- package/build/tests/setup.test.d.ts +0 -2
- package/build/tests/setup.test.d.ts.map +0 -1
- package/build/tests/setup.test.js +0 -7
- package/build/tests/setup.test.js.map +0 -1
- package/build/tests/tools.test.d.ts +0 -2
- package/build/tests/tools.test.d.ts.map +0 -1
- package/build/tests/tools.test.js +0 -58
- package/build/tests/tools.test.js.map +0 -1
- package/build/utils/analysisFormatter.d.ts +0 -40
- package/build/utils/analysisFormatter.d.ts.map +0 -1
- package/build/utils/analysisFormatter.js +0 -97
- package/build/utils/analysisFormatter.js.map +0 -1
- package/build/utils/errorExtractor.d.ts +0 -36
- package/build/utils/errorExtractor.d.ts.map +0 -1
- package/build/utils/errorExtractor.js +0 -178
- 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
|
|
1
|
+
# CodeSherlock MCP Server – Setup & Usage Guide
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
14
|
-
|
|
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
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
### Obtaining Your API Key
|
|
33
|
+
### How to obtain it
|
|
27
34
|
|
|
28
|
-
1. Visit the
|
|
29
|
-
2. Sign in or create an account
|
|
30
|
-
3. Generate a new API key
|
|
31
|
-
4.
|
|
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
|
|
40
|
+
### Important security notes
|
|
34
41
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
64
|
+
#### Steps to Configure
|
|
51
65
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
####
|
|
76
|
+
#### Configuration
|
|
58
77
|
|
|
59
78
|
```json
|
|
60
79
|
{
|
|
61
80
|
"mcpServers": {
|
|
62
81
|
"codesherlock": {
|
|
63
|
-
"name": "CodeSherlock
|
|
64
|
-
"description": "CodeSherlock
|
|
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": [
|
|
85
|
+
"args": [
|
|
86
|
+
"-y",
|
|
87
|
+
"@codesherlock/codesherlock-mcp-server"
|
|
88
|
+
],
|
|
67
89
|
"env": {
|
|
68
|
-
"
|
|
90
|
+
"MCP_API_KEY": "your-api-key-here"
|
|
69
91
|
}
|
|
70
92
|
}
|
|
71
93
|
}
|
|
72
94
|
}
|
|
73
95
|
```
|
|
74
96
|
|
|
75
|
-
|
|
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
|
|
300
|
+
CodeSherlock supports four analysis factors:
|
|
86
301
|
|
|
87
302
|
| Factor | Description |
|
|
88
303
|
|--------|-------------|
|
|
89
|
-
| **
|
|
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
|
-
| **
|
|
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
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
139
|
-
|
|
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
|
-
|
|
146
|
-
|
|
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
|
-
|
|
151
|
-
|
|
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
|
-
|
|
157
|
-
|
|
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.
|