@codacy/codacy-mcp 0.3.7 → 0.3.9

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/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
4
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
5
  import { OpenAPI } from './src/api/client/index.js';
6
- import { getFileCoverageTool, listFileIssuesTool, getPullRequestGitDiffTool, getRepositoryPullRequestFilesCoverageTool, listFilesTool, listOrganizationRepositoriesTool, listPullRequestIssuesTool, listRepositoryPullRequestsTool, searchRepositoryIssuesTool, searchSecurityItemsTool, getRepositoryWithAnalysisTool, getFileWithAnalysisTool, listRepositoryToolsTool, listToolsTool, listRepositoryToolPatternsTool, getPatternTool, getIssueTool, getRepositoryPullRequestTool, listOrganizationsTool, } from './src/tools/index.js';
7
- import { getFileCoverageHandler, getFileIssuesHandler, getPullRequestGitDiffHandler, getRepositoryPullRequestFilesCoverageHandler, listFilesHandler, listPullRequestIssuesHandler, listRepositoryPullRequestsHandler, searchRepositoryIssuesHandler, searchSecurityItemsHandler, listOrganizationRepositoriesHandler, getRepositoryWithAnalysisHandler, getFileWithAnalysisHandler, getRepositoryPullRequestHandler, getIssueHandler, listRepositoryToolPatternsHandler, listRepositoryToolsHandler, listToolsHandler, getPatternHandler, listOrganizationsHandler, } from './src/handlers/index.js';
6
+ import * as Tools from './src/tools/index.js';
7
+ import * as Handlers from './src/handlers/index.js';
8
8
  import { validateOrganization } from './src/middleware/validation.js';
9
9
  OpenAPI.BASE = 'https://app.codacy.com/api/v3';
10
10
  OpenAPI.HEADERS = {
@@ -48,68 +48,77 @@ const server = new Server({
48
48
  });
49
49
  const toolDefinitions = {
50
50
  codacy_list_organization_repositories: {
51
- tool: listOrganizationRepositoriesTool,
52
- handler: listOrganizationRepositoriesHandler,
51
+ tool: Tools.listOrganizationRepositoriesTool,
52
+ handler: Handlers.listOrganizationRepositoriesHandler,
53
+ },
54
+ codacy_list_srm_items: {
55
+ tool: Tools.searchSecurityItemsTool,
56
+ handler: Handlers.searchSecurityItemsHandler,
53
57
  },
54
- codacy_list_srm_items: { tool: searchSecurityItemsTool, handler: searchSecurityItemsHandler },
55
58
  codacy_list_repository_issues: {
56
- tool: searchRepositoryIssuesTool,
57
- handler: searchRepositoryIssuesHandler,
59
+ tool: Tools.searchRepositoryIssuesTool,
60
+ handler: Handlers.searchRepositoryIssuesHandler,
58
61
  },
59
62
  codacy_list_repository_pull_requests: {
60
- tool: listRepositoryPullRequestsTool,
61
- handler: listRepositoryPullRequestsHandler,
63
+ tool: Tools.listRepositoryPullRequestsTool,
64
+ handler: Handlers.listRepositoryPullRequestsHandler,
65
+ },
66
+ codacy_list_files: { tool: Tools.listFilesTool, handler: Handlers.listFilesHandler },
67
+ codacy_get_file_issues: {
68
+ tool: Tools.listFileIssuesTool,
69
+ handler: Handlers.getFileIssuesHandler,
70
+ },
71
+ codacy_get_file_coverage: {
72
+ tool: Tools.getFileCoverageTool,
73
+ handler: Handlers.getFileCoverageHandler,
62
74
  },
63
- codacy_list_files: { tool: listFilesTool, handler: listFilesHandler },
64
- codacy_get_file_issues: { tool: listFileIssuesTool, handler: getFileIssuesHandler },
65
- codacy_get_file_coverage: { tool: getFileCoverageTool, handler: getFileCoverageHandler },
66
75
  codacy_get_repository_pull_request_files_coverage: {
67
- tool: getRepositoryPullRequestFilesCoverageTool,
68
- handler: getRepositoryPullRequestFilesCoverageHandler,
76
+ tool: Tools.getRepositoryPullRequestFilesCoverageTool,
77
+ handler: Handlers.getRepositoryPullRequestFilesCoverageHandler,
69
78
  },
70
79
  codacy_get_pull_request_git_diff: {
71
- tool: getPullRequestGitDiffTool,
72
- handler: getPullRequestGitDiffHandler,
80
+ tool: Tools.getPullRequestGitDiffTool,
81
+ handler: Handlers.getPullRequestGitDiffHandler,
73
82
  },
74
83
  codacy_list_pull_request_issues: {
75
- tool: listPullRequestIssuesTool,
76
- handler: listPullRequestIssuesHandler,
84
+ tool: Tools.listPullRequestIssuesTool,
85
+ handler: Handlers.listPullRequestIssuesHandler,
77
86
  },
78
87
  codacy_get_repository_with_analysis: {
79
- tool: getRepositoryWithAnalysisTool,
80
- handler: getRepositoryWithAnalysisHandler,
88
+ tool: Tools.getRepositoryWithAnalysisTool,
89
+ handler: Handlers.getRepositoryWithAnalysisHandler,
81
90
  },
82
91
  codacy_get_file_with_analysis: {
83
- tool: getFileWithAnalysisTool,
84
- handler: getFileWithAnalysisHandler,
92
+ tool: Tools.getFileWithAnalysisTool,
93
+ handler: Handlers.getFileWithAnalysisHandler,
85
94
  },
86
95
  codacy_get_repository_pull_request: {
87
- tool: getRepositoryPullRequestTool,
88
- handler: getRepositoryPullRequestHandler,
96
+ tool: Tools.getRepositoryPullRequestTool,
97
+ handler: Handlers.getRepositoryPullRequestHandler,
89
98
  },
90
99
  codacy_get_issue: {
91
- tool: getIssueTool,
92
- handler: getIssueHandler,
100
+ tool: Tools.getIssueTool,
101
+ handler: Handlers.getIssueHandler,
93
102
  },
94
103
  codacy_get_pattern: {
95
- tool: getPatternTool,
96
- handler: getPatternHandler,
104
+ tool: Tools.getPatternTool,
105
+ handler: Handlers.getPatternHandler,
97
106
  },
98
107
  codacy_list_repository_tool_patterns: {
99
- tool: listRepositoryToolPatternsTool,
100
- handler: listRepositoryToolPatternsHandler,
108
+ tool: Tools.listRepositoryToolPatternsTool,
109
+ handler: Handlers.listRepositoryToolPatternsHandler,
101
110
  },
102
111
  codacy_list_tools: {
103
- tool: listToolsTool,
104
- handler: listToolsHandler,
112
+ tool: Tools.listToolsTool,
113
+ handler: Handlers.listToolsHandler,
105
114
  },
106
115
  codacy_list_repository_tools: {
107
- tool: listRepositoryToolsTool,
108
- handler: listRepositoryToolsHandler,
116
+ tool: Tools.listRepositoryToolsTool,
117
+ handler: Handlers.listRepositoryToolsHandler,
109
118
  },
110
119
  codacy_list_organization: {
111
- tool: listOrganizationsTool,
112
- handler: listOrganizationsHandler,
120
+ tool: Tools.listOrganizationsTool,
121
+ handler: Handlers.listOrganizationsHandler,
113
122
  },
114
123
  };
115
124
  // Register tools
@@ -15,22 +15,45 @@ export const searchRepositoryIssuesTool = {
15
15
  patternIds: {
16
16
  type: 'array',
17
17
  description: 'Set of code pattern identifiers',
18
+ items: {
19
+ type: 'string',
20
+ description: 'Code pattern identifier',
21
+ },
18
22
  },
19
23
  languages: {
20
24
  type: 'array',
21
25
  description: `Set of language names, without spaces. Accepted values: ${codacyLanguages.join(', ')}`,
26
+ items: {
27
+ type: 'string',
28
+ enum: codacyLanguages,
29
+ description: 'Language name',
30
+ },
22
31
  },
23
32
  categories: {
24
33
  type: 'array',
25
34
  description: `Set of issue categories. Accepted values: ${issueCategories.join(', ')}`,
35
+ items: {
36
+ type: 'string',
37
+ enum: issueCategories,
38
+ description: 'Issue category',
39
+ },
26
40
  },
27
41
  levels: {
28
42
  type: 'array',
29
43
  description: 'Set of issue severity levels. Accepted values: Info, Warning and Error. Codacy maps these values as follows: Info->Minor, Warning->Medium, Error->Critical',
44
+ items: {
45
+ type: 'string',
46
+ enum: ['Info', 'Warning', 'Error'],
47
+ description: 'Issue severity level',
48
+ },
30
49
  },
31
50
  authorEmails: {
32
51
  type: 'array',
33
52
  description: 'Set of commit author email addresses',
53
+ items: {
54
+ type: 'string',
55
+ description: 'Commit author email address',
56
+ },
34
57
  },
35
58
  },
36
59
  },
@@ -14,6 +14,10 @@ export const searchSecurityItemsTool = {
14
14
  repositories: {
15
15
  type: 'array',
16
16
  description: 'Use this to filter by repository name.',
17
+ items: {
18
+ type: 'string',
19
+ description: 'Repository name',
20
+ },
17
21
  },
18
22
  priorities: {
19
23
  description: 'Array of security issue priorities/severities to filter by.',
@@ -52,6 +56,10 @@ export const searchSecurityItemsTool = {
52
56
  segments: {
53
57
  type: 'array',
54
58
  description: 'Set of segments ids (type number). Segment is a Codacy concept that groups repositories by different criteria',
59
+ items: {
60
+ type: 'number',
61
+ description: 'Segment id',
62
+ },
55
63
  },
56
64
  },
57
65
  },
@@ -157,8 +157,8 @@ export const extractOrganizationFromUrl = (url) => {
157
157
  /https:\/\/bitbucket\.org\/([^/]+)\/[^/]+\.git$/,
158
158
  ];
159
159
  for (const pattern of patterns) {
160
- const match = url.match(pattern);
161
- if (match && match[1]) {
160
+ const match = pattern.exec(url);
161
+ if (match?.[1]) {
162
162
  return match[1];
163
163
  }
164
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/codacy-mcp",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Codacy MCP server",
5
5
  "license": "MIT",
6
6
  "author": "Codacy",