@codacy/codacy-mcp

中文文档
0.7.2发布于 2026/11/05MITES Module近 30 天下载 5696

Codacy MCP server

原始使用文档
文档目录21 节
  1. Table of Contents
  2. Features / Tools
  3. Repository Setup and Management
  4. Organization and Repository Management
  5. Code Quality and Analysis
  6. File Management and Analysis
  7. Security Analysis
  8. Pull Request Analysis
  9. Tool and Pattern Management
  10. CLI Analysis
  11. Setup
  12. Requirements
  13. Personal API Access Token
  14. Install
  15. Troubleshooting
  16. Claude Desktop and NVM
  17. Contribute
  18. Testing with Inspector
  19. Testing with an Agent
  20. Codacy-CLI Support
  21. License

Codacy MCP Server

Codacy Badge

MCP Server for the Codacy API, enabling access to repositories, files, quality, coverage, security and more.

Table of Contents

Features / Tools

The following tools are available through the Codacy MCP Server:

Repository Setup and Management

  • codacy_setup_repository: Add or follow a repository in Codacy if not already present. This tool ensures the repository is registered with Codacy, allowing further analysis and management.

Organization and Repository Management

  • codacy_list_organizations: List organizations with pagination support.
  • codacy_list_organization_repositories: List repositories in an organization with pagination support.
  • codacy_get_repository_with_analysis: Get repository with analysis information, including metrics for Grade, Issues, Duplication, Complexity, and Coverage.

Code Quality and Analysis

  • codacy_list_repository_issues: Lists and filters code quality issues in a repository. This is the primary tool for investigating general code quality concerns (e.g. best practices, performance, complexity, style) but NOT security issues. For security-related issues, use the SRM items tool instead. Features include:

    • Pagination support for handling large result sets
    • Filtering by multiple criteria including severity, category, and language
    • Author-based filtering for accountability
    • Branch-specific analysis
    • Pattern-based searching

    Common use cases:

    • Code quality audits
    • Technical debt assessment
    • Style guide compliance checks
    • Performance issue investigation
    • Complexity analysis

File Management and Analysis

  • codacy_list_files: List files in a repository with pagination support.
  • codacy_get_file_issues: Get the issue list for a file in a repository.
  • codacy_get_file_coverage: Get coverage information for a file in the head commit of a repository branch.
  • codacy_get_file_clones: Get the list of duplication clones (identical or very similar code segments) for a file in a repository.
  • codacy_get_file_with_analysis: Get detailed analysis information for a file, including metrics for Grade, Issues, Duplication, Complexity, and Coverage.

Security Analysis

  • codacy_search_organization_srm_items: Primary tool to list security items/issues/vulnerabilities/findings across an organization. Results are related to the organization's security and risk management (SRM) dashboard on Codacy.
  • codacy_search_repository_srm_items: List security items/issues/vulnerabilities/findings for a specific repository.

Both tools provide comprehensive security analysis including:

  • SAST (Code scanning)
  • Secrets (Secret scanning)
  • SCA (Dependency scanning)
  • IaC (Infrastructure-as-code scanning)
  • CICD (CI/CD scanning)
  • DAST (Dynamic Application Security Testing)
  • PenTesting (Penetration testing)

Pull Request Analysis

  • codacy_list_repository_pull_requests: List pull requests from a repository that the user has access to.
  • codacy_get_repository_pull_request: Get detailed information about a specific pull request.
  • codacy_list_pull_request_issues: Returns a list of issues found in a pull request (new or fixed issues).
  • codacy_get_pull_request_files_coverage: Get diff coverage information for all files in a pull request.
  • codacy_get_pull_request_git_diff: Returns the human-readable Git diff of a pull request.

Tool and Pattern Management

  • codacy_list_tools: List all code analysis tools available in Codacy.
  • codacy_list_repository_tools: Get analysis tools settings and available tools for a repository.
  • codacy_get_pattern: Get the definition of a specific pattern.
  • codacy_list_repository_tool_patterns: List the patterns of a tool available for a repository.
  • codacy_get_issue: Get detailed information about a specific issue.

CLI Analysis

  • codacy_cli_analyze: Run quality analysis locally using Codacy CLI. Features include:
    • Analyze specific files or entire directories
    • Use specific tools or all available tools
    • Get immediate results without waiting for scheduled analysis
    • Apply fixes based on Codacy configuration

Setup

Requirements

Ensure your machine has the following tools installed:

  • git
  • node.js
    • ensure that the npx command runs without issues.

For local analysis, the MCP Server requires the Codacy CLI to be installed. If it is not available, the MCP Server will attempt to install it for you. Codacy CLI v2 runs on macOS, Linux, and Windows (only with WSL).

Personal API Access Token

Get your Codacy's Account API Token from your Codacy Account.

You'll need it later in the setup.

Install

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, OpenVSX). From the extension panel, just click on Add Codacy MCP Server. Restart your IDE afterwards.

Without the extension, you can still use and install the MCP Server:

Cursor, Windsurf, and others

You can use the one-click install for Cursor:

Install MCP Server

Otherwise, depending on what you are connecting the MCP Server to, you can use the following methods:

  • Cursor: edit the .cursor/mcp.json file to add the following
  • Windsurf: edit the .codeium/windsurf/mcp_config.json file to add the following
  • Claude Desktop: edit the claude_desktop_config.json file to add the following
{
  "mcpServers": {
    "codacy": {
      "command": "npx",
      "args": ["-y", "@codacy/codacy-mcp"],
      "env": {
        "CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

VS Code with Copilot

You can use the one-click install for VS Code:

Install with Codacy in VS Code Install with Codacy in VS Code Insiders

Otherwise, if you wish to set it up manually:

  1. For connecting the MCP Server to Copilot in VS Code, add the following to the global config of the IDE:
{
  "mcp": {
    "inputs": [],
    "servers": {
      "codacy": {
        "command": "npx",
        "args": ["-y", "@codacy/codacy-mcp"],
        "env": {
          "CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
        }
      }
    }
  }
}

You can open the user settings.json file in:

View > Command Palette > Preferences: Open User Settings (JSON)

Or open the general settings.json file directly, which according to your OS should be located in:

  • for macOS: ~/Library/Application Support/Code/User/settings.json
  • for Windows: %APPDATA%\Code\User\settings.json
  • for Linux: ~/.config/Code/User/settings.json

Don't forget to update the value of CODACY_ACCOUNT_TOKEN with your token.

  1. Make sure you have Agent mode enabled: vscode://settings/chat.agent.enabled

  2. Open the Copilot chat and switch the mode to Agent. You can check that the MCP server was enabled correctly by clicking on the Select tools icon, which should list all the available Codacy tools.

Copilot Agent with Codacy tools

Troubleshooting

Claude Desktop and NVM

When using NVM with Claude Desktop, NPX may not work. You should first install the MCP Server globally, and then use Node directly:

npm install -g @codacy/codacy-mcp
{
  "mcpServers": {
    "codacy": {
      "command": "/Users/yourusername/.nvm/versions/node/vXX.X.X/bin/node",
      "args": ["/path-to/codacy-mcp/dist/index.js"],
      "env": {
        "CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

Contribute

To work locally on the MCP Server code, run:

npm install
npm run update-api
npm run build

Testing with Inspector

You can test the MCP server using the inspector tool. You can either set a CODACY_ACCOUNT_TOKEN environment variable or pass it inline:

CODACY_ACCOUNT_TOKEN=your_token_here npm run inspect

This will build the project and launch the MCP inspector with your Codacy token.

Testing with an Agent

You can test your local instance configuring the MCP Server as follows:

"codacy": {
  "command": "/path/to/bin/node",
  "args": [
    "/path/to/codacy-mcp-server/dist/index.js"
  ],
  "env": {
    "CODACY_ACCOUNT_TOKEN": "<YOUR_TOKEN>"
  }
}

Codacy-CLI Support

In order to use the Codacy-CLI, 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.

In case you want to use a specific version of our CLI, send a CODACY_CLI_VERSION env variable in the MCP Server configuration.

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

版本与发布记录

@codacy/codacy-mcp 共发布 72 个版本,首次发布于 2025/03/26;过去 12 个月发布了 10 个版本。

版本发布日期距今
0.7.2latest2026/11/054 天前
0.7.12026/11/036 天前
0.7.02026/10/2218 天前
0.6.252026/09/221 个月前
0.6.242026/07/303 个月前
0.6.232026/07/283 个月前

其他发布通道:unstable → 0.0.5-fixpublishstep.4.0c4d44b。

关于 @codacy/codacy-mcp 的常见问题

@codacy/codacy-mcp 是什么?

Codacy MCP server

如何安装 @codacy/codacy-mcp?

在项目目录运行 npm install @codacy/codacy-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 codacy-mcp-server,可以用 npx codacy-mcp-server 直接运行。

@codacy/codacy-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/codacy__codacy-mcp 是否存在。

@codacy/codacy-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@codacy/codacy-mcp 可以商用吗?

@codacy/codacy-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@codacy/codacy-mcp 的下载量有多少?

根据 npm 官方下载统计,@codacy/codacy-mcp 在 2026/10/10 – 2026/11/08 这 30 天内被下载 5,696 次,日均约 190 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@codacy/codacy-mcp 还在维护吗?

最新版本 0.7.2 发布于 2026/11/05(4 天前);至今共发布 72 个版本,其中过去 12 个月发布了 10 个;首次发布于 2025/03/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。