---
title: "MCP server"
description: "Give Claude Code, Cursor or VS Code scoped access to findings, assets, posture and the check catalogue, locally with trustivan mcp or at the hosted endpoint."
---

TRUSTIVAN is a [Model Context Protocol](https://modelcontextprotocol.io)
server. An assistant that speaks MCP can search your findings, explain a risk
score, look a rule up in the check catalogue, read your posture and compliance
status, and, if you let it, suppress a finding, set an asset's owner or open a
fix pull request. There are two ways to connect, with the same tools and the
same rules:

- **[Hosted endpoint](#hosted-endpoint)**: the assistant connects to
  `https://app.trustivan.com/api/v1/mcp` with an API key. Nothing to install.
- **[Local server](#local-server)**: the assistant starts `trustivan mcp`, from
  the [`trustivan` CLI](/cli-reference/trustivan), as a subprocess.

<Note>
This is TRUSTIVAN serving **your security data to your assistant**. It is not
the NHI Security feature that governs **other** MCP servers your agents call;
for that, see [MCP server guardrails](/nhi-security/mcp-server-guardrails).
</Note>

## How it works

Both are one server (tools only), built from the same code, and a client of
the [public API](/api-reference/overview) and nothing else: each tool makes
ordinary API requests with your key. The hosted endpoint sends those requests
to the API it runs in, without a network hop; the local server sends them over
HTTPS. Neither holds a database credential or adds authority of its own:

- **The API key decides what the assistant can see and do.** Every tool calls
  the API with the key you configure. A tool whose scope the key lacks is
  refused by the API, and the assistant is told which scope is missing.
- **The API's per-credential rate limit applies.** It is 600 requests a minute
  per key by default (`RATE_LIMIT_PER_MINUTE`, enforced when Redis is
  configured). A refused call tells the assistant when to retry.
- **Every change is recorded as the key.** A suppression made through the
  assistant appears in the finding's history with the API key as the actor,
  exactly as one made with `curl` would.
- **No tool starts a scan**, so an assistant cannot point TRUSTIVAN at a target
  you have not verified.

## Hosted endpoint

`POST https://app.trustivan.com/api/v1/mcp` (on a self-hosted deployment,
`/api/v1/mcp` on its address). It speaks MCP's streamable HTTP transport,
protocol revisions 2025-06-18 and 2025-03-26.

1. Under **Settings, API keys**, create a key with the [scopes](#scopes) of the
   tools you want. For read-only use, `findings:read` and `assets:read` are
   enough. The endpoint takes an API key only: a signed-in session or a
   workload credential is refused.
2. Add the server to your assistant, sending the key as
   `Authorization: Bearer twk_...`:

<Tabs>
  <Tab title="Claude Code">
```bash
claude mcp add --transport http trustivan https://app.trustivan.com/api/v1/mcp \
  --header "Authorization: Bearer twk_..."
```
  </Tab>
  <Tab title="Claude Desktop">
Claude Desktop adds a remote server as a connector that signs in with OAuth,
which this endpoint does not offer: it takes an API key. Use the
[local server](#local-server) in Claude Desktop, or a bridge that runs locally
and sends the header, such as the `mcp-remote` npm package (a third-party
package; TRUSTIVAN does not test it):

```json
{
  "mcpServers": {
    "trustivan": {
      "command": "npx",
      "args": ["mcp-remote", "https://app.trustivan.com/api/v1/mcp",
               "--header", "Authorization:${AUTH_HEADER}"],
      "env": { "AUTH_HEADER": "Bearer twk_..." }
    }
  }
}
```
  </Tab>
  <Tab title="Cursor">
In `~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project. Do not commit a
project file that holds a key.

```json
{
  "mcpServers": {
    "trustivan": {
      "url": "https://app.trustivan.com/api/v1/mcp",
      "headers": { "Authorization": "Bearer twk_..." }
    }
  }
}
```
  </Tab>
  <Tab title="VS Code">
In `.vscode/mcp.json`. The key is asked for once and stored by VS Code, not
written to the file.

```json
{
  "inputs": [
    { "type": "promptString", "id": "trustivan-key", "description": "TRUSTIVAN API key", "password": true }
  ],
  "servers": {
    "trustivan": {
      "type": "http",
      "url": "https://app.trustivan.com/api/v1/mcp",
      "headers": { "Authorization": "Bearer ${input:trustivan-key}" }
    }
  }
}
```
  </Tab>
</Tabs>

What is different from the local server:

- **No `--read-only`.** Every tool is listed; give the key no write scope and
  the API refuses every write. `tools/list` shows all sixteen tools whatever the
  key holds, as the local server does.
- **The rate limit counts more.** Each request to the endpoint counts against
  the key's per-minute limit, and so does each API call a tool makes (one to
  three), where the local server counts only the API calls.
- **Stateless.** No `Mcp-Session-Id` is issued and every request is
  authenticated on its own. Answers are always JSON; there is no event stream
  (`GET` and `DELETE` answer 405).
- **Browsers are refused by origin.** A request carrying an `Origin` header other
  than your dashboard's is refused with 403, which is what stops a web page
  from driving the endpoint through a visitor's browser (DNS rebinding).
  Assistant clients send no `Origin`.
- **Bounded.** A message may be at most 1 MiB; a batch (a JSON array) is
  refused. A client that sends `MCP-Protocol-Version` must name 2025-06-18 or
  2025-03-26 (or 2024-11-05, which is accepted, though that revision's own
  HTTP transport is not offered).

See [`POST /mcp`](/api-reference/endpoints#mcp) in the API reference for the exact
responses.

## Local server

`trustivan mcp` speaks MCP over standard input and output (protocol revisions
2024-11-05, 2025-03-26 and 2025-06-18).

1. [Install the `trustivan` CLI](/cli-reference/trustivan#install). Builds exist
   for Linux and macOS on amd64 and arm64, and for Windows on amd64.
2. Under **Settings, API keys**, create a key with the [scopes](#scopes) of the
   tools you want. For read-only use, `findings:read` and `assets:read` are
   enough.
3. Add the server to your assistant, as below. Set `TRUSTIVAN_URL` to your
   deployment when it is not `https://app.trustivan.com`.

Add `--read-only` after `mcp` to offer no tool that changes anything, whatever
the key's scopes.

<Tabs>
  <Tab title="Claude Code">
```bash
claude mcp add --transport stdio \
  --env TRUSTIVAN_API_KEY=twk_... \
  --env TRUSTIVAN_URL=https://app.trustivan.com \
  trustivan -- trustivan mcp
```
  </Tab>
  <Tab title="Claude Desktop">
In `claude_desktop_config.json` (Settings, Developer, Edit Config). Use the
full path to the binary; Claude Desktop does not read your shell's `PATH`. On
Windows that is the path to `trustivan.exe`, with each backslash doubled.

```json
{
  "mcpServers": {
    "trustivan": {
      "command": "/usr/local/bin/trustivan",
      "args": ["mcp"],
      "env": {
        "TRUSTIVAN_API_KEY": "twk_...",
        "TRUSTIVAN_URL": "https://app.trustivan.com"
      }
    }
  }
}
```
  </Tab>
  <Tab title="Cursor">
In `~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project. Do not commit a
project file that holds a key.

```json
{
  "mcpServers": {
    "trustivan": {
      "command": "trustivan",
      "args": ["mcp"],
      "env": {
        "TRUSTIVAN_API_KEY": "twk_...",
        "TRUSTIVAN_URL": "https://app.trustivan.com"
      }
    }
  }
}
```
  </Tab>
  <Tab title="VS Code">
In `.vscode/mcp.json`. The key is asked for once and stored by VS Code, not
written to the file.

```json
{
  "inputs": [
    { "type": "promptString", "id": "trustivan-key", "description": "TRUSTIVAN API key", "password": true }
  ],
  "servers": {
    "trustivan": {
      "type": "stdio",
      "command": "trustivan",
      "args": ["mcp"],
      "env": {
        "TRUSTIVAN_API_KEY": "${input:trustivan-key}",
        "TRUSTIVAN_URL": "https://app.trustivan.com"
      }
    }
  }
}
```
  </Tab>
</Tabs>

These, and the hosted configurations above, follow each client's documented
configuration format. TRUSTIVAN's tests run the protocol handshake and the tools
against the API over both transports; they do not drive the four clients
themselves.

## Tools

Every argument is checked against the schema the assistant is shown before
any request is made. Lists return at most 50 rows (20 by default) with a
`next_cursor` for the next page, and no answer is larger than 200 KiB.

{/* tools:start — generated by mcp.ToolsMarkdown; edit the code, then paste */}
| Tool | What it does | Scopes it needs | Changes data |
|---|---|---|---|
| `search_findings` | List this organization's findings, worst first, with filters. Each row has its id (for get_finding), severity, status, risk score and where it was found. | `findings:read` | no |
| `get_finding` | One finding in full: what was found and where, the fix the scanner reported (fixed version, resolution, remediation), its risk score, and for a secret, misconfiguration or static-analysis finding the TRUSTIVAN catalogue entry for its check (what, why, how to fix). | `findings:read` | no |
| `explain_risk_score` | Why a finding has the risk score it has: each factor (severity, exploitation, malicious package, running, exposure, privilege, fix available, and the dependency-path, entrypoint, reachability, criticality and attack-path multipliers) with the points it added, its source and how current that source is. | `findings:read` | no |
| `list_attack_paths` | Attack paths through the organization's security graph, highest score first: internet exposure, an exploitable workload, the identities and credentials it holds, and a sensitive target (cluster-admin, a cloud administrator, a public data store, the nodes under a container, a credential). Score = 100 × exploitability × exposure × blast radius. Also says when the graph was built and what it was drawn from, so an empty answer is explained. | `findings:read` | no |
| `get_attack_path` | One attack path, hop by hop: the edge crossed, the node reached and why, the foothold's best weaknesses, the factors each hop contributed, and the findings the path depends on (fixing any one of the foothold's weaknesses or lateral findings breaks it). | `findings:read` | no |
| `explore_security_graph` | The security graph around one node (by the key an attack path step or an earlier answer gave) or around an asset's nodes: every node within depth edges in either direction and the edges among them, each edge with how surely it can be crossed and why. Nodes include workloads, images, service accounts, cloud identities, NHI Security identities, credentials and the targets attack paths end at. At most 200 nodes. | `findings:read` | no |
| `list_assets` | The organization's assets (images, repositories, cloud resources, clusters, workloads) with environment, criticality, owner and when each was last scanned. | `assets:read` | no |
| `get_asset` | One asset with its open findings counted by severity. | `assets:read` | no |
| `get_posture` | The organization's posture now: open findings by kind, known-exploited and fixable counts, mean time to resolve, thirty days of opened and resolved, assets by kind, and the assets that need attention first. | `assets:read` | no |
| `compliance_status` | With no framework: the frameworks TRUSTIVAN maps evidence to. With one: each control's status (evidence_present, issues_open, no_data or not_covered) and open issues. This is evidence mapping, not an attestation or certification. | `assets:read` | no |
| `search_checks` | Find checks TRUSTIVAN runs (cloud, Kubernetes, static analysis, secrets) by words in their id, title or category. | `findings:read` | no |
| `get_check` | One check from the catalogue by id or slug: what it checks, why it matters, how to fix it, and the benchmark controls it maps to. | `findings:read` | no |
| `suppress_finding` | Accept the risk of a finding until a date: it leaves the backlog and the gate until then. Needs a reason and an expiry; recorded in the finding's history as done by this API key. | `findings:write`, `findings:suppress` | yes, only with `confirm: true` |
| `assign_finding` | Give a finding to a member of this organization to work, or with no user_id take it from whoever holds it. Recorded in the finding's history. | `findings:write` | yes, only with `confirm: true` |
| `set_asset_owner` | Assign an asset to an owner (a team or person), which is how TRUSTIVAN routes its findings to a team; assign_finding gives one finding to one member. | `assets:write` | yes, only with `confirm: true` |
| `open_fix_pr` | Open a pull request that upgrades the vulnerable dependency behind a finding, on a repository whose code host is linked and has fix pull requests turned on. Without confirm, says what the pull request would change. | `findings:read`, `findings:write` | yes, only with `confirm: true` |
{/* tools:end */}

Two kinds of "assign": `set_asset_owner` routes every finding on an asset to a
team, and `assign_finding` gives one finding to one member of the organization
(`search_findings` with `assignee` lists what someone holds).

## Scopes

The table above names the scopes each tool needs. Grant the fewest that cover
what you want the assistant to do:

| Use | Scopes |
|---|---|
| Read findings, risk scores and the catalogue | `findings:read` |
| Read assets, posture and compliance status | `assets:read` |
| Suppress findings | add `findings:write` and `findings:suppress` |
| Set asset owners | add `assets:write` |
| Open fix pull requests | add `findings:write` |

See [Scopes](/api-reference/scopes) for what each one allows over the API.

## What the assistant is shown, and what it is not

- **Scanned text is labelled as untrusted.** A finding's title, description,
  package and path, an asset's name and owner, a fix pull request's branch:
  everything that came from a repository, an image, a cloud account, an
  advisory or a person sits under an `untrusted` key in each answer, and the
  server tells the client at start-up to treat those values as data, never as
  instructions. Control characters and invisible formatting characters
  (bidirectional overrides, zero-width characters) are removed, and the text is
  cut at 300 characters (2,000 for a description) with a visible
  `[truncated]`.
- **No secret value is returned.** TRUSTIVAN never stores a detected
  credential, only a redacted excerpt and a digest, and the MCP server does not
  pass on even those. It also leaves out a static-analysis finding's code
  snippet and a dynamic scan's request and response excerpts, which can carry
  credentials. The API key itself, and anything shaped like a TRUSTIVAN key, is
  removed from every answer and error.
- **Changes wait for `confirm: true`.** Called without it, a write tool changes
  nothing and returns what it would do, so the assistant can show you first.
  This is a speed bump, not a security boundary: a model can be told to set
  `confirm`. What bounds the assistant is the key's scopes, `--read-only` (local
  server), and your client's own approval prompt for each tool call. Keep write scopes off a
  key you hand to an assistant unless you want it able to write.

## Related

- [`trustivan` CLI](/cli-reference/trustivan)
- [Scopes](/api-reference/scopes)
- [Rotate an API key](/how-to/rotate-an-api-key)
- [Suppression](/concepts/suppression)
- [Risk scoring](/concepts/risk-scoring)
- [Fix pull requests](/integrations/fix-pull-requests)
