You are here:
Use ApexGuru in Agentic IDEs with DX MCP
Resolve Apex performance issues directly in environments like VS Code, Agentforce Vibes, and Cursor without switching to the Salesforce UI.
In Salesforce DX MCP Server and Tools, ApexGuru analyzes your Apex classes within your preferred IDE to identify performance antipatterns and production run-time impact. It provides prioritized recommendations including the antipattern type, line number, code snippet, and fix.
- Review the GitHub README file for detailed setup instructions, commands, and code samples.
- Install Node.js (v18 or later).
-
Authenticate your org:
sf org login web. -
Set your default org:
sf config set target-org <alias>. -
Configure the Scale Products toolset: Add the
@salesforce/mcp serverto your IDE’s MCP settings using the--toolsets scale-productsargument. - Ask your IDE agent to scan a class. For example: Scan OrderHandler.cls for performance antipatterns using scan_apex_class_for_antipatterns.
| Task | Description |
|---|---|
| Scan for Antipatterns | Use scan_apex_class_for_antipatterns to detect issues like SOQL
without WHERE clauses or expensive getGlobalDescribe() calls. |
| Get Run-time Insights | Enable ApexGuru in your Production or Full Copy org. The tool uses production data to prioritize issues. |
| Use Best Practices | Limit enabled toolsets to scale-products for better performance.
Reference the tool name explicitly in prompts. |
| Troubleshoot | Verify your org authentication. Configure the scale-products toolset
in your IDE's MCP settings. |
