@codacy/codacy-mcp 0.3.1 → 0.3.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/dist/index.js CHANGED
@@ -3,10 +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, } from './src/tools/index.js';
7
- import { getFileCoverageHandler, getFileIssuesHandler, getPullRequestGitDiffHandler, getRepositoryPullRequestFilesCoverageHandler, listFilesHandler, listPullRequestIssuesHandler, listRepositoryPullRequestsHandler, searchRepositoryIssuesHandler, searchSecurityItemsHandler, listOrganizationRepositoriesHandler, getRepositoryWithAnalysisHandler, getFileWithAnalysisHandler, } from './src/handlers/index.js';
8
- import { getRepositoryWithAnalysisTool } from './src/tools/getRepositoryWithAnalysisTool.js';
9
- import { getFileWithAnalysisTool } from './src/tools/getFileWithAnalysisTool.js';
6
+ import { getFileCoverageTool, listFileIssuesTool, getPullRequestGitDiffTool, getRepositoryPullRequestFilesCoverageTool, listFilesTool, listOrganizationRepositoriesTool, listPullRequestIssuesTool, listRepositoryPullRequestsTool, searchRepositoryIssuesTool, searchSecurityItemsTool, getRepositoryWithAnalysisTool, getFileWithAnalysisTool, listRepositoryToolsTool, listToolsTool, listRepositoryToolPatternsTool, getPatternTool, getIssueTool, getRepositoryPullRequestTool, } 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, } from './src/handlers/index.js';
10
8
  OpenAPI.BASE = 'https://app.codacy.com/api/v3';
11
9
  OpenAPI.HEADERS = {
12
10
  'api-token': process.env.CODACY_ACCOUNT_TOKEN || '',
@@ -18,6 +16,33 @@ const server = new Server({
18
16
  }, {
19
17
  capabilities: {
20
18
  tools: {},
19
+ triggers: {
20
+ patterns: [
21
+ 'codacy',
22
+ 'code quality',
23
+ 'code analysis',
24
+ 'security vulnerabilities',
25
+ 'repository issues',
26
+ 'pull request analysis',
27
+ 'code coverage',
28
+ 'issues',
29
+ 'security',
30
+ 'srm',
31
+ 'analysis',
32
+ 'tool',
33
+ 'pattern',
34
+ 'pull request',
35
+ 'repository',
36
+ 'file',
37
+ 'coverage',
38
+ 'git',
39
+ 'diff',
40
+ 'branch',
41
+ 'commit',
42
+ 'severity',
43
+ 'organization',
44
+ ],
45
+ },
21
46
  },
22
47
  });
23
48
  const toolDefinitions = {
@@ -57,6 +82,30 @@ const toolDefinitions = {
57
82
  tool: getFileWithAnalysisTool,
58
83
  handler: getFileWithAnalysisHandler,
59
84
  },
85
+ codacy_get_repository_pull_request: {
86
+ tool: getRepositoryPullRequestTool,
87
+ handler: getRepositoryPullRequestHandler,
88
+ },
89
+ codacy_get_issue: {
90
+ tool: getIssueTool,
91
+ handler: getIssueHandler,
92
+ },
93
+ codacy_get_pattern: {
94
+ tool: getPatternTool,
95
+ handler: getPatternHandler,
96
+ },
97
+ codacy_list_repository_tool_patterns: {
98
+ tool: listRepositoryToolPatternsTool,
99
+ handler: listRepositoryToolPatternsHandler,
100
+ },
101
+ codacy_list_tools: {
102
+ tool: listToolsTool,
103
+ handler: listToolsHandler,
104
+ },
105
+ codacy_list_repository_tools: {
106
+ tool: listRepositoryToolsTool,
107
+ handler: listRepositoryToolsHandler,
108
+ },
60
109
  };
61
110
  // Register tools
62
111
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
@@ -15,3 +15,19 @@ export const getRepositoryWithAnalysisHandler = async (args) => {
15
15
  const { provider, organization, repository, branch } = args;
16
16
  return await AnalysisService.getRepositoryWithAnalysis(provider, organization, repository, branch);
17
17
  };
18
+ export const getRepositoryPullRequestHandler = async (args) => {
19
+ const { provider, organization, repository, pullRequestNumber } = args;
20
+ return await AnalysisService.getRepositoryPullRequest(provider, organization, repository, pullRequestNumber);
21
+ };
22
+ export const getIssueHandler = async (args) => {
23
+ const { provider, organization, repository, issueId } = args;
24
+ return await AnalysisService.getIssue(provider, organization, repository, issueId);
25
+ };
26
+ export const listRepositoryToolsHandler = async (args) => {
27
+ const { provider, organization, repository } = args;
28
+ return await AnalysisService.listRepositoryTools(provider, organization, repository);
29
+ };
30
+ export const listRepositoryToolPatternsHandler = async (args) => {
31
+ const { provider, organization, repository, toolUuid, languages, categories, severityLevels, search, enabled, recommended, sort, direction, cursor, limit, } = args;
32
+ return await AnalysisService.listRepositoryToolPatterns(provider, organization, repository, toolUuid, languages, categories, severityLevels, search, enabled, recommended, sort, direction, cursor, limit);
33
+ };
@@ -3,3 +3,4 @@ export * from './repository.js';
3
3
  export * from './analysis.js';
4
4
  export * from './organization.js';
5
5
  export * from './security.js';
6
+ export * from './tools.js';
@@ -0,0 +1,9 @@
1
+ import { ToolsService } from '../api/client/index.js';
2
+ export const listToolsHandler = async (args) => {
3
+ const { cursor, limit } = args;
4
+ return await ToolsService.listTools(cursor, limit);
5
+ };
6
+ export const getPatternHandler = async (args) => {
7
+ const { toolUuid, patternId } = args;
8
+ return await ToolsService.getPattern(toolUuid, patternId);
9
+ };
@@ -0,0 +1,15 @@
1
+ import { repositorySchema } from './utils.js';
2
+ export const getIssueTool = {
3
+ name: 'codacy_get_issue',
4
+ description: 'Returns information about an open issue that Codacy found in a repository.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ ...repositorySchema,
9
+ issueId: {
10
+ type: 'string',
11
+ description: 'Issue ID',
12
+ },
13
+ },
14
+ },
15
+ };
@@ -0,0 +1,17 @@
1
+ export const getPatternTool = {
2
+ name: 'codacy_get_pattern',
3
+ description: 'Get the definition of a specific pattern.',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ toolUuid: {
8
+ type: 'string',
9
+ description: 'The identifier of the tool that the pattern belongs to.',
10
+ },
11
+ patternId: {
12
+ type: 'string',
13
+ description: 'Pattern identifier',
14
+ },
15
+ },
16
+ },
17
+ };
@@ -0,0 +1,15 @@
1
+ import { repositorySchema } from './utils.js';
2
+ export const getRepositoryPullRequestTool = {
3
+ name: 'codacy_get_repository_pull_request',
4
+ description: 'Get the pull request information for a repository. The response contains the analysis of the pull request.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ ...repositorySchema,
9
+ pullRequestNumber: {
10
+ type: 'number',
11
+ description: 'Pull request number',
12
+ },
13
+ },
14
+ },
15
+ };
@@ -8,3 +8,11 @@ export * from './listPullRequestIssuesTool.js';
8
8
  export * from './listRepositoryPullRequestsTool.js';
9
9
  export * from './searchRepositoryIssuesTool.js';
10
10
  export * from './searchSecurityItemsTool.js';
11
+ export * from './getRepositoryWithAnalysisTool.js';
12
+ export * from './getFileWithAnalysisTool.js';
13
+ export * from './getIssueTool.js';
14
+ export * from './getPatternTool.js';
15
+ export * from './getRepositoryPullRequestTool.js';
16
+ export * from './listRepositoryToolPatternsTool.js';
17
+ export * from './listRepositoryToolsTool.js';
18
+ export * from './listToolsTool.js';
@@ -0,0 +1,40 @@
1
+ import { getPaginationWithSorting, repositorySchema } from './utils.js';
2
+ export const listRepositoryToolPatternsTool = {
3
+ name: 'codacy_list_repository_tool_patterns',
4
+ description: 'List the patterns of a tool available for a repository in Codacy.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ ...repositorySchema,
9
+ ...getPaginationWithSorting("Field used to sort the tool's code patterns. The allowed values are 'category', 'recommended', and 'severity'"),
10
+ toolUuid: {
11
+ type: 'string',
12
+ description: 'Identifier of the tool',
13
+ },
14
+ languages: {
15
+ type: 'string',
16
+ description: 'List of languages to filter the patterns by, separated by commas',
17
+ },
18
+ categories: {
19
+ type: 'string',
20
+ description: "List of categories to filter the patterns by, separated by commas. The allowed values are 'Security', 'ErrorProne', 'CodeStyle', 'Compatibility', 'UnusedCode', and 'Performance'",
21
+ },
22
+ severityLevels: {
23
+ type: 'string',
24
+ description: "List of severity levels to filter the patterns by, separated by commas. The allowed values are 'Error', 'Warning', and 'Info'",
25
+ },
26
+ search: {
27
+ type: 'string',
28
+ description: 'Filter patterns searching by this string',
29
+ },
30
+ enabled: {
31
+ type: 'boolean',
32
+ description: 'Returns only the enabled or disabled patterns',
33
+ },
34
+ recommended: {
35
+ type: 'boolean',
36
+ description: 'Returns only the recommended or non-recommended patterns.',
37
+ },
38
+ },
39
+ },
40
+ };
@@ -0,0 +1,11 @@
1
+ import { repositorySchema } from './utils.js';
2
+ export const listRepositoryToolsTool = {
3
+ name: 'codacy_list_repository_tools',
4
+ description: 'Get analysis tools settings of a repository. This endpoint returns the analysis tools available in Codacy for a repository.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ ...repositorySchema,
9
+ },
10
+ },
11
+ };
@@ -0,0 +1,11 @@
1
+ import { defaultPagination } from './utils.js';
2
+ export const listToolsTool = {
3
+ name: 'codacy_list_tools',
4
+ description: 'List all code analysis tools available in Codacy.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ ...defaultPagination,
9
+ },
10
+ },
11
+ };
@@ -1,7 +1,7 @@
1
1
  import { getPaginationWithSorting, organizationSchema, securityCategories, securityScanTypes, securityStatuses, } from './utils.js';
2
2
  export const searchSecurityItemsTool = {
3
3
  name: 'codacy_list_srm_items',
4
- description: `Primary tool to list security items/issues/vulnerabilities/findings, results are related to the organization security and risk management (SRM) dashboard on Codacy. This tool contains pagination. Returns comprehensive security analysis including ${Object.keys(securityScanTypes).join(', ')} security issues. Provides advanced filtering by security categories, priorities, and scan types. Use this as the first tool when investigating security or compliance concerns. Map the results statuses as open issues: ${securityStatuses.Open.join(', ')}; and closed issues: ${securityStatuses.Closed.join(', ')}. Prioritize the open issues as the most important ones in the results.`,
4
+ description: `Primary tool to list security items/issues/vulnerabilities/findings, results are related to the organization security and risk management (SRM) dashboard on Codacy. This tool contains pagination. Returns comprehensive security analysis including ${Object.keys(securityScanTypes).join(', ')} security issues. Provides advanced filtering by security categories, priorities, and scan types. Use this as the first tool when investigating security or compliance concerns. Map the results statuses as open issues: ${securityStatuses.Open.join(', ')}; and closed issues: ${securityStatuses.Closed.join(', ')}. Prioritize the open issues as the most important ones in the results. To get the SRM items for a specific repository, use the repository name in body object.`,
5
5
  inputSchema: {
6
6
  type: 'object',
7
7
  properties: {
@@ -13,7 +13,7 @@ export const searchSecurityItemsTool = {
13
13
  properties: {
14
14
  repositories: {
15
15
  type: 'array',
16
- description: 'Repository names',
16
+ description: 'Use this to filter by repository name. ',
17
17
  },
18
18
  priorities: {
19
19
  description: 'Array of security issue priorities/severities to filter by.',
@@ -91,18 +91,18 @@ export const securityScanTypes = {
91
91
  export const organizationSchema = {
92
92
  provider: {
93
93
  type: 'string',
94
- description: "Organization's git provider: GitHub (gh), GitLab (gl) or BitBucket (bb). Accepted values: gh, gl, bb. In case a repository is given, use that repository's Git provider.",
94
+ description: "Organization's git provider: GitHub (gh), GitLab (gl) or BitBucket (bb). Accepted values: gh, gl, bb. In case a repository is given, use that repository's Git provider. ",
95
95
  },
96
96
  organization: {
97
97
  type: 'string',
98
- description: "Organization name on the Git provider. In case a repository is given, use that repository's owner (could be an organization name or username).",
98
+ description: "Organization name on the Git provider. In case a repository is given, use that repository's owner (could be an organization name or username), to find the repository's owner check the repository git url, it should be something like this for gh:'https://github.com/<owner>/<repository>.git' for gl:'https://gitlab.com/<owner>/<repository>.git' for bb:'https://bitbucket.org/<owner>/<repository>.git'.",
99
99
  },
100
100
  };
101
101
  export const repositorySchema = {
102
102
  ...organizationSchema,
103
103
  repository: {
104
104
  type: 'string',
105
- description: 'Repository name on the Git provider',
105
+ description: "Repository name on the Git provider. To find the repository name check the repository git url, it should be something like this for gh:'https://github.com/<owner>/<repository>.git' for gl:'https://gitlab.com/<owner>/<repository>.git' for bb:'https://bitbucket.org/<owner>/<repository>.git'.",
106
106
  },
107
107
  };
108
108
  export const defaultPagination = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/codacy-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Codacy MCP server",
5
5
  "license": "MIT",
6
6
  "author": "Codacy",