This endpoint accepted anonymous traffic historically and now returns 401 without a token. Get a free one at semgrep.dev → Settings → Tokens.
Why not just ask the model?
Because LLMs are extremely good at producing security findings that sound right. Asked to review code for vulnerabilities, a model will reliably return a well-formatted list — some of it real, some of it invented, with no signal distinguishing the two. Splitting the job fixes that: findings come from the scanner; the model’s job is triage, not imagination. The system prompt below is written to enforce exactly that boundary.Build it
1
Install and set both keys
2
Constrain the model to what the scanner found
3
Build the agent with a Bearer token
mcp_api_key="env:SEMGREP_APP_TOKEN" sends Authorization: Bearer <token>. The env: prefix is resolved when the connection is made, so the token never appears in your source or in a serialized agent config.4
Give it something to scan
5
Fail fast when the token is missing
Putting it in a review pipeline
The single-agent version reviews a snippet. To review a diff, feed it the changed files and let a second agent decide what blocks the merge:Next
- MCP in a multi-agent workflow — the full one-server-per-agent pattern.
- Authentication patterns — Bearer, custom header, query parameter, path, OAuth.