Skip to main content
Glama
redactic-mcp

redactic-mcp

Official
by redactic
README.md
# Redactic MCP server

Mask, restore and black out personal data in text and files from Claude Desktop, Claude Code,
Gemini CLI, Cursor and any other MCP client.

The server is a thin client of the API of [Redactic](https://redactic.eu/ai-assistants/) (redactic.eu). Your text and
files are sent to Redactic servers in the European Union, where the personal data is detected.
The AI model receives labels such as `⟦PERSON_1⟧`. The map that turns the labels back into the
original values stays in the memory of this server, on your computer.

## What you need

- A Redactic workspace and an API key. Create the key in Redactic under Admin, API. It starts
  with `rk_live_` and is shown once. Every snippet below has `rk_live_...` where your key goes.
- For every client except the Claude Desktop extension: Node.js 18 or later.
- The folders in which the file tools may read and write, as full paths. Separate several
  folders with `:` on macOS and Linux and with `;` on Windows. Inside a JSON file, write each
  Windows backslash twice.

| System | Folder example | Inside a JSON file |
|---|---|---|
| macOS | `/Users/you/Documents/redactic` | `"/Users/you/Documents/redactic"` |
| Windows | `C:\Users\you\Documents\redactic` | `"C:\\Users\\you\\Documents\\redactic"` |
| Linux | `/home/you/Documents/redactic` | `"/home/you/Documents/redactic"` |

## Install

The same instructions are on [redactic.eu/developers](https://redactic.eu/developers/#mcp-install).

### Claude Desktop

With the extension: download `redactic-<version>.mcpb` from
[redactic.eu/developers](https://redactic.eu/developers/#mcp-desktop) and compare its SHA-256
with the one printed on that page. Open the file, or drag it into Claude Desktop, or choose
Settings, Extensions, Advanced settings, Install Extension. Claude Desktop asks for the API key,
which it keeps in the keychain of your system, and for the folders the file tools may use. Claude
Desktop brings its own Node.js, so nothing else needs to be installed.

With the configuration file, which needs Node.js: in Claude Desktop choose Settings, Developer,
Edit Config. The file it opens is:

- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- Linux: `~/.config/Claude/claude_desktop_config.json`

Add the server, save the file, then quit Claude Desktop completely and open it again.

```json
{
  "mcpServers": {
    "redactic": {
      "command": "npx",
      "args": ["-y", "@redactic/mcp"],
      "env": {
        "REDACTIC_API_KEY": "rk_live_...",
        "REDACTIC_ALLOWED_DIRS": "/Users/you/Documents/redactic"
      }
    }
  }
}
```

On Windows, the folder line reads:

```json
"REDACTIC_ALLOWED_DIRS": "C:\\Users\\you\\Documents\\redactic"
```

### Claude Code

Run this command in a terminal. Keep the options before the name `redactic`: a name that comes
right after `--env` is read as one more variable and the command fails. Everything after `--` is
the command that starts the server. With `--scope user` the server is available in all your
projects.

```bash
claude mcp add --env REDACTIC_API_KEY=rk_live_... --env REDACTIC_ALLOWED_DIRS="$HOME/Documents/redactic" --transport stdio --scope user redactic -- npx -y @redactic/mcp
```

On Windows, write the folder as a Windows path:

```bash
claude mcp add --env REDACTIC_API_KEY=rk_live_... --env REDACTIC_ALLOWED_DIRS="C:\Users\you\Documents\redactic" --transport stdio --scope user redactic -- npx -y @redactic/mcp
```

A team can share the server in the `.mcp.json` file of a project and keep the key out of it.
Each person sets `REDACTIC_API_KEY` in their own environment, and Claude Code reads it:

```json
{
  "mcpServers": {
    "redactic": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@redactic/mcp"],
      "env": {
        "REDACTIC_API_KEY": "${REDACTIC_API_KEY}",
        "REDACTIC_ALLOWED_DIRS": "${REDACTIC_ALLOWED_DIRS}"
      }
    }
  }
}
```

### Gemini CLI

Add the server to `~/.gemini/settings.json` for all projects, or to `.gemini/settings.json` in
one project.

Write the key in the `env` block. Gemini CLI removes from the environment it passes to a server
every variable whose name contains KEY, TOKEN or SECRET, so a key set only in your shell does not
reach the server.

```json
{
  "mcpServers": {
    "redactic": {
      "command": "npx",
      "args": ["-y", "@redactic/mcp"],
      "env": {
        "REDACTIC_API_KEY": "rk_live_...",
        "REDACTIC_ALLOWED_DIRS": "/home/you/Documents/redactic"
      }
    }
  }
}
```

On Windows, the folder line reads:

```json
"REDACTIC_ALLOWED_DIRS": "C:\\Users\\you\\Documents\\redactic"
```

### Cursor

Add the server to `~/.cursor/mcp.json` for all projects, or to `.cursor/mcp.json` in one
project. Cursor can read the key from your environment with `${env:REDACTIC_API_KEY}`.

```json
{
  "mcpServers": {
    "redactic": {
      "command": "npx",
      "args": ["-y", "@redactic/mcp"],
      "env": {
        "REDACTIC_API_KEY": "${env:REDACTIC_API_KEY}",
        "REDACTIC_ALLOWED_DIRS": "/Users/you/Documents/redactic"
      }
    }
  }
}
```

The [developers page](https://redactic.eu/developers/#mcp-cursor) also has an "Add to Cursor"
link. It fills in the server with placeholder values: replace the key and the folder before you
save.

### ChatGPT, Microsoft 365 Copilot and claude.ai

This server runs on your computer, so an assistant in the browser cannot use it. ChatGPT and
Microsoft 365 Copilot connect to remote MCP servers. A remote Redactic server is in preparation.

A file that you upload into a web chat reaches the model as it is. Mask it in Redactic first,
then upload the masked copy.

## Settings

| Variable | Meaning |
|---|---|
| `REDACTIC_API_KEY` | Your API key. Required. |
| `REDACTIC_ALLOWED_DIRS` | The folders in which the file tools may read and write. Separate several folders with `:` on macOS and Linux and with `;` on Windows. Folders can also be given as command line arguments after the name of the server, one argument each; the Claude Desktop extension passes them this way. Without any folder the file tools answer with the instruction to set one. |
| `REDACTIC_REGIONS` | Default countries of your documents, for example `IT,DE` (at most four). Without it Redactic detects the country. |
| `REDACTIC_LANGUAGE` | Default language hint, for example `it`. |
| `REDACTIC_DETECTION_MODE` | Default detection mode: `accurate` or `fast`. |
| `REDACTIC_RESTORE_INLINE` | Set to `1` to receive restored text in the conversation. The model then reads the original values. |
| `REDACTIC_API_URL` | Address of the API, for test environments. |

## Tools

| Tool | What it does |
|---|---|
| `mask_text` | Masks a text and returns the masked text with a `session_id`. Pass the same `session_id` again and each person keeps the same label for the whole conversation. |
| `restore_text` | Puts the values back into a text with labels and writes the result to a new file. It returns the path of the file. |
| `mask_file` | Masks a file and saves `<name> (masked)` next to the original. It returns a `session_id` for `restore_file`. |
| `restore_file` | Puts the values back into a masked text, Word or Excel file and saves `<name> (restored)`. It works on your computer and does not call the API. |
| `redact_file` | Blacks out a PDF or an image for good and saves `<name> (redacted)` with its certificate. |
| `check_file` | Checks a PDF or Word file for hidden data: text under shapes, metadata, older revisions, comments, attachments. |
| `get_usage` | Returns the usage of the month and the limits of the workspace. |

Every masking tool accepts `detection_mode`: `accurate` (the default) takes a second look at
places, addresses and organisations, and `fast` skips it and answers sooner.

## How your data is handled

- A text is processed in memory on Redactic servers in the EU and is gone when the answer is sent.
- A file is deleted from the Redactic servers as soon as the server has saved the result on your
  computer.
- The restore map is kept in the memory of this server for eight hours after its last use. It is
  never written to disk, never logged and never part of a tool result. When the server stops, the
  map is gone, so restore what you need before you close your MCP client.
- `restore_text` writes to a file and returns its path, so the original values stay out of the
  conversation.
- No tool overwrites a file. A new file gets a new name, with a number when the name is taken.
- A masked PDF cannot be restored. Keep the original PDF when you may need its values again.

## Limits

One document is processed at a time for each API key. When Redactic is busy the server waits and
tries again for up to a minute, then tells you when to retry. The monthly allowance is the one of
your Redactic plan; `get_usage` shows where you stand.

## Development

```bash
npm install
npm test
npm run build:mcpb
```

The tests run against a fake API on localhost and need no key. `npm run build:mcpb` builds
`dist/redactic-<version>.mcpb` and prints its SHA-256.

## Licence

MIT, see [LICENSE](LICENSE).