From 7c45a94c645c8d6d252e5f793947804b803635dc Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:23:08 +0100 Subject: [PATCH] docs(mcp): how to get an MCP token and connect a client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MCP endpoint accepts only MCP tokens (mcpt_…) from the MCP-Tokens page, which a signed-in person creates; the docs said to use the MCP server entry's access token, which the endpoint refuses, and gave a wrong URL. Portal API keys neither work at the endpoint nor can create MCP tokens. - Step by step: create the token at /mcp-tokens (also reachable in source-only deployments, where the overview card is hidden), add the server with the real endpoint (/mcp/mcp) to Claude Code or a JSON-configured client, check /mcp/health, and read the three 401 answers. - API-Schlüssel: a note that keys are not for MCP. Co-Authored-By: Claude Opus 5.5 --- docs/features/mcp-server.md | 88 ++++++++++++++++++++++++++++++++----- docs/guide/api-keys.md | 5 +++ 2 files changed, 81 insertions(+), 12 deletions(-) diff --git a/docs/features/mcp-server.md b/docs/features/mcp-server.md index b59c1b1..e249d12 100644 --- a/docs/features/mcp-server.md +++ b/docs/features/mcp-server.md @@ -23,11 +23,12 @@ There is no sidebar entry for MCP. The **Übersicht** (Overview) has an **MCP-Server** card: **Verwalten** (Manage) opens the MCP server page, and **MCP-Tokens** opens the bearer tokens an IDE or LLM client connects with. -::: info Not in source-only deployments +::: info Source-only deployments In a deployment that scans source code only, such as the pilot, the MCP-Server -card is hidden, so these pages are not reachable from the dashboard. The -evidence the MCP tools return is also in the evidence pack on each target's -page. +card is hidden. The token page still opens directly at `/mcp-tokens` +(for example `https://pruefwerk.breakpilot.com/mcp-tokens`), 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: @@ -37,7 +38,9 @@ From the MCP server page you can: - **Manage access tokens** -- reveal, copy, or regenerate bearer tokens for authentication - **Delete** servers that are no longer needed -Each registered server is assigned a random access token on creation. You use this token in your MCP client configuration for authenticated access. +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 @@ -102,15 +105,76 @@ manifest of sha256 checksums) is also served as one ZIP at ## Connecting an MCP Client -To connect an MCP-compatible tool (like Claude Desktop or Cursor) to your Prüfwerk MCP server: +An MCP client (Claude Code, Claude Desktop, Cursor, …) needs two things: the +endpoint URL and an MCP token. -1. Open **Verwalten** or **MCP-Tokens** on the overview's MCP-Server card and note the server endpoint URL and access token -2. In your MCP client, add a new server connection with: - - **URL** -- the MCP server endpoint (e.g. `https://your-pruefwerk-instance/mcp`) - - **Transport** -- Streamable HTTP - - **Authentication** -- Bearer token using the access token from Prüfwerk +### 1. Create an MCP token -Once connected, the LLM client automatically discovers the available tools and can call them in response to your questions. +1. Open **MCP-Tokens**: from the overview's MCP-Server card, or directly at + `/mcp-tokens` (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:///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:///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. diff --git a/docs/guide/api-keys.md b/docs/guide/api-keys.md index 35c2e92..b2f508d 100644 --- a/docs/guide/api-keys.md +++ b/docs/guide/api-keys.md @@ -39,6 +39,11 @@ Person vorbehalten. ## Gut zu wissen +- **Nicht für MCP.** Ein LLM-Werkzeug (Claude Code, Cursor, …) meldet sich an + der MCP-Schnittstelle mit einem eigenen MCP-Token (`mcpt_…`) an, nicht mit + einem API-Schlüssel. MCP-Tokens legt eine angemeldete Person im Dashboard + unter `/mcp-tokens` an; siehe [MCP-Schnittstelle](/features/mcp-server#connecting-an-mcp-client). + - **Widerruf wirkt nach höchstens 60 Sekunden.** Prüfwerk merkt sich das Prüfergebnis eines Schlüssels eine Minute lang. - **Nachvollziehbarkeit:** Änderungen mit einem Schlüssel stehen im Verlauf