Metadata-Version: 2.5
Name: open-privacy-protocol-engine
Version: 0.1.0a1
Summary: OPP Engine: generate Open Privacy Protocol privacy models from any data source and serve them to agents over HTTP and MCP
Project-URL: Homepage, https://openprivacyprotocol.com/engine/
Project-URL: Documentation, https://openprivacyprotocol.com/engine/data-sources/
Project-URL: Source, https://github.com/kannancet/open-privacy-protocol-engine
Author: The Open Privacy Protocol Authors
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: ai-agents,confidential-ai,data-classification,gdpr,llm,mcp,open-privacy-protocol,pii,pii-redaction,privacy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: open-privacy-protocol>=0.1.0a1
Requires-Dist: pyyaml>=6.0
Requires-Dist: sqlalchemy>=2.0
Provides-Extra: all
Requires-Dist: fastapi>=0.110; extra == 'all'
Requires-Dist: mcp<3,>=1.2; extra == 'all'
Requires-Dist: numpy>=1.26; extra == 'all'
Requires-Dist: onnxruntime>=1.18; extra == 'all'
Requires-Dist: pyarrow>=15; extra == 'all'
Requires-Dist: pymongo>=4.6; extra == 'all'
Requires-Dist: pypdf>=4; extra == 'all'
Requires-Dist: python-docx>=1.1; extra == 'all'
Requires-Dist: tokenizers>=0.19; extra == 'all'
Requires-Dist: uvicorn>=0.29; extra == 'all'
Provides-Extra: documents
Requires-Dist: pypdf>=4; extra == 'documents'
Requires-Dist: python-docx>=1.1; extra == 'documents'
Provides-Extra: mcp
Requires-Dist: mcp<3,>=1.2; extra == 'mcp'
Provides-Extra: model
Requires-Dist: numpy>=1.26; extra == 'model'
Requires-Dist: onnxruntime>=1.18; extra == 'model'
Requires-Dist: tokenizers>=0.19; extra == 'model'
Provides-Extra: mongodb
Requires-Dist: pymongo>=4.6; extra == 'mongodb'
Provides-Extra: mysql
Requires-Dist: pymysql>=1.1; extra == 'mysql'
Provides-Extra: parquet
Requires-Dist: pyarrow>=15; extra == 'parquet'
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.1; extra == 'postgres'
Provides-Extra: server
Requires-Dist: fastapi>=0.110; extra == 'server'
Requires-Dist: uvicorn>=0.29; extra == 'server'
Provides-Extra: test
Requires-Dist: fastapi>=0.110; extra == 'test'
Requires-Dist: httpx>=0.27; extra == 'test'
Requires-Dist: mcp<3,>=1.2; extra == 'test'
Requires-Dist: numpy>=1.26; extra == 'test'
Requires-Dist: onnxruntime>=1.18; extra == 'test'
Requires-Dist: pymongo>=4.6; extra == 'test'
Requires-Dist: pypdf>=4; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: python-docx>=1.1; extra == 'test'
Requires-Dist: tokenizers>=0.19; extra == 'test'
Requires-Dist: uvicorn>=0.29; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://openprivacyprotocol.com/engine/">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="assets/brand/logo-transparent-white.png">
      <img src="assets/brand/logo-transparent-dark.png" alt="Open Privacy Protocol" width="440">
    </picture>
  </a>
</p>

<h3 align="center">OPP Engine</h3>

<p align="center">
  <a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-5689F5?style=flat-square"></a>
  <a href="https://github.com/kannancet/open-privacy-protocol"><img alt="OPP 0.1.0.dev0" src="https://img.shields.io/badge/OPP-0.1.0.dev0-8964F4?style=flat-square"></a>
  <img alt="MCP server" src="https://img.shields.io/badge/MCP-server-4C5FD7?style=flat-square">
  <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-0B1025?style=flat-square&logo=python&logoColor=white">
  <img alt="Docker" src="https://img.shields.io/badge/docker-ready-0B1025?style=flat-square&logo=docker&logoColor=white">
</p>

<p align="center">
  <a href="https://openprivacyprotocol.com/engine/"><b>Documentation</b></a> ·
  <a href="#quick-start"><b>Quick start</b></a> ·
  <a href="docs/agents.md"><b>Connect agents</b></a> ·
  <a href="docs/detectors.md"><b>Detectors</b></a> ·
  <a href="https://github.com/kannancet/open-privacy-protocol/blob/main/spec/spec.md"><b>Specification</b></a>
</p>


<!-- opp-nav:start -->
<p align="center">
  <a href="https://openprivacyprotocol.com/">openprivacyprotocol.com</a> &nbsp;|&nbsp; <a href="https://github.com/kannancet/open-privacy-protocol">OPP Spec</a> &nbsp;·&nbsp; <b>OPP Engine</b> &nbsp;·&nbsp; <a href="https://github.com/kannancet/open-privacy-protocol-model">OPP Model</a> &nbsp;·&nbsp; <a href="https://github.com/kannancet/opp-python">OPP for Python</a> &nbsp;·&nbsp; <a href="https://github.com/kannancet/opp-js">OPP for JavaScript</a>
</p>
<!-- opp-nav:end -->

---

**OPP Engine** is the reference toolkit of the [Open Privacy Protocol](https://github.com/kannancet/open-privacy-protocol).
It connects to an organization's databases, files, documents and web pages, writes a draft
**privacy model** describing what in them is private or confidential, and serves that model to
agents so they can check content *before* they share it.

```
 databases, files,       opp-engine generate       acme.opp.yaml       opp-engine serve       agents
 documents, web pages  ───────────────────────►   (review, certify)  ──────────────────────►  (MCP / HTTP)
```

Everything runs on your own infrastructure. **No data value is ever written into the model, the
review report or the logs.**

## Features

| | |
|---|---|
| **Connect anything** | Any SQLAlchemy database URL (PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake, BigQuery and more with their drivers); MongoDB and MongoDB Atlas (`mongodb://`, `mongodb+srv://`, with the `[mongodb]` extra), nested fields included; CSV, TSV, JSON, JSON Lines and Parquet files; text, Markdown, HTML, PDF and Word documents; folders and web pages |
| **Generate** | Every column is classified against the OPP baseline catalog from its name and sampled values; text columns and documents get topic classes (health data, HR matters, internal financials); ID columns get their format (`CE-[0-9]{6}`). Each entry carries its evidence and starts `proposed` |
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (`--opp-model`), names, addresses and confidential topics are found in free text and headerless columns, and the organization's own concepts match by meaning |
| **Industry presets** | `--industry 622110` (a NAICS code) or `--industry healthcare` lists the classes that industry usually holds and were not found |
| **Hygiene** | Cues, terms and identifier patterns that would match ordinary text are removed and reported |
| **Human review** | A Markdown report lists what to check; certified entries survive the next run (`--merge`) |
| **Serve** | The query engine answers `check` (verdict, findings, safe content), `explain` and `list_classes` over MCP or a REST API |

## Quick start

```bash
pip install "open-privacy-protocol-engine[server,mcp,documents]"

python tests/sample_data.py demo            # a synthetic CRM database, exports and documents
opp-engine generate sqlite:///demo/crm.db demo/exports demo/docs \
    --name acme --org "Acme Coaching (fictional)" -o acme.opp.yaml --report review.md

opp-engine check acme.opp.yaml --dest external_ai "Email jane@example.com about CE-123456"
opp-engine serve acme.opp.yaml --mcp                     # for any MCP client
opp-engine serve acme.opp.yaml --http 127.0.0.1:8765      # REST API
```

Use a read-only database account. Connection strings are never written into the model; only the
host and database name are kept.

### Connect an agent over MCP

```json
{
  "mcpServers": {
    "opp": {
      "command": "opp-engine",
      "args": ["serve", "/path/to/acme.opp.yaml", "--mcp"]
    }
  }
}
```

Then tell the agent: *"Before sending data outside the system it came from, call `check`. Send
`safe_content` instead of the original. If the verdict is `block` or `review`, do not send."*
See [docs/agents.md](docs/agents.md) for the REST API and tool reference.

### Docker

```bash
docker build -t opp-engine .
docker run --rm -p 8765:8765 -v "$PWD/acme.opp.yaml:/model.opp.yaml" -e OPP_TOKEN=change-me opp-engine
```

## Documentation

- [Connecting data sources](docs/data-sources.md): SQL and NoSQL databases, files, folders and web pages, with install and URL examples
- [Connecting agents](docs/agents.md): MCP tools, REST endpoints, system-prompt guidance
- [Detectors and OPP Model](docs/detectors.md): built-in rules, custom detectors, the open-weight model
- [OPP specification](https://github.com/kannancet/open-privacy-protocol/blob/main/spec/spec.md): the document kinds this engine reads and writes
- [Website](https://openprivacyprotocol.com/engine/)

## Status

`0.1.0.dev0`, tracking OPP `0.1.0.dev0`. Interfaces may change before `0.1.0`.


<!-- opp-project:start -->
## One project, five repositories

Open Privacy Protocol is developed as a set of repositories that version together. This repository implements the standard: it reads and writes the documents defined in the spec, and uses the model as an optional detector.

| Part | Repository | What it is | Docs |
|---|---|---|---|
| **OPP Spec** | [`open-privacy-protocol`](https://github.com/kannancet/open-privacy-protocol) | The standard: specification, JSON Schemas, baseline catalog, industry presets, reference validator | [Docs](https://openprivacyprotocol.com/spec/) |
| **OPP Engine** | [`open-privacy-protocol-engine`](https://github.com/kannancet/open-privacy-protocol-engine) **(this repository)** | Generates a privacy model from your sources and serves it to agents over MCP and HTTP | [Docs](https://openprivacyprotocol.com/engine/) |
| **OPP Model** | [`open-privacy-protocol-model`](https://github.com/kannancet/open-privacy-protocol-model) | Open-weight model that finds private values and confidential topics in text, on CPU | [Docs](https://openprivacyprotocol.com/model/) |
| **OPP for Python** | [`opp-python`](https://github.com/kannancet/opp-python) | `pip install open-privacy-protocol`: validate models, resolve rules, call the engine | [Docs](https://openprivacyprotocol.com/get-started/) |
| **OPP for JavaScript** | [`opp-js`](https://github.com/kannancet/opp-js) | `npm install open-privacy-protocol`: the same API for Node.js, Bun and Deno | [Docs](https://openprivacyprotocol.com/get-started/) |

```
  your sources ──► OPP Engine ──► acme.opp.yaml ──► OPP Engine ──► any agent
                   generate       (OPP Spec)        serve          MCP / HTTP
                       ▲                               ▲
                       └────────── OPP Model ──────────┘
```

Website and documentation: **[openprivacyprotocol.com](https://openprivacyprotocol.com/)**
<!-- opp-project:end -->

## Contributing

Contributions are welcome: connectors, detectors, tests and documentation. Read
[CONTRIBUTING.md](CONTRIBUTING.md), report security problems as described in
[SECURITY.md](SECURITY.md), and follow the [Code of Conduct](CODE_OF_CONDUCT.md).

## License

Licensed under the [Apache License, Version 2.0](LICENSE). Part of the Open Privacy Protocol
project.
