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,        opp-engine scan          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.

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
One source at a time scan adds to the model that is there: sources scanned before stay as they are, a source named again is read afresh, sources lists them and remove takes one out
Human review A Markdown report lists what to check; certified entries survive the next scan
Serve The query engine answers 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   # writes acme.opp.yaml
opp-engine scan demo/exports                # add another source later
opp-engine sources                          # what the model covers
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

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 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 still writes a whole model from the sources named in one go, for scripts that rebuild it from scratch.

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.

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.0a5

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.0a5
File Size Uploaded Provenance Actions
open_privacy_protocol_engine-0.2.0a5.tar.gz 1.0 MB With provenance Details for open_privacy_protocol_engine-0.2.0a5.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / open_privacy_protocol_engine-0.2.0a5.tar.gz

Download URL open_privacy_protocol_engine-0.2.0a5.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
8d43a0f743fae970c7c90f12b7e1320c81232e265b4373aea21fb7b0a70ad4bb
BLAKE2b-256 checksum
How to use checksums
033c8cb8063473f97955e758eb401a1255a09db40b3d5ac6992736344ffbc58c
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.0a5-py3-none-any.whl

Download URL open_privacy_protocol_engine-0.2.0a5-py3-none-any.whl
Size 63.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20f269625207fb677286b42ffa19db023919679bf6f99f9b2f94bc6f31ad7de8
BLAKE2b-256 checksum
How to use checksums
ffed5fefeb4cc1cc983d4f2400f6f9dc2fbf6fd09cd8d90bf019bc9aaf5a35cb
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.0a5

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.0a5.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