@codacy/codacy-mcp 0.6.14 → 0.6.16
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 +64 -21
- package/dist/src/cli/MacCodacyCli.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
[](https://cursor.com/install-mcp?name=codacy&config=eyJjb21tYW5kIjoibnB4IC15IEBjb2RhY3kvY29kYWN5LW1jcEBsYXRlc3QiLCJlbnYiOnsiQ09EQUNZX0FDQ09VTlRfVE9LRU4iOiI8WW91ciBwZXJzb25hbCB0b2tlbj4ifX0%3D)
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Codacy MCP Server
|
|
6
|
-
|
|
7
2
|
[](https://app.codacy.com/gh/codacy/codacy-mcp-server/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
8
3
|
|
|
4
|
+
|
|
9
5
|
MCP Server for the Codacy API, enabling access to repositories, files, quality, coverage, security and more.
|
|
10
6
|
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
- [Features / Tools](#features--tools)
|
|
10
|
+
- [Repository Setup and Management](#repository-setup-and-management)
|
|
11
|
+
- [Organization and Repository Management](#organization-and-repository-management)
|
|
12
|
+
- [Code Quality and Analysis](#code-quality-and-analysis)
|
|
13
|
+
- [File Management and Analysis](#file-management-and-analysis)
|
|
14
|
+
- [Security Analysis](#security-analysis)
|
|
15
|
+
- [Pull Request Analysis](#pull-request-analysis)
|
|
16
|
+
- [Tool and Pattern Management](#tool-and-pattern-management)
|
|
17
|
+
- [CLI Analysis](#cli-analysis)
|
|
18
|
+
- [Setup](#setup)
|
|
19
|
+
- [Requirements](#requirements)
|
|
20
|
+
- [Personal API Access Token](#personal-api-access-token)
|
|
21
|
+
- [Install](#install)
|
|
22
|
+
- [Cursor, Windsurf, and others](#cursor-windsurf-and-others)
|
|
23
|
+
- [VS Code with Copilot](#vs-code-with-copilot)
|
|
24
|
+
- [Troubleshooting](#troubleshooting)
|
|
25
|
+
- [Contribute](#contribute)
|
|
26
|
+
- [Codacy-CLI Support](#codacy-cli-support)
|
|
27
|
+
- [License](#license)
|
|
28
|
+
|
|
29
|
+
|
|
11
30
|
## Features / Tools
|
|
12
31
|
|
|
13
32
|
The following tools are available through the Codacy MCP Server:
|
|
@@ -105,15 +124,19 @@ Get your Codacy's Account API Token from your [Codacy Account](https://app.codac
|
|
|
105
124
|
|
|
106
125
|
You'll need it later in the setup.
|
|
107
126
|
|
|
108
|
-
###
|
|
127
|
+
### Install
|
|
109
128
|
|
|
110
129
|
In supported IDEs like VS Code, Cursor, and Windsurf, the easiest way to install Codacy's MCP Server is to do it from the Codacy extension. If you haven't yet, install the extension from within your IDE, or from any of the available marketplaces ([Microsoft](https://marketplace.visualstudio.com/items?itemName=codacy-app.codacy), [OpenVSX](https://open-vsx.org/extension/codacy-app/codacy)). From the extension panel, just click on Add Codacy MCP Server. Restart your IDE afterwards.
|
|
111
130
|
|
|
112
131
|
Without the extension, you can still use and install the MCP Server:
|
|
113
132
|
|
|
114
|
-
|
|
133
|
+
#### Cursor, Windsurf, and others
|
|
134
|
+
|
|
135
|
+
You can use the one-click install for Cursor:
|
|
136
|
+
|
|
137
|
+
[](https://cursor.com/install-mcp?name=codacy&config=eyJjb21tYW5kIjoibnB4IC15IEBjb2RhY3kvY29kYWN5LW1jcEBsYXRlc3QiLCJlbnYiOnsiQ09EQUNZX0FDQ09VTlRfVE9LRU4iOiI8WW91ciBwZXJzb25hbCB0b2tlbj4ifX0%3D)
|
|
115
138
|
|
|
116
|
-
|
|
139
|
+
Otherwise, depending on what you are connecting the MCP Server to, you can use the following methods:
|
|
117
140
|
|
|
118
141
|
- Cursor: edit the `.cursor/mcp.json` file to add the following
|
|
119
142
|
- Windsurf: edit the `.codeium/windsurf/mcp_config.json` file to add the following
|
|
@@ -126,15 +149,21 @@ Depending on what you are connecting the MCP Server to, you can use the followin
|
|
|
126
149
|
"command": "npx",
|
|
127
150
|
"args": ["-y", "@codacy/codacy-mcp"],
|
|
128
151
|
"env": {
|
|
129
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
130
|
-
"CODACY_CLI_VERSION": "<VERSION>"
|
|
152
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
131
153
|
}
|
|
132
154
|
}
|
|
133
155
|
}
|
|
134
156
|
}
|
|
135
157
|
```
|
|
136
158
|
|
|
137
|
-
|
|
159
|
+
|
|
160
|
+
#### VS Code with Copilot
|
|
161
|
+
|
|
162
|
+
You can use the one-click install for VS Code:
|
|
163
|
+
|
|
164
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=codacy&inputs=%5B%7B%22id%22%3A%22codacy_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Codacy%20Account%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40codacy%2Fcodacy-mcp%40latest%22%5D%2C%22env%22%3A%7B%22CODACY_ACCOUNT_TOKEN%22%3A%22%24%7Binput%3Acodacy_token%7D%22%7D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=codacy&inputs=%5B%7B%22id%22%3A%22codacy_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Codacy%20Account%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40codacy%2Fcodacy-mcp%40latest%22%5D%2C%22env%22%3A%7B%22CODACY_ACCOUNT_TOKEN%22%3A%22%24%7Binput%3Acodacy_token%7D%22%7D%7D&quality=insiders)
|
|
165
|
+
|
|
166
|
+
Otherwise, if you wish to set it up manually:
|
|
138
167
|
|
|
139
168
|
1. For connecting the MCP Server to Copilot in VS Code, add the following to the global config of the IDE:
|
|
140
169
|
|
|
@@ -147,8 +176,7 @@ Depending on what you are connecting the MCP Server to, you can use the followin
|
|
|
147
176
|
"command": "npx",
|
|
148
177
|
"args": ["-y", "@codacy/codacy-mcp"],
|
|
149
178
|
"env": {
|
|
150
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
151
|
-
"CODACY_CLI_VERSION": "<VERSION>"
|
|
179
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
152
180
|
}
|
|
153
181
|
}
|
|
154
182
|
}
|
|
@@ -174,9 +202,9 @@ Don't forget to update the value of `CODACY_ACCOUNT_TOKEN` with your token.
|
|
|
174
202
|
|
|
175
203
|

|
|
176
204
|
|
|
177
|
-
|
|
205
|
+
## Troubleshooting
|
|
178
206
|
|
|
179
|
-
|
|
207
|
+
### Claude Desktop and NVM
|
|
180
208
|
|
|
181
209
|
When using NVM with Claude Desktop, NPX may not work. You should first install the MCP Server globally, and then use Node directly:
|
|
182
210
|
|
|
@@ -191,17 +219,16 @@ npm install -g @codacy/codacy-mcp
|
|
|
191
219
|
"command": "/Users/yourusername/.nvm/versions/node/vXX.X.X/bin/node",
|
|
192
220
|
"args": ["/path-to/codacy-mcp/dist/index.js"],
|
|
193
221
|
"env": {
|
|
194
|
-
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
195
|
-
"CODACY_CLI_VERSION": "<VERSION>"
|
|
222
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
196
223
|
}
|
|
197
224
|
}
|
|
198
225
|
}
|
|
199
226
|
}
|
|
200
227
|
```
|
|
201
228
|
|
|
202
|
-
##
|
|
229
|
+
## Contribute
|
|
203
230
|
|
|
204
|
-
|
|
231
|
+
To work locally on the MCP Server code, run:
|
|
205
232
|
|
|
206
233
|
```bash
|
|
207
234
|
npm install
|
|
@@ -209,9 +236,25 @@ npm run update-api
|
|
|
209
236
|
npm run build
|
|
210
237
|
```
|
|
211
238
|
|
|
212
|
-
|
|
239
|
+
Then you can test your local instance configuring the MCP Server as follows:
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
"codacy": {
|
|
243
|
+
"command": "/path/to/bin/node",
|
|
244
|
+
"args": [
|
|
245
|
+
"/path/to/codacy-mcp-server/dist/index.js"
|
|
246
|
+
],
|
|
247
|
+
"env": {
|
|
248
|
+
"CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Codacy-CLI Support
|
|
254
|
+
|
|
255
|
+
In order to use the [Codacy-CLI](https://github.com/codacy/codacy-cli-v2), it needs to be installed. Whenever the MCP Server will receive a request to analyze, it will try to install the CLI and initialize it.
|
|
213
256
|
|
|
214
|
-
In
|
|
257
|
+
In case you want to use a specific version of our CLI, send a `CODACY_CLI_VERSION` env variable in the MCP Server configuration.
|
|
215
258
|
|
|
216
259
|
## License
|
|
217
260
|
|
|
@@ -82,9 +82,13 @@ export class MacCodacyCli extends CodacyCli {
|
|
|
82
82
|
async initialize() {
|
|
83
83
|
// Check if the configuration files exist
|
|
84
84
|
const configFilePath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'codacy.yaml');
|
|
85
|
+
const cliConfigFilePath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'cli-config.yaml');
|
|
85
86
|
const toolsFolderPath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'tools-configs');
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
const initFilesOk = fs.existsSync(configFilePath) &&
|
|
88
|
+
fs.existsSync(cliConfigFilePath) &&
|
|
89
|
+
fs.existsSync(toolsFolderPath);
|
|
90
|
+
let needsInitialization = !initFilesOk;
|
|
91
|
+
if (initFilesOk) {
|
|
88
92
|
// Check if the mode matches the current properties
|
|
89
93
|
const cliConfig = fs.readFileSync(path.join(this.rootPath, CODACY_FOLDER_NAME, 'cli-config.yaml'), 'utf-8');
|
|
90
94
|
if ((cliConfig === 'mode: local' && this.repository) ||
|