Files
pruefwerk/docs/features/mcp-server.md
T
sharangandClaude Opus 5.5 29e38c8b80
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m11s
CI / Deploy Dashboard (push) Successful in 7m0s
CI / Deploy Agent (push) Successful in 9m19s
feat(dashboard): MCP-Tokens in the sidebar, also in source-only deployments (#969)
The only link to the MCP tokens was the overview's MCP-Server card, which a
source-only deployment (prod) hides with the runtime sections. The MCP
endpoint serves such a deployment all the same, so there a token could only
be created by typing /mcp-tokens. The sidebar now has an MCP-Tokens entry
that source-only mode leaves enabled; the overview card is unchanged.

The docs name the entry instead of the bare URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 14:10:25 +00:00

193 lines
8.6 KiB
Markdown

# MCP Integration
Prüfwerk exposes your security data through the Model Context Protocol (MCP), allowing LLM-powered tools to query your findings, SBOM data, and DAST results directly.
## What is MCP?
The Model Context Protocol is an open standard that lets AI tools (like Claude, Cursor, or custom agents) connect to external data sources. Think of it as a way for your LLM to "see" your security data without you having to copy and paste it.
When an MCP client is connected to Prüfwerk, you can ask questions like "Show me all critical findings" or "What vulnerable packages does this repo have?" and the LLM will query Prüfwerk directly to get the answer.
## Why It Matters
Without MCP, getting security data into an LLM conversation requires manual effort -- exporting reports, copying findings, pasting context. With MCP:
- Your AI coding assistant can check for security issues as you write code
- You can ask natural language questions about your security posture
- Security data stays up to date because it is queried live, not exported statically
- Multiple team members can connect their own LLM tools to the same data
## Managing MCP Servers
**MCP-Tokens** in the sidebar opens the bearer tokens an IDE or LLM client
connects with. The **Übersicht** (Overview) also has an **MCP-Server** card:
**Verwalten** (Manage) opens the MCP server page, and **MCP-Tokens** the same
token page.
::: info Source-only deployments
In a deployment that scans source code only, such as the pilot, the MCP-Server
card is hidden; the sidebar's **MCP-Tokens** stays, and the MCP endpoint answers
as usual. The evidence the MCP tools return is also in the evidence pack on
each target's page.
:::
From the MCP server page you can:
- **Register** new MCP server instances with their endpoint URL, transport type, and port
- **View** server configuration, enabled tools, and status
- **Manage access tokens** -- reveal, copy, or regenerate bearer tokens for authentication
- **Delete** servers that are no longer needed
Each registered server entry has an access token of its own. The MCP endpoint
does not accept it: a client signs in with a token from **MCP-Tokens**
(see [Connecting an MCP Client](#connecting-an-mcp-client)).
### Server status
The card shows **running** once the dashboard has reached the server's health
endpoint. It probes `<endpoint>/health` and, for an endpoint that ends in
`/mcp`, also the path with the prefix stripped — which is what a
prefix-routing ingress needs. Where neither applies, set `MCP_HEALTH_URL` to
the absolute URL to probe for the default server (staging:
`https://pruefwerk-stage.breakpilot.com/mcp/health`). A server whose health
endpoint cannot be reached is shown as stopped; the tools still work if the
endpoint itself is reachable from your client.
## Available Tools
The MCP server exposes these tools, among others (pentest tools are not listed here), which LLM clients can discover and call:
### Targets and Scans
Start here: each target's id is the `repo_id` / `target_id` the other tools take.
| Tool | Description |
|------|-------------|
| `list_targets` | The tenant's targets with id, name, type, artifact kinds and the detected type. No credentials are returned. |
| `get_scan_results` | A target's scan runs, newest first (default 10, max 50): status, times, new findings, error, and the stages not run with their reasons. |
| `list_cves` | The CVE alerts of a target's dependencies and firmware libraries, highest CVSS first. |
### Compliance Tools
| Tool | Description |
|------|-------------|
| `get_control_mapping` | The target's CRA Annex I control mapping as an OSCAL 1.1 assessment-results document. |
| `oscal_assessment` | The same document (kept for existing clients). |
The whole evidence set (OSCAL, both SBOM formats, findings, CVE alerts and a
manifest of sha256 checksums) is also served as one ZIP at
`GET /api/v1/targets/{id}/evidence-pack`.
### Findings Tools
| Tool | Description |
|------|-------------|
| `list_findings` | Query findings with optional filters for repository, severity, status, and scan type. Returns up to 200 results. |
| `get_finding` | Retrieve a single finding by its ID. |
| `findings_summary` | Get finding counts grouped by severity and status, optionally filtered by repository. |
### SBOM Tools
| Tool | Description |
|------|-------------|
| `get_sbom` | A target's whole SBOM as one CycloneDX 1.6 (default) or SPDX 2.3 document, the same the API exports, with the licences the workspace confirmed. |
| `list_sbom_packages` | List SBOM packages with filters for repository, vulnerabilities, package manager, and license (the detected licence); each package carries its confirmed licence. |
| `sbom_vuln_report` | Generate a vulnerability report for a repository showing all packages with known CVEs. |
| `license_check` | What the workspace's licence policy says about a target's components: how many are allowed, wait for a legal review or are forbidden, and the open ones with their reasons. |
| `get_third_party_notices` | A target's third-party notices (`THIRD-PARTY-NOTICES`) as text or markdown: shipped components by licence, with copyright and licence texts or links. |
### DAST Tools
| Tool | Description |
|------|-------------|
| `list_dast_findings` | Query DAST findings with filters for target, scan run, severity, exploitability, and vulnerability type. |
| `dast_scan_summary` | Get a summary of recent DAST scan runs and finding counts. |
## Connecting an MCP Client
An MCP client (Claude Code, Claude Desktop, Cursor, …) needs two things: the
endpoint URL and an MCP token.
### 1. Create an MCP token
1. Open **MCP-Tokens** in the sidebar (the page is `/mcp-tokens`, on prod
`https://pruefwerk.breakpilot.com/mcp-tokens`).
2. Choose **Create Token**, give it a name that says where it is used (for
example "Claude Code, laptop"), and choose **Create**.
3. Copy the token from the banner. It starts with `mcpt_` and is shown **only
once**; Prüfwerk keeps just its hash. If it is lost, create a new one.
Creating and revoking tokens needs a role that may change data; read-only roles
see the list only. A token belongs to the organisation it was created in and
gives the client that organisation's data. The list shows when each token was
last used. **Revoke** ends a token at once.
::: warning Portal API keys do not work here
The MCP endpoint accepts only MCP tokens (`mcpt_…`). An API key from the portal
(`bp_…`, see [API-Schlüssel](/guide/api-keys)) is refused, and an API key
cannot create MCP tokens either: that takes a person signed in to the
dashboard. The server entry's access token on the MCP server page is not
accepted either.
:::
### 2. Add the server to your client
- **URL**: `https://<your-pruefwerk>/mcp/mcp` (prod:
`https://pruefwerk.breakpilot.com/mcp/mcp`, staging:
`https://pruefwerk-stage.breakpilot.com/mcp/mcp`)
- **Transport**: Streamable HTTP
- **Header**: `Authorization: Bearer mcpt_…`
Claude Code:
```sh
claude mcp add --transport http pruefwerk https://pruefwerk.breakpilot.com/mcp/mcp \
--header "Authorization: Bearer mcpt_…"
```
A client configured with JSON (Cursor, Claude Desktop with remote servers):
```json
{
"mcpServers": {
"pruefwerk": {
"type": "http",
"url": "https://pruefwerk.breakpilot.com/mcp/mcp",
"headers": { "Authorization": "Bearer mcpt_…" }
}
}
}
```
Keep the token out of shared or committed config files; use your client's
secret or environment-variable support where it has one.
Once connected, the client discovers the tools above and calls them in response
to your questions.
### 3. Check the connection
`https://<your-pruefwerk>/mcp/health` answers `ok` without a token. If the
client still cannot connect, the endpoint's 401 answer says why:
| Answer | Meaning |
|---|---|
| `Missing bearer token` | The `Authorization` header is not sent. |
| `Invalid token format` | The value is not an MCP token (`mcpt_…`), for example a portal API key. |
| `Invalid or revoked token` | The token was revoked, mistyped or created in another installation (stage and prod have separate tokens). |
::: tip
The MCP server is read-only -- it only queries data. It cannot modify findings, trigger scans, or change configuration. This makes it safe to expose to LLM clients.
:::
## Example Queries
Once your MCP client is connected, you can ask questions like:
- "Show me all critical findings across my repositories"
- "What vulnerable packages does the backend service have?"
- "Give me a summary of DAST findings for the staging target"
- "How many open findings do we have by severity?"
The LLM translates your natural language question into the appropriate tool call and presents the results in a readable format.