---
title: "Semgrep MCP server: security scanning for AI-written code"
description: "Install the Semgrep MCP server in an Aldena project and agents scan the code they write for security and correctness findings before a person reviews it."
url: "https://aldena.ai/mcp-servers/semgrep"
---

# Let agents run Semgrep on their own changes before anyone reviews them

Semgrep MCP server. Install the Semgrep MCP server in an Aldena project and agents scan the code they write for security and correctness findings before a person reviews it.

- **Sign-in**: Browser sign-in
- **Installs as**: `semgrep`
- **Transport**: Streamable HTTP
- **Last verified**: 2026-11-28

Semgrep is a static analysis tool that finds security vulnerabilities and correctness bugs by matching code against rules, and many teams already run it in CI. Its MCP server brings that scan to an agent: it checks code for findings, explains what each one means and which rule produced it, and acts as the Semgrep user who signed in.

In an Aldena project the best moment for the scan is before the pull request exists. An agent finishing a feature in its conversation's sandbox runs Semgrep on the files it changed, fixes each real finding, notes any it judges a false positive with the reason, and only then opens the pull request through the [GitHub connector](https://aldena.ai/integrations/github). Reviewers start from code that has already passed the checks they care about. When a security issue is reported, an agent can scan the affected area for the same pattern across the codebase and fix every instance in one change.

Each Semgrep tool has its own row in the project's [permissions](https://aldena.ai/features/human-in-the-loop). For checks against your own written policies, add the [Zenable MCP server](https://aldena.ai/mcp-servers/zenable); for smart contract work, Semgrep pairs with the [OpenZeppelin Solidity MCP server](https://aldena.ai/mcp-servers/openzeppelin-solidity).

## With Semgrep, your agents can

- Scan code for security vulnerabilities with Semgrep rules
- Catch correctness bugs that tests often miss
- Explain a finding and the rule that produced it

## Try asking

- “Scan the files changed in this branch with Semgrep and fix every high-severity finding before you open the pull request.”
- “Run Semgrep on src/api and explain each injection finding in plain words, with the line it points to.”
- “Check the new upload handler with Semgrep and tell me whether any finding is a false positive, and why.”

## Server

- **Server URL**: `https://mcp.semgrep.ai/mcp`
- **Website**: [semgrep.dev](https://semgrep.dev)
- **MCP docs**: [Semgrep MCP docs](https://docs.semgrep.dev/mcp)

## How to connect Semgrep

1. **Open Marketplace.** In a project, open Settings → Connectors → MCP servers and press Marketplace.
2. **Install Semgrep.** Search for Semgrep and press Install. Aldena adds it as `semgrep`.
3. **Sign in to Semgrep.** Open the sign-in link Aldena shows and approve. The server then acts as you.
4. **Let agents use it.** Agents find its tools with `mcp_search` and call them with `mcp_call`. Each tool gets its own row in the project's permissions.

## Related MCP servers

- [Zenable MCP server](https://aldena.ai/mcp-servers/zenable): Check code and configuration against policies.
- [Sentry MCP server](https://aldena.ai/mcp-servers/sentry): Investigate issues, events, traces, and releases.
- [Shopify MCP server](https://aldena.ai/mcp-servers/shopify): Manage products, orders, and storefront data.
- [Short.io MCP server](https://aldena.ai/mcp-servers/short-io): Create short links and read their click statistics.
- [All MCP servers](https://aldena.ai/mcp-servers)

## FAQ

### Why scan code an agent wrote?

Agents write code quickly and confidently, and the mistakes they make look like everyone else's: an unescaped query, a missing auth check, a secret in a test. Scanning with Semgrep inside the same task means those findings are fixed before review instead of becoming review comments.

### How does Semgrep sign in from Aldena?

With a browser sign-in to your Semgrep account. Install Semgrep from the project's MCP marketplace, open the link Aldena shows and approve. The server then acts as you, and each of its tools gets its own row in the project's permissions.

### Does Semgrep replace our CI security scan?

No, it moves a scan earlier. Keep the scan your CI runs on every pull request; the MCP server lets the agent find and fix problems while it is still writing, so the CI scan has less to catch and pull requests arrive cleaner.
