Metadata-Version: 2.5
Name: datafog-mcp
Version: 1.1.0
Summary: Local PII and credential detection and redaction for AI agents (MCP server)
Project-URL: Homepage, https://datafog.ai
Project-URL: Repository, https://github.com/DataFog/datafog-mcp
Project-URL: Documentation, https://docs.datafog.ai
Author-email: Sid Mohan <hi@datafog.ai>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,mcp,pii,privacy,redaction
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: datafog-core<1.8,>=1.7.0
Requires-Dist: fastmcp<4,>=3
Requires-Dist: mcp>=1.2.0
Requires-Dist: pydantic<3,>=2
Requires-Dist: tomli>=2; python_version < '3.11'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://datafog.ai"><img src="docs/assets/datafog-icon.svg" width="72" height="72" alt="DataFog"></a>
</p>

<h1 align="center">DataFog MCP</h1>

<p align="center"><strong>Check sensitive files before an AI agent reads them.</strong></p>

<p align="center">
  <a href="https://pypi.org/project/datafog-mcp/"><img src="https://img.shields.io/pypi/v/datafog-mcp?style=flat-square&amp;color=E8A84C" alt="PyPI version"></a>
  <a href="https://pypi.org/project/datafog-mcp/"><img src="https://img.shields.io/badge/python-3.10%2B-3776AB?style=flat-square" alt="Python 3.10 or later"></a>
  <a href="https://github.com/DataFog/datafog-mcp/actions/workflows/ci.yml"><img src="https://github.com/DataFog/datafog-mcp/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-E8A84C?style=flat-square" alt="MIT license"></a>
</p>

<p align="center">
  <a href="#quickstart">Quickstart</a> ·
  <a href="#see-it-in-action">Demos</a> ·
  <a href="docs/policy.md">Policy</a> ·
  <a href="docs/privacy.md">Privacy</a> ·
  <a href="CONTRIBUTING.md">Contributing</a>
</p>

DataFog MCP lets an AI agent detect personal data and credentials in local files, then create a copy with matched values redacted, masked, or removed. Detection runs on [DataFog Core](https://github.com/DataFog/datafog-core). Tool responses contain counts, locations, and copy paths—never file contents or matched values.

**Stable v1.1.0.** Tested with Claude Code. CI runs on Linux; development uses macOS. Windows and other MCP clients have not been validated.

## Quickstart

Requires **Python 3.10+** and [uv](https://docs.astral.sh/uv/).

On an Intel Mac, also install a [Rust toolchain](https://rustup.rs/) first: datafog-core 1.7 has no prebuilt package for Intel Macs, so the install builds it from source. Apple Silicon, Linux, and Windows install prebuilt packages.

**1. Install DataFog MCP.**

```bash
uv tool install datafog-mcp
```

**2. Choose which folders DataFog can access.**

```bash
datafog-mcp roots --edit
```

List one allowed directory per line, such as `~/Downloads/customer-exports`. Without a roots file or override, DataFog allows access to your home directory. Narrow this to the folders you need. [Allowed roots and owner policy →](docs/policy.md)

**3. Connect Claude Code.**

```bash
claude mcp add datafog --scope user -- "$(command -v datafog-mcp)"
```

Start a new Claude Code session and ask:

> Scan customers.csv with DataFog before opening it. Tell me what types of sensitive data you find, without reading the file into the conversation.

The MCP client must run on the machine that holds the files. A cloud-hosted agent cannot reach this local stdio server directly.

## See it in action

These clips use fictional customer records. Each shows a real Claude Code interaction with DataFog MCP. Try the [sample CSV](docs/demo/customers.csv) and [sample text file](docs/demo/contact.txt) inside an allowed folder.

### Scan a customer export

Check a customer export for emails and phone numbers without returning the matched values.

![Claude Code checks customers.csv and reports three emails and three phone numbers.](docs/demo/scan.gif)

### Create a redacted copy

Replace emails and phone numbers with typed labels in a new copy. The original stays intact, and existing copies are never overwritten.

![Claude Code creates customers_redacted.csv with three emails and three phone numbers redacted, keeping the original unchanged.](docs/demo/transform.gif)

These demos select email and phone checks; phone detection is opt-in. An explicit selection **replaces** the defaults. Other columns remain unchanged.

## Five tools, one local workflow

| Tool | Use it to |
|---|---|
| `datafog_policy` | Discover allowed roots, routine scope, output destination, and workflow guidance. |
| `datafog_scan` | Get finding types, counts, and locations. |
| `datafog_redact` | Replace matched values with labels such as `[EMAIL]`. |
| `datafog_mask` | Replace each matched value character for character. |
| `datafog_remove` | Delete matched values without leaving a marker. |

Scans return individual locations for up to **700 findings**. Above that, counts remain complete, but individual findings are omitted. Copies are saved beside the original by default, or in an owner-configured directory.

### Detection coverage

- **On by default:** email, SSN, credit card, labeled US routing numbers and NPIs, and supported credentials.
- **Opt in:** phone, date, ZIP code, IP address, and labeled account numbers and street addresses.
- **Not detected:** plain-text names and unlabeled street addresses.

Credential coverage includes GitHub and Stripe keys, bearer tokens, JWTs, password-bearing PostgreSQL URIs, and PEM private keys. Coverage varies by type; this is not a replacement for a dedicated secret scanner. [Detection and copy behavior →](docs/detection.md)

### Supported files

UTF-8 text files up to **10 MB**: CSV, TSV, JSON, logs, ENV, SQL, and plain text. CSV/TSV are processed as decoded cells; other formats use text matching with ENV/SQL email boundary handling.

CSV/TSV headers are preserved and not scanned by default. Use `has_header=false` when the first record should be processed as data. XLSX, PDF, DOCX, images, and archives are not parsed. A refused scan means the file was not checked. [File formats and limits →](docs/file-formats.md)

## Privacy and control

File contents are processed locally. The running server makes no network requests, and neither successful nor failed tool responses include file contents or matched values. Installation downloads packages separately.

Responses do include paths and metadata, which enter the agent's context and may reach its model provider. Allowed roots restrict **DataFog's** access; they do not restrict other agent tools. Routine scope and workflow settings are advisory. Detection can miss values, and approved allowlist values remain in copies.

Known issue: an email address directly touching a non-ASCII letter, as in unspaced Japanese or Chinese text, can be matched too widely, which can leave part of a second address in a copy. [Details →](docs/detection.md#known-issue-email-addresses-touching-non-ascii-letters)

[Privacy boundaries →](docs/privacy.md) · [Configure roots, scope, allowlists, and output folders →](docs/policy.md)

## Documentation and contributing

- [Detection and copy behavior](docs/detection.md)
- [Supported formats and limits](docs/file-formats.md)
- [Allowed roots and owner policy](docs/policy.md)
- [Python interface](docs/python-api.md)
- [Privacy and security boundaries](docs/privacy.md)
- [Uninstall](docs/uninstall.md)
- [Development and local checks](docs/development.md)
- [Contributing and changelog policy](CONTRIBUTING.md)
- [Release process](RELEASING.md)
- [Changelog](CHANGELOG.md)

Report vulnerabilities through [SECURITY.md](SECURITY.md), rather than a public issue.

## License

[MIT](LICENSE). Built by [DataFog](https://datafog.ai).
