Configuring AI Remediation for Static Analysis

Perforce QAC includes an MCP server that provides information (such as diagnostic details, fix guidelines, and checker documentation) from static analysis tools to AI assistants (such as GitHub Copilot Chat) in a standardized, tool-agnostic format.

This allows AI assistants to generate high-quality, compliant fixes for detected issues, based on analysis results.

You can integrate the MCP Server provided with Perforce QAC to suggest code fixes for issues identified by Perforce QAC.

AI suggestions may contain errors, so you should review all changes carefully before applying.

To use AI remediation feature, you will require the following:

  • An active internet connection
  • The latest version of Visual Studio Code (VSCode)
  • The latest Perforce QAC Visual Studio Code extension (installed via VSIX file)
  • MCP Servers Marketplace enabled in VS Code. You can enable this by clicking MCP Servers in the Extensions and then clicking Enable MCP Servers Marketplace
  • If you don’t see the MCP Servers panel in the Extensions side bar, click on the at the top, then select Views > MCP Servers.
  • The P4SA MCP Server. You can find this in the QAC components folder - see Configuring the MCP Server for more information.

  • A GitHub account
  • GitHub Copilot or Copilot Chat Extension (installed from Visual Studio Marketplace)
  • (Optional) An API key if using a custom large language model (LLM) instead of presets
  • You can use any LLM, but Claude Sonnet 4.6 and GPT-5.3-Codex produced the best results in our testing.

Configure Copilot Chat

To configure Copilot Chat in your VS Code IDE:

  1. In VS Code, open Copilot Chat settings.
  2. From the drop-down, set Copilot to Agent Mode.
  3. From the drop-down, select the LLM to use. To use a custom LLM, select Manage models, select a provider, and enter your API key.
Fix accuracy is impacted by the model you have chosen.

Configuring the MCP Server

To install the MCP server in VS Code:

  1. Click Ctrl+Shift+P > MCP:Add server
  2. Select Command (stdio) > insert the following command:
    1. Windows:
    2. C:\Perforce\QAC-2026.1\components\mcp\mcp_desktop_run.bat --qacli-cmd-path=C:\Perforce\QAC-2026.1\common\bin
    3. Linux:
    4. /opt/Perforce/QAC-2026.1/components/mcp/mcp_desktop_run.sh --qacli-cmd-path=/opt/Perforce/QAC-2026.1/common/bin
  3. If you did not install to this location, change this command to match the path of your installation.

  4. Give the MCP server a name: P4-SA-MCP
  5. Select whether you want it to run Globally or just in the current Workspace.
  6. Start your server. You can do this using the Ctrl+Shift+X shortcut, then click MCP Servers > Gear > Start Server

You can now see the log for the MCP server in the output window. If it does not automatically display the MCP logs, select MCP: P4-SA-MCP from the list.

The MCP server is now available to be used in the Perforce QAC Visual Studio Code plugin when you view diagnostics produced by analysis and select the Fix with QAC Tools menu option.

Running AI Remediation

AI remediation works for defects identified by Perforce QAC in VS Code. To run the AI remediation:

  1. Right-click a defect and select Fix using QAC tools.
  2. The VS Code plugin generates an agentic request that will use the QAC tools provided by the MCP server.
  3. For initial requests, VS Code will ask for access to the MCP Server QAC tools. For the first few fixes your can allow each prompt individually and review the results of each step if you wish.
  4. Once you are comfortable with the AI process you can select Always allow/Allow without review each time.
  5. The tool generates a fix based on the details provided by the MCP tools:
    • Fix requirements - The prompt used to guide the AI agent, including instructions about what it should or should not do.
    • Diagnostic info - The details of the problem found by QAC.
    • Diagnostic help - Describing the issue and possible solutions.

Configuring Fix Requirements

The MCP server has built-in fix requirements that guide the AI agent fixing the problems found. However, you can add additional instructions to improve accuracy of the fixes.

To do this, you need to create a mark-down file in your user home folder:

<USER_HOME>/.sa-mcp-desktop/QAC_USER_FIX_REQUIREMENTS.MD
Use user fix requirements with caution, as it can affect the accuracy of the final result.

The location of this folder will vary. For example:

On Windows:

C:\Users\username\.sa-mcp-desktop\QAC_USER_FIX_REQUIREMENTS.MD

On Linux:

/home/username/.sa-mcp-desktop/QAC_USER_FIX_REQUIREMENTS.MD

The contents of this file will be added to the end of the default fix requirements provided by the MCP Server.

If you change the contents of USER_FIX_REQUIREMENTS.MD, and if you have an existing CoPilot session, you should start a new one in order for the changes to be detected.
Consult your AI documentation for details about how to write effective AI prompts.