@codacy/codacy-mcp 0.5.9 → 0.6.1

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 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
- - 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)
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
- * git
86
- * node.js
87
- * ensure that the `npx` command runs without issues.
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
- "mcp": {
130
- "inputs": [],
131
- "servers": {
132
- "codacy": {
133
- "command": "npx",
134
- "args": [
135
- "-y",
136
- "@codacy/codacy-mcp"
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
 
package/dist/index.js CHANGED
@@ -8,10 +8,6 @@ import * as Handlers from './src/handlers/index.js';
8
8
  import { validateOrganization } from './src/middleware/validation.js';
9
9
  // Check for API key
10
10
  const CODACY_ACCOUNT_TOKEN = process.env.CODACY_ACCOUNT_TOKEN;
11
- if (!CODACY_ACCOUNT_TOKEN) {
12
- console.error('Error: CODACY_ACCOUNT_TOKEN environment variable is required');
13
- process.exit(1);
14
- }
15
11
  OpenAPI.BASE = 'https://app.codacy.com/api/v3';
16
12
  OpenAPI.HEADERS = {
17
13
  'api-token': CODACY_ACCOUNT_TOKEN || '',
@@ -74,7 +70,10 @@ const toolDefinitions = {
74
70
  tool: Tools.listRepositoryPullRequestsTool,
75
71
  handler: Handlers.listRepositoryPullRequestsHandler,
76
72
  },
77
- codacy_list_files: { tool: Tools.listFilesTool, handler: Handlers.listFilesHandler },
73
+ codacy_list_files: {
74
+ tool: Tools.listFilesTool,
75
+ handler: Handlers.listFilesHandler,
76
+ },
78
77
  codacy_get_file_issues: {
79
78
  tool: Tools.listFileIssuesTool,
80
79
  handler: Handlers.getFileIssuesHandler,
@@ -118,6 +117,7 @@ const toolDefinitions = {
118
117
  codacy_get_pattern: {
119
118
  tool: Tools.getPatternTool,
120
119
  handler: Handlers.getPatternHandler,
120
+ noAuth: true,
121
121
  },
122
122
  codacy_list_repository_tool_patterns: {
123
123
  tool: Tools.listRepositoryToolPatternsTool,
@@ -126,6 +126,7 @@ const toolDefinitions = {
126
126
  codacy_list_tools: {
127
127
  tool: Tools.listToolsTool,
128
128
  handler: Handlers.listToolsHandler,
129
+ noAuth: true,
129
130
  },
130
131
  codacy_list_repository_tools: {
131
132
  tool: Tools.listRepositoryToolsTool,
@@ -138,6 +139,7 @@ const toolDefinitions = {
138
139
  codacy_cli_analyze: {
139
140
  tool: Tools.cliAnalyzeTool,
140
141
  handler: Handlers.cliAnalyzeHandler,
142
+ noAuth: true,
141
143
  },
142
144
  codacy_setup_repository: {
143
145
  tool: Tools.setupRepositoryTool,
@@ -146,7 +148,9 @@ const toolDefinitions = {
146
148
  };
147
149
  // Register tools
148
150
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
149
- tools: Object.values(toolDefinitions).map(({ tool }) => tool),
151
+ tools: Object.values(toolDefinitions)
152
+ .filter(({ noAuth }) => CODACY_ACCOUNT_TOKEN || noAuth)
153
+ .map(({ tool }) => tool),
150
154
  }));
151
155
  // Register request handlers
152
156
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
@@ -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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/codacy-mcp",
3
- "version": "0.5.9",
3
+ "version": "0.6.1",
4
4
  "description": "Codacy MCP server",
5
5
  "license": "MIT",
6
6
  "author": "Codacy",