@codacy/codacy-mcp 0.5.9 → 0.6.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.
- package/README.md +30 -28
- package/dist/src/handlers/cliAnalyze.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,13 +45,13 @@ The following tools are available through the Codacy MCP Server:
|
|
|
45
45
|
|
|
46
46
|
Both tools provide comprehensive security analysis including:
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
- SAST (Code scanning)
|
|
49
|
+
- Secrets (Secret scanning)
|
|
50
|
+
- SCA (Dependency scanning)
|
|
51
|
+
- IaC (Infrastructure-as-code scanning)
|
|
52
|
+
- CICD (CI/CD scanning)
|
|
53
|
+
- DAST (Dynamic Application Security Testing)
|
|
54
|
+
- PenTesting (Penetration testing)
|
|
55
55
|
|
|
56
56
|
### Pull Request Analysis
|
|
57
57
|
|
|
@@ -82,9 +82,10 @@ Both tools provide comprehensive security analysis including:
|
|
|
82
82
|
### Requirements
|
|
83
83
|
|
|
84
84
|
Ensure your machine has the following tools installed:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
|
|
86
|
+
- git
|
|
87
|
+
- node.js
|
|
88
|
+
- ensure that the `npx` command runs without issues.
|
|
88
89
|
|
|
89
90
|
### Personal API Access Token
|
|
90
91
|
|
|
@@ -105,7 +106,7 @@ Depending on what you are connecting the MCP Server to, you can use the followin
|
|
|
105
106
|
- Cursor: edit the `.cursor/mcp.json` file to add the following
|
|
106
107
|
- Windsurf: edit the `.codeium/windsurf/mcp_config.json` file to add the following
|
|
107
108
|
- Claude Desktop: edit the `claude_desktop_config.json` file to add the following
|
|
108
|
-
|
|
109
|
+
|
|
109
110
|
```json
|
|
110
111
|
{
|
|
111
112
|
"mcpServers": {
|
|
@@ -113,7 +114,8 @@ Depending on what you are connecting the MCP Server to, you can use the followin
|
|
|
113
114
|
"command": "npx",
|
|
114
115
|
"args": ["-y", "@codacy/codacy-mcp"],
|
|
115
116
|
"env": {
|
|
116
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
117
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>",
|
|
118
|
+
"CODACY_CLI_VERSION": "<VERSION>"
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
}
|
|
@@ -126,23 +128,22 @@ Depending on what you are connecting the MCP Server to, you can use the followin
|
|
|
126
128
|
|
|
127
129
|
```json
|
|
128
130
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"env": {
|
|
139
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
131
|
+
"mcp": {
|
|
132
|
+
"inputs": [],
|
|
133
|
+
"servers": {
|
|
134
|
+
"codacy": {
|
|
135
|
+
"command": "npx",
|
|
136
|
+
"args": ["-y", "@codacy/codacy-mcp"],
|
|
137
|
+
"env": {
|
|
138
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>",
|
|
139
|
+
"CODACY_CLI_VERSION": "<VERSION>"
|
|
142
140
|
}
|
|
141
|
+
}
|
|
143
142
|
}
|
|
143
|
+
}
|
|
144
144
|
}
|
|
145
145
|
```
|
|
146
|
+
|
|
146
147
|
You can open the user settings.json file in:
|
|
147
148
|
|
|
148
149
|
`View > Command Palette > Preferences: Open User Settings (JSON)`
|
|
@@ -153,7 +154,7 @@ Or open the general settings.json file directly, which according to your OS shou
|
|
|
153
154
|
- for Windows: `%APPDATA%\Code\User\settings.json`
|
|
154
155
|
- for Linux: `~/.config/Code/User/settings.json`
|
|
155
156
|
|
|
156
|
-
Don't forget to update the value of `CODACY_ACCOUNT_TOKEN` with your token.
|
|
157
|
+
Don't forget to update the value of `CODACY_ACCOUNT_TOKEN` with your token.
|
|
157
158
|
|
|
158
159
|
2. Make sure you have Agent mode enabled: [vscode://settings/chat.agent.enabled](vscode://settings/chat.agent.enabled)
|
|
159
160
|
|
|
@@ -178,7 +179,8 @@ npm install -g @codacy/codacy-mcp
|
|
|
178
179
|
"command": "/Users/yourusername/.nvm/versions/node/vXX.X.X/bin/node",
|
|
179
180
|
"args": ["/path-to/codacy-mcp/dist/index.js"],
|
|
180
181
|
"env": {
|
|
181
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
182
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>",
|
|
183
|
+
"CODACY_CLI_VERSION": "<VERSION>"
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
}
|
|
@@ -197,7 +199,7 @@ npm run build
|
|
|
197
199
|
|
|
198
200
|
## Codacy-CLI Support (WIP)
|
|
199
201
|
|
|
200
|
-
In order to use the [Codacy-CLI](https://github.com/codacy/codacy-cli-v2), it needs to be installed.
|
|
202
|
+
In order to use the [Codacy-CLI](https://github.com/codacy/codacy-cli-v2), it needs to be installed. Note that the `CODACY_CLI_VERSION` variable is optional, in case you want to use a specific version of our CLI.
|
|
201
203
|
|
|
202
204
|
## License
|
|
203
205
|
|
|
@@ -2,6 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
4
|
const CODACY_ACCOUNT_TOKEN = process.env.CODACY_ACCOUNT_TOKEN;
|
|
5
|
+
const CODACY_CLI_VERSION = process.env.CODACY_CLI_VERSION;
|
|
5
6
|
const CLI_FILE_NAME = 'cli.sh';
|
|
6
7
|
const CLI_FOLDER_NAME = '.codacy';
|
|
7
8
|
const CLI_LOCAL_COMMAND = `${CLI_FOLDER_NAME}/${CLI_FILE_NAME}`;
|
|
@@ -10,7 +11,7 @@ const CLI_GLOBAL_COMMAND = 'codacy-cli';
|
|
|
10
11
|
const MAX_BUFFER_SIZE = 1024 * 1024 * 10;
|
|
11
12
|
const execAsync = (command, options) => {
|
|
12
13
|
return new Promise((resolve, reject) => {
|
|
13
|
-
exec(command
|
|
14
|
+
exec(`${CODACY_CLI_VERSION ? `CODACY_CLI_V2_VERSION=${CODACY_CLI_VERSION} ` : ''}${command}`, {
|
|
14
15
|
cwd: options.rootPath,
|
|
15
16
|
maxBuffer: MAX_BUFFER_SIZE, // To solve: stdout maxBuffer exceeded
|
|
16
17
|
}, (error, stdout, stderr) => {
|