• DETECTION
  • REPORTS
  • ALERTS
  • HUMAN

How to scan code for secrets with your AI

Connect GitGuardian to your AI client to catch leaked credentials before they hit your repo. Your agent handles the heavy lifting of scanning and incident reporting.

Ask AI about this page

Short answer

Can my AI scan my code for leaked secrets?

Yes. Your AI uses GitGuardian to inspect code content for sensitive data like API keys or passwords. It can then automatically create incidents if it finds something dangerous. You'll see exactly where the exposure happened.

Where findings land.

The outcomes of a scan.

The AI routes every discovery to the right place based on what it finds.

DETECTION

Identified leaks

The AI uses scan_content to find secrets in specific snippets. You get a clear report of what was exposed.

REPORTS

Bulk scan results

When you have multiple files, the AI runs multiscan_content. This gathers all findings into a single view.

ALERTS

Automated incidents

The AI uses scan_and_create_incidents to turn high-risk finds into actionable GitGuardian incidents. This ensures nothing gets missed.

HUMAN

Manual review

The AI flags the issue, but you decide if the secret is a false positive or needs immediate rotation. You maintain final control over the remediation.

The workflow

What your AI does when the code arrives.

Your agent acts as a security gatekeeper between your editor and your repository.

  1. Inspect snippets

    The AI looks through the specific code you provide to find patterns matching known secret types.

    scan_content
  2. Batch processing

    If you provide a directory or a list of files, the AI checks all of them at once.

    multiscan_content
  3. Trigger alerts

    The AI identifies high-confidence leaks and immediately logs them in your GitGuardian dashboard.

    scan_and_create_incidents
  4. Report findings

    The AI summarizes the risk level and the specific lines of code that triggered the scan.

    scan_content

Try it

Copy these to start.

Use these prompts to kick off a security scan.

Starting points

Swap out the bracketed text for your actual file paths or repository names.

GitGuardian Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_NQtV8WXJZTZDwZLKUu4JIzBlR9PvO6RL6VjurLD6/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — GitGuardian capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "gitguardian-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_NQtV8WXJZTZDwZLKUu4JIzBlR9PvO6RL6VjurLD6/mcp"
    }
  }
}
Copy into chat04
  • Scan this code snippet for any secrets: [paste code here]

  • Run a scan on these files: [file_path_1, file_path_2]

  • Check this repository for sensitive data and create incidents for any leaks found: [repo_name]

  • Scan the content of [file_name] and tell me if any API keys are exposed.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect GitGuardian once, then ask.

One connection gives your AI access to GitGuardian's scanning tools. Your credentials stay encrypted and secure.

Connect GitGuardian to your AI

FAQ

How this task behaves.

  • 01

    Can the AI automatically fix the leaked secret?

    No. The AI identifies the leak and creates an incident, but you must manually rotate the secret and update your code.

  • 02

    Does the AI delete my code if it finds a secret?

    No. The AI only reads and scans your content. It does not have the ability to modify or delete your files.

  • 03

    Will it scan my entire GitHub history?

    The AI only scans the specific content or files you provide in your prompt.

  • 04

    Can I scan multiple files at once?

    Yes, you can use the multiscan_content capability to check multiple pieces of content in one go.

  • 05

    Does the AI create real incidents in GitGuardian?

    Yes, if you use the scan_and_create_incidents capability, the AI will generate incidents in your GitGuardian account.

  • More questions about GitGuardian? The Connector page answers them. See everything the GitGuardian Connector can do

Connect GitGuardian to Claude, Cursor, ChatGPT & more