@codacy/codacy-mcp 0.3.1 → 0.3.2
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 +26 -4
- package/dist/src/handlers/analysis.js +16 -0
- package/dist/src/handlers/index.js +1 -0
- package/dist/src/handlers/tools.js +9 -0
- package/dist/src/tools/getIssueTool.js +15 -0
- package/dist/src/tools/getPatternTool.js +17 -0
- package/dist/src/tools/getRepositoryPullRequestTool.js +15 -0
- package/dist/src/tools/index.js +8 -0
- package/dist/src/tools/listRepositoryToolPatternsTool.js +40 -0
- package/dist/src/tools/listRepositoryToolsTool.js +11 -0
- package/dist/src/tools/listToolsTool.js +11 -0
- package/package.json +1 -1
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 || '',
|
|
@@ -57,6 +55,30 @@ const toolDefinitions = {
|
|
|
57
55
|
tool: getFileWithAnalysisTool,
|
|
58
56
|
handler: getFileWithAnalysisHandler,
|
|
59
57
|
},
|
|
58
|
+
codacy_get_repository_pull_request: {
|
|
59
|
+
tool: getRepositoryPullRequestTool,
|
|
60
|
+
handler: getRepositoryPullRequestHandler,
|
|
61
|
+
},
|
|
62
|
+
codacy_get_issue: {
|
|
63
|
+
tool: getIssueTool,
|
|
64
|
+
handler: getIssueHandler,
|
|
65
|
+
},
|
|
66
|
+
codacy_get_pattern: {
|
|
67
|
+
tool: getPatternTool,
|
|
68
|
+
handler: getPatternHandler,
|
|
69
|
+
},
|
|
70
|
+
codacy_list_repository_tool_patterns: {
|
|
71
|
+
tool: listRepositoryToolPatternsTool,
|
|
72
|
+
handler: listRepositoryToolPatternsHandler,
|
|
73
|
+
},
|
|
74
|
+
codacy_list_tools: {
|
|
75
|
+
tool: listToolsTool,
|
|
76
|
+
handler: listToolsHandler,
|
|
77
|
+
},
|
|
78
|
+
codacy_list_repository_tools: {
|
|
79
|
+
tool: listRepositoryToolsTool,
|
|
80
|
+
handler: listRepositoryToolsHandler,
|
|
81
|
+
},
|
|
60
82
|
};
|
|
61
83
|
// Register tools
|
|
62
84
|
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
|
+
};
|
|
@@ -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
|
+
};
|
package/dist/src/tools/index.js
CHANGED
|
@@ -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
|
+
};
|