Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Open Privacy Protocol

OPP Engine

The privacy context layer for AI

License: Apache-2.0 OPP 0.2.0.dev0 MCP server Python 3.10+ Docker

Documentation · Quick start · Connect agents · Detectors · Specification

openprivacyprotocol.com  ·  Step-by-step guide  |  OPP Spec  ·  OPP Engine  ·  OPP Model  ·  OPP for Python  ·  OPP for JavaScript


OPP Engine is the reference toolkit of the Open Privacy Protocol, the privacy context layer for AI. 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. Since OPP 0.2 a check also knows how the destination will process the content (an ordinary API, a confidential enclave, encrypted inference, a local model), and answers with a decision that names the obligations the sender must fulfil.

 databases, files,       scan        acme.scan.yaml     generate      acme.opp.yaml      serve       agents
 documents, web pages  ─────────►  (everything read)  ───────────►  (view, certify)  ───────────►  (MCP / HTTP)

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

Start here

OPP Engine is the tool you run in every step below. Follow the step-by-step guide; each step ends with a check that it worked.

Step
1 Install
2 Connect your data
3 Generate the privacy model
4 Review and customize
5 Test decisions
6 Serve to agents over MCP
7 Deploy as a service

New to the ideas? Read Core concepts. Want a five-minute try on example data first? See Get started.

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 (downloaded from Hugging Face on first use and applied automatically by scan and generate), 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
Only what matters generate writes the model out of the scan: the fields and documents where private or confidential data was found, not a copy of the database schema
Overview on top The model opens with a description, the industry, the laws and standards that name the data, and for every kind of data its sensitivity, handling, allowed destinations, risk score and clauses
One source at a time scan adds to what was scanned before: sources not named again stay as they are, a source named again is read afresh, sources lists them and remove takes one out
Human review view opens the model in the browser to read, edit and certify; certified entries survive the next scan and generate
Serve The query engine answers overview (what kinds of data there are and what to do with each), check (verdict, findings, safe content), explain and list_classes over MCP or a REST API

Quick start

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

python tests/sample_data.py demo            # a synthetic CRM database, exports and documents
opp-engine scan sqlite:///demo/crm.db demo/docs --org "Acme Coaching (fictional)" --name acme   # reads into acme.scan.yaml
opp-engine scan demo/exports                # scan more, as often as you like
opp-engine generate                         # writes the privacy model, acme.opp.yaml
opp-engine view                             # review and edit it in the browser
opp-engine sources                          # what has been scanned
opp-engine remove exports                   # take a source out again

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

Three steps, three files to know:

Step Command What it does
1 opp-engine scan SOURCE... Reads sources into NAME.scan.yaml: everything it saw, every table and field. Run it once per source or with several.
2 opp-engine generate Writes NAME.opp.yaml, the privacy model: only what is private or confidential, with the overview on top. Add --industry healthcare and --frameworks gdpr,hipaa to say which apply; the choice is remembered.
3 opp-engine view Opens the model in the browser: the overview, the tree, the version machines get, and the YAML, all editable.

Run generate again after scanning more: what a reviewer certified or changed in the model is kept.

A source is a database URL, a file, a folder or a web page:

opp-engine scan postgres://reader@db.internal/crm     # asks for the password, hidden; it is not stored
opp-engine scan env:CRM_URL                           # or take the whole URL from an environment variable

Use a read-only database account. Connection strings are never written into the model; only the host and database name are kept. scan reads with the rule detectors and OPP Model, which is downloaded from Hugging Face once, verified, and then used from the local cache (opp-engine model info shows where). The model records which detectors read it under provenance.notes.

To work with a Hub, enroll the machine once with the link the Hub shows, then sync whenever the model is ready:

opp-engine enroll https://hub.example/connect/hub_model_...   # once; the link works one time
opp-engine scan postgres://reader@db.internal/crm             # no --org needed: the Hub says whose model it is
opp-engine generate                                           # write the model
opp-engine sync                                               # sends the model as the Hub's draft

enroll trades the link for this machine's own credential, kept in ~/.config/opp-engine/hub.json (readable by you only). It can send privacy model drafts and nothing else, and an admin can remove the machine on the Hub. sync does not overwrite a draft someone edited on the Hub since your last sync unless you add --force. opp-engine enroll without a link shows the enrollment and opp-engine unenroll ends it. For CI, opp-engine send LINK and scan SOURCE --hub LINK still send with a one-day link and keep nothing on the machine.

opp-engine generate SOURCE... --name N --org O -o FILE scans the sources named and writes the model in one go, for scripts that rebuild it from scratch.

What the model says on top

description: 'Privacy model of Acme: 21 kinds of private or confidential data, found in 3 sources ...'
industry: {id: healthcare, label: Healthcare, basis: set when the model was generated}
frameworks:
- {id: gdpr, title: Regulation (EU) 2016/679 (General Data Protection Regulation), data_types: 14}
data_types:
- class: special.health
  label: Health data
  sensitivity: restricted
  handling: block
  destinations: {internal: block, partner: block, external_ai: block, public: block}
  risk: {score: 91, level: critical}
  found_in: {fields: 1, sources: [crm_db]}
  review: proposed
  frameworks:
  - id: gdpr
    clauses:
    - clause: Art. 9(1)
      summary: Prohibits processing of special categories ... unless an exception in Art. 9(2) applies.

The overview is worked out of the model and the catalog every time the model is generated or saved in view; change the model, not the overview. Clause summaries are in plain words, not the legal text. industry, frameworks and data_types are part of the OPP specification (section 4.11); nothing decides from them, and the version for machines leaves them out. Agents get the same overview from the overview tool over MCP and GET /v1/overview.

Two versions of the model

The full model says where your private data is: sources, tables, fields and the evidence for each class. Reviewers need that. Something that only applies the rules does not, and should not carry it.

opp-engine profiles                                                   # what each version holds
opp-engine export --profile enforcement -o acme.enforcement.opp.yaml   # the one to distribute

The enforcement version keeps the classes found, your concepts, identifier formats, terms and rules, and leaves out source, table and field names, evidence and reviewers. It is a valid model that gives the same decisions for content. Terms and identifier formats stay in it, because text is matched against them; a scan names an identifier after the field it was found in, so rename it in the model if that name says too much. A Hub does this itself: sync sends it the full model, and it sends machines the enforcement version.

Review the model in the browser

opp-engine view                # the model in this folder
opp-engine view --read-only    # look, do not change

Opens the privacy model as a tree you can search and edit: click a value to change it, certify what a scan proposed (one entry, a table or a whole source at a time), add, duplicate and remove entries, or edit the YAML. A switch shows the full model or the version machines get. Every edit is checked against the OPP schema, and nothing is written until you save. The page is served on this machine only (127.0.0.1), needs the key in the address the command prints, and loads nothing over the network. Press Ctrl+C to stop it; then opp-engine sync sends the reviewed model to your Hub.

Connect an agent over MCP

{
  "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 for the REST API and tool reference.

Docker

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

Protection-aware checks (OPP 0.2)

Give the engine a destination registry and it resolves the service and its mode itself. A caller names a registry id and a mode; it cannot describe a mode or grant itself a purpose.

opp-engine serve acme.opp.yaml --http 127.0.0.1:8765 \
    --destinations acme.destinations.yaml --allow-purpose medical_analysis --decision-log decisions.jsonl
curl -s localhost:8765/v1/check -H "Authorization: Bearer $OPP_TOKEN" -H "Content-Type: application/json" -d '{
  "content": "Summarise the oncology file.", "destination": "hosted-llm", "mode": "confidential",
  "purpose": "medical_analysis", "obligations_supported": true}'

The answer keeps verdict, findings and safe_content, and adds decision: an id and expiry, the destination, mode, mechanism and assurance that were used, whether the purpose was authorised, digests of the privacy model, the registry and the checked content, the rules that applied, the obligations, and the detectors that looked at the content.

  • Obligations are part of the answer. allow with enforce_mode means "only through this mode". A caller that does not send obligations_supported: true gets review instead of a conditional allow.
  • Check the output too. An answer that came back over an encrypted route is plaintext again. Check it against where it goes next ("stage": "output", or "tool_call" for an agent's next call).
  • Evidence expires. A mode whose approval or attestation has expired no longer satisfies a rule.
  • The decision log holds no content. One JSON line per decision with counts per class, no values and no offsets.

The engine decides. Something else has to enforce: a gateway, a proxy or the application that sends the content. A check that an agent may skip is advice.

Security defaults

  • serve --http refuses a non-loopback address without a bearer token (OPP_TOKEN) unless --insecure.
  • serve --mcp streamable-http|sse has no caller authentication; it needs --insecure and belongs behind an authenticating proxy. --mcp (stdio) is unaffected.
  • The HTTP access log is off, and POST /v1/explain keeps the value you ask about out of the URL.
  • A purpose is authorised per engine instance (--allow-purpose). Per-caller identities are not implemented yet; run one instance per trust domain.

Documentation

Status

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

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 The standard: specification, JSON Schemas, baseline catalog, industry presets, reference validator Docs
OPP Engine open-privacy-protocol-engine (this repository) Generates a privacy model from your sources and serves it to agents over MCP and HTTP Docs
OPP Model open-privacy-protocol-model Open-weight model that finds private values and confidential topics in text, on CPU Docs
OPP for Python opp-python pip install open-privacy-protocol: validate models, resolve rules, call the engine Docs
OPP for JavaScript opp-js npm install open-privacy-protocol: the same API for Node.js, Bun and Deno Docs
  your sources ──► OPP Engine ──► acme.opp.yaml ──► OPP Engine ──► any agent
                   generate       (OPP Spec)        serve          MCP / HTTP
                       ▲                               ▲
                       └────────── OPP Model ──────────┘

Website and documentation: openprivacyprotocol.com

Contributing

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

License

Licensed under the Apache License, Version 2.0. Part of the Open Privacy Protocol project.

Metadata

Release files for open-privacy-protocol-engine 0.2.0a9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-privacy-protocol-engine 0.2.0a9
File Size Uploaded Provenance Actions
open_privacy_protocol_engine-0.2.0a9.tar.gz 1.1 MB With provenance Details for open_privacy_protocol_engine-0.2.0a9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for open-privacy-protocol-engine 0.2.0a9
File Interpreter ABI Platform Actions
open_privacy_protocol_engine-0.2.0a9-py3-none-any.whl Python 3 none any Details for open_privacy_protocol_engine-0.2.0a9-py3-none-any.whl

Total release size: 1.2 MB

Release files / open_privacy_protocol_engine-0.2.0a9.tar.gz

Download URL open_privacy_protocol_engine-0.2.0a9.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d204bf2112dc277e0ae5273e5a94e08f8ab2c36c8889980a0c8b9f3a7c8ecaaa
BLAKE2b-256 checksum
How to use checksums
94cfbee41bd0a08626dc75862806a755b2c2bb162f4a049a75f3e4d89e301442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Release files / open_privacy_protocol_engine-0.2.0a9-py3-none-any.whl

Download URL open_privacy_protocol_engine-0.2.0a9-py3-none-any.whl
Size 92.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9e1577a690fb947d71cc8bbd87c27330311319e8c4df9c1e8cf18fb0581a28a
BLAKE2b-256 checksum
How to use checksums
d8580c51572ed21a9fd660cf5730b2e71d109373aaa6e63793064234839a4f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for open-privacy-protocol-engine 0.2.0a9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for open_privacy_protocol_engine-0.2.0a9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page