Frontend Quality Auditor: CLI Safe Fixes & MCP Setup
In this article
Frontend Quality Auditor (FQA) is a command-line tool that scans your web project for accessibility, performance, and code-quality issues. To run its CLI safe fixes, use npx frontend-quality-auditor --fix, which applies only automated, reversible changes; to set up Model Context Protocol (MCP) for AI-assisted auditing, run npx frontend-quality-auditor --mcp-init and follow the generated configuration instructions. This article explains both processes in detail, including prerequisites, common pitfalls, and how to verify the fixes.
Background: What Frontend Quality Auditor Does
Frontend Quality Auditor is a developer tool that analyzes HTML, CSS, and JavaScript files against a set of rules derived from web standards and best practices. It checks for issues like missing ARIA labels, contrast ratio failures, unused CSS selectors, and deprecated JavaScript APIs. The tool outputs a report in the terminal, and optionally in JSON or SARIF format for CI/CD integration.
The tool is designed to be run locally during development or as part of a pre-commit hook. It does not require a server or a browser; it parses files statically. This makes it fast and suitable for large codebases. The rules are configurable via a .fqarc file, allowing teams to disable or adjust specific checks.
How to Run the CLI Safe Fixes
The --fix flag automatically applies changes that are considered safe—meaning they do not alter the behavior of your code, only its quality. For example, it can add missing alt attributes (if the image has a nearby text description), remove unused CSS rules, or replace deprecated functions with modern equivalents.
To run safe fixes, follow these steps:
- Install the tool globally or locally:
npm install -g frontend-quality-auditorornpm install --save-dev frontend-quality-auditor. - Navigate to your project root.
- Run
npx frontend-quality-auditor --fix(if installed locally, usenpxto ensure the local version is used). - Review the changes using
git diffbefore committing.
If you want to see what would be fixed without applying changes, run npx frontend-quality-auditor --dry-run. This previews the modifications without writing to files.
Understanding the MCP Setup
MCP (Model Context Protocol) is an open standard that allows AI assistants (like Claude or Copilot) to access external tools and data. Frontend Quality Auditor can act as an MCP server, meaning an AI assistant can invoke its analysis directly from a chat interface. This is useful for getting real-time feedback while writing code.
To set up MCP, the tool provides an initialization command that generates a configuration file for your AI client. The steps are:
- Run
npx frontend-quality-auditor --mcp-init. - The tool creates a file (e.g.,
.mcp.json) containing the server endpoint and authentication token. - Copy the configuration into your AI assistant's MCP settings (e.g., Claude Desktop's
claude_desktop_config.json). - Restart the assistant to load the new MCP server.
Once configured, you can ask the AI to "run the quality auditor on src/components" and it will execute the tool and return the report. This integration is read-only by default; the AI cannot apply fixes unless you explicitly allow it.
Choosing Between Safe Fixes and Manual Fixes
Not all issues can be fixed automatically. For example, missing alt text that requires human judgment (what is the image conveying?) is not safe to auto-fix. The tool's safe fixes are limited to:
- Adding
roleattributes to elements with missing semantics. - Removing duplicate IDs.
- Converting
var()tolet/constin JavaScript (if scope is clear). - Adding
typeattributes to script tags.
For issues that require context, the tool will list them in the report but skip auto-fixing. You should manually address these, often with input from designers or product owners.
Common Problems and Troubleshooting
Users often encounter a few recurring issues when running the CLI:
- Command not found: Ensure the tool is installed. If using
npx, it will fetch the latest version, but if you have a local install, usenpm runscripts. - Fixes not applied: The tool may skip fixes if the file is not in the allowed list (default is all files). Use
--includeto specify paths. - MCP connection fails: Check that the port (default 3000) is not in use. You can change it with
--port. - False positives: Some rules may flag valid code. Adjust the rule severity in
.fqarcor add an ignore comment:// fqa-ignore.
If the fix introduces a bug, you can revert with git checkout -- . (if using Git) before committing. Always run tests after applying fixes.
Safety and Best Practices
Running automated fixes is generally safe, but you should follow these practices:
- Always run the tool in a clean working tree (commit or stash changes) so you can easily revert.
- Use
--dry-runfirst to review the proposed changes. - Run your test suite after applying fixes to catch regressions.
- For MCP, do not expose the server to untrusted networks; it binds to localhost by default.
The tool does not modify files outside your project directory. It also creates a backup of each modified file in a .fqa-backup folder, which you can delete after verifying.
Alternatives and Comparisons
Other tools in this space include ESLint (for JavaScript), Stylelint (for CSS), and axe-core (for accessibility). Frontend Quality Auditor differs by combining all three types of checks in one tool, with a unified rule configuration. However, it may not be as deep as specialized tools. For example, axe-core has more accessibility rules, while ESLint has a vast plugin ecosystem.
If you already use ESLint and Stylelint, you might prefer to keep them and add axe-core separately. But if you want a single command to get an overall quality score, FQA is convenient. It also integrates with MCP, which is a unique feature not yet common in other linters.
Frequently Asked Questions
Does --fix change my code's behavior?
No, the safe fixes are designed to be behavior-neutral. They only make changes that do not affect runtime logic, such as adding attributes or removing dead code. However, it is still possible that a fix could expose a pre-existing bug, so testing is recommended.
Can I use MCP with VS Code?
Yes, if your AI extension supports MCP (such as Copilot Chat). You add the generated configuration to your VS Code settings under mcp.servers. The tool will appear as a tool you can invoke.
How do I ignore a specific file?
Create a .fqaignore file in your project root and list the file patterns, one per line, using glob syntax (e.g., dist/**). The tool will skip those files.
What is the difference between --fix and --format?
--fix applies safe changes to the source files. --format only changes the output format of the report (e.g., JSON, SARIF) without modifying any files.
Can I run the auditor in CI without installing it globally?
Yes, use npx frontend-quality-auditor@latest in your CI pipeline. This fetches the latest version on the fly, but for reproducibility, pin the version (e.g., @1.2.3).