OneTrust API + MCP Server + A2A Agent — 100% API coverage
Project description
OneTrust Api - A2A | AG-UI | MCP
Version: 0.1.2
Overview
OneTrust Api is a production-grade Python API client, Model Context Protocol (MCP) server, and A2A agent for the OneTrust privacy, consent, data-governance, and risk platform.
It provides 100% coverage of the OneTrust public API — every operation across
all 35 OpenAPI specifications (~600 operations, 7 product areas) is exposed as
both a typed client method and an action-routed MCP tool. The client, MCP tools,
and a machine-readable coverage manifest are all generated from the vendored
OpenAPI specs (onetrust_api/specs/*.json) by scripts/generate_from_openapi.py,
and a coverage test asserts the three sets stay in lock-step.
Key Features
- 100% Action-Routed MCP Tools — one consolidated tool per domain (e.g.
onetrust_incidents,onetrust_dsar,onetrust_assessments) takes anactionplus aparams_jsonpayload and routes to the underlying API method. 36 tools cover every endpoint without flooding the IDE tool list. - Full OneTrust surface — AI Governance, Consent & Preference Management, Data Use Governance, Privacy Automation (DSAR, Assessments, Data Mapping, Incidents), Tech Risk & Compliance, Third-Party Management, ESG, and Platform.
- Flexible auth — a pre-minted OAuth2 bearer token or the OAuth2
client-credentials flow (auto-exchanged and refreshed), plus OIDC delegation
(RFC 8693) via
agent-utilities. - Multi-region / multi-service aware — regional tenant pods, the consent privacy-portal host, and on-prem worker nodes are resolved per-operation.
- Resilient — honours
429Retry-After, retries transient5xx, and handles both OneTrust pagination styles (offset and cursor).
MCP
Using as an MCP Server
The MCP Server runs in stdio (local) or streamable-http (networked) mode.
Each domain is a tool gated by a {TAG}TOOL environment variable (default True),
so you can scope the surface (e.g. set ESGTOOL=False to drop ESG).
Environment Variables
| Variable | Description |
|---|---|
ONETRUST_URL |
Tenant host URL, e.g. https://acme.my.onetrust.com (overrides region). |
ONETRUST_REGION |
Shared pod when no URL is set: us, eu, de, uk, au, ca, fr, in, jp, trial, uat, … (default us). |
ONETRUST_TOKEN |
Pre-minted OAuth2 bearer token. |
ONETRUST_CLIENT_ID / ONETRUST_CLIENT_SECRET |
OAuth2 client-credentials (exchanged at /api/access/v1/oauth/token). |
ONETRUST_CONSENT_URL |
Optional host for consent-transaction APIs (privacy portal). |
ONETRUST_WORKER_URL |
Optional on-prem Data Discovery worker-node host. |
ONETRUST_SSL_VERIFY |
Verify TLS (default True). |
<DOMAIN>TOOL |
Toggle a domain tool, e.g. INCIDENTSTOOL, DSARTOOL, CONSENT_RECEIPTSTOOL (default True). |
Run in stdio mode (default):
export ONETRUST_URL="https://acme.my.onetrust.com"
export ONETRUST_TOKEN="your_token"
onetrust-mcp --transport "stdio"
Run in HTTP mode:
export ONETRUST_URL="https://acme.my.onetrust.com"
export ONETRUST_TOKEN="your_token"
onetrust-mcp --transport "streamable-http" --host "0.0.0.0" --port "8000"
Tool Domains
access_management, ai_governance, assessments, audit_management,
bulk_export, cmp, compliance_automation, consent_interfaces,
consent_receipts, cookie_consent, cookie_consent_legacy,
cookie_domain_data, cross_device_consent, data_catalog, data_discovery,
data_discovery_worker, data_mapping, data_mapping_legacy, documents,
dsar, esg, incidents, integrations, inventory, issues_management,
it_risk_management, mobile_app_consent, object_manager, policy_management,
privacy_notices, task_management, tprm, training, universal_consent,
user_provisioning — plus custom_api (a raw REST escape hatch).
A2A Agent
Run A2A Server
export ONETRUST_URL="https://acme.my.onetrust.com"
export ONETRUST_TOKEN="your_token"
onetrust-agent --provider openai --model-id gpt-4o --api-key sk-...
Docker
Build
docker build -t onetrust-api .
Run MCP Server
docker run -d \
--name onetrust-api \
-p 8000:8000 \
-e TRANSPORT=http \
-e ONETRUST_URL="http://your-service:8080" \
-e ONETRUST_TOKEN="your_token" \
knucklessg1/onetrust-api:latest
Deploy with Docker Compose
services:
onetrust-api:
image: knucklessg1/onetrust-api:latest
environment:
- HOST=0.0.0.0
- PORT=8000
- TRANSPORT=http
- ONETRUST_URL=http://your-service:8080
- ONETRUST_TOKEN=your_token
ports:
- 8000:8000
Configure mcp.json for AI Integration (e.g. Claude Desktop)
{
"mcpServers": {
"onetrust": {
"command": "uv",
"args": [
"run",
"--with",
"onetrust-api",
"onetrust-mcp"
],
"env": {
"ONETRUST_URL": "http://your-service:8080",
"ONETRUST_TOKEN": "your_token"
}
}
}
}
Install Python Package
python -m pip install onetrust-api
uv pip install onetrust-api
Documentation
The complete documentation is published as the official documentation site and is the source of truth for installation, usage, and deployment.
| Page | Covers |
|---|---|
| Overview | the action-routed tool surface and architecture |
| Installation | pip, source, extras, prebuilt Docker image |
| Usage (API / CLI / MCP) | the MCP tools, the Api client, the CLI |
| Deployment | run the MCP and agent servers, Compose, env config |
Repository Owners
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onetrust_api-0.1.2.tar.gz.
File metadata
- Download URL: onetrust_api-0.1.2.tar.gz
- Upload date:
- Size: 526.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f60078f71893bafb13f5f01ef51f6b02f61442774e868788117ce8cc8447671
|
|
| MD5 |
437fd2917975248ee1c0f4ae035f8f2d
|
|
| BLAKE2b-256 |
c7e76fe7b106aa53f16cf88b1a25b9691643de6a38fc5f879c54e700bd009eed
|
File details
Details for the file onetrust_api-0.1.2-py3-none-any.whl.
File metadata
- Download URL: onetrust_api-0.1.2-py3-none-any.whl
- Upload date:
- Size: 610.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875d1263783797e1ce61cff86803648df4ccf36c7d12a190dbbac14042701f08
|
|
| MD5 |
ee2da1d483327c6946eaae2613119c1e
|
|
| BLAKE2b-256 |
aaa57ccd3252256f86f8d014fcbb34876799140cc3a1c3415c05f050ffa35494
|