Skip to content

Using Codacy Guardrails#

Write secure, compliant AI code#

a. Let's run an prompt to create a webserver in Java

Create a lightweight webserver in Java.

Prompt create a webserver in java

In response, it generated a compact, readable Java class using ServerSocket and raw streams to handle HTTP requests. Here’s what I got:

response to the webserver creation using AI

b. There's a call from MCP tool to analyse the code that was generated. Click in Run tool

Codacy Guardrails starts analyzing it automatically using the Codacy CLI embedded in the agent’s flow. No configurations, no extra steps–it just works.

It found an issue with PMD - the package name isn't correctly declared - and it will try to fix that with the right declaration.

analysis to the webserver implementation

c. After a new analysis, It shows us that it has 0 issues in the code

zero issues in the webserver implementation

Prompt Codacy from your IDE chat panel#

Once your repository is connected to Codacy, you can go beyond traditional static analysis and start interacting with your codebase using natural language prompts.

a. Let's run a quick example with the prompt:

Can you list all security issues in my repository?

Prompt list the security issues in my repository

b. Right after running this prompt, there is a MCP tool call to search all security issues in my repository. Click in Run tool

List the security issues in my repository

It will search for all open security issues in my repository. And it will list all them, showing the title, priority, status and the link to the issue,

List the security issues in my repository

It turned security from a checklist into a dialogue—and that changes everything.

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

Edit this page on GitHub if you notice something wrong or missing.

If you have a question or need help please contact support@codacy.com.

Last modified May 29, 2025