{
  "markdown": "# ComplyEdge\n\n[![PyPI](https://img.shields.io/pypi/v/complyedge)](https://pypi.org/project/complyedge/)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![Smithery](https://img.shields.io/badge/Smithery-listed-6b46c1)](https://smithery.ai/servers/complyedge/complyedge)\n\nEU AI Act Article 5 and Article 50 runtime deny for AI agents. Not a periodic scanner over a repo: the platform enforces in production, on every request — and the same discipline is available to your agent as an **MCP server** that checks and scans the text you pass it, offline, with an article citation on every finding. Classifiers (`eu-ai-act-*`) score the *system*; ComplyEdge denies *this* prompt or output. Article 50 here is unlabeled or deceptive use, not C2PA.\n\nShips three ways: a Python SDK, an offline CI linter (TrustLint), and an **MCP server** — a Model Context Protocol server that exposes compliance checks as tools to any MCP host (Claude, Cursor, MCP Inspector).\n\n**Article 5 is already law.** GPAI fines have applied since 2 August 2026. Your AI is either compliant right now, or it isn't.\n\n> What does your compliance tool tell a regulator when it blocks a request? A probability score?\n>\n> ComplyEdge says: **Article 5(1)(a), rule `rego-art5-1a-001`, timestamp, input hash.** One is an audit trail. One is a guess.\n\n## MCP Server (Model Context Protocol)\n\nComplyEdge TrustLint is an MCP server built on the official [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk) (`mcp>=1.9`). It gives an agent article-cited compliance checks instead of a probability score, and it runs fully offline: no API key, no network call, rules evaluated from the bundled YAML corpus.\n\n**Tools** (the server exposes MCP tools only — no resources, no prompts; all three are read-only and idempotent):\n\n| Tool | What it does |\n|---|---|\n| `check_compliance` | Check text against the TrustLint rule corpus. Returns PASS/FAIL with rule ID, severity, and the article citation behind each finding. |\n| `list_rules` | List available rules, filterable by jurisdiction (`EU`, `US`, `Global`, `Universal`). |\n| `scan_prompt` | Pre-generation prompt scan. Returns `SAFE` or `RISK_DETECTED` before the model is called. |\n\n**Local (stdio)** — for Claude Desktop, Cursor, MCP Inspector, or any MCP host:\n\n```bash\npip install 'complyedge[mcp]'\ncomplyedge-mcp          # or: python -m complyedge.mcp_server\n```\n\n```json\n{\n  \"mcpServers\": {\n    \"complyedge\": {\n      \"command\": \"complyedge-mcp\"\n    }\n  }\n}\n```\n\n**Remote (Streamable HTTP):** `https://mcp.complyedge.io/mcp`\n\nServer source: [`sdks/python/complyedge/mcp_server.py`](sdks/python/complyedge/mcp_server.py). Full MCP docs: [`sdks/python/README.md`](sdks/python/README.md). This MCP path uses the offline TrustLint engine; it does not call the hosted OPA/Rego policy API.\n\n**Install (coding agents):**\n\n```bash\npip install complyedge\npip install trustlint\npip install 'complyedge[mcp]'\nnpx -y @complyedge/mcp\nclaude mcp add complyedge -- npx -y @complyedge/mcp\n```\n\nListing: [smithery.ai/servers/complyedge/complyedge](https://smithery.ai/servers/complyedge/complyedge)\n\nCursor one-click: [Install TrustLint MCP](cursor://anysphere.cursor-deeplink/mcp/install?name=ComplyEdge%20TrustLint%20EU%20AI%20Act&config=eyJ1cmwiOiAiaHR0cHM6Ly9tY3AuY29tcGx5ZWRnZS5pby9tY3AifQ)\n\nOpenAI Agents extra (hosted path; needs `COMPLYEDGE_API_KEY`):\n\n```bash\npip install 'complyedge[agents]'\n```\n\n```python\nfrom complyedge.agents import create_compliance_guardrail\n```\n\nCI: `uses: complyedge/trustlint-action@v1`\n\nGOPAL is an OPA library in your process. ComplyEdge is per-request deny + citation + trust page + MCP.\n\n## Live enforcement seals\n\nNot a static badge. These seals reflect live `/v1/check` traffic from open-source projects\nembedding ComplyEdge: they change as real enforcement happens.\n\nBoth projects below are our own. ComplyEdge runs in production against our own code\nbefore we ask anyone else to run it against theirs.\n\n[![IVD Framework: runtime enforcement](https://api.complyedge.io/v1/public/badge/ivd.svg)](https://trust.complyedge.io/ivd)\n[![Horizon: runtime enforcement](https://api.complyedge.io/v1/public/badge/horizon.svg)](https://trust.complyedge.io/horizon)\n\n| Project | Live trust page |\n|---------|-----------------|\n| **IVD Framework** | [trust.complyedge.io/ivd](https://trust.complyedge.io/ivd) |\n| **Horizon** | [trust.complyedge.io/horizon](https://trust.complyedge.io/horizon) |\n\nEach trust page is generated from that project's real audit trail: enforcement status, check\nvolume, and the EU AI Act articles enforced at runtime. (GitHub proxies and caches images, so the\nseal above can lag; the trust page is always current.)\n\nEmbed one on your own project: [Enforcement Seal docs](https://complyedge.io/docs/trust-badge.html).\n\n## Quick Start\n\n```bash\npip install complyedge\n```\n\n```python\nfrom complyedge import compliance_check\n\n@compliance_check(jurisdiction=\"EU\", agent_id=\"my-agent\")\ndef my_agent(prompt):\n    return llm.generate(prompt)  # every input and output checked\n```\n\nThree lines. Every AI input and output evaluated against the EU AI Act rule corpus (Article 5, Article 50, GPAI). Violations blocked before they reach the user: with article citation, rule ID, and timestamp on every decision.\n\nSet `COMPLYEDGE_API_KEY` to your key. The decorator activates by default; to disable without removing the key (e.g., in CI), set `COMPLYEDGE_ENABLED=false`.\n\n## Without a decorator\n\n```python\nfrom complyedge import is_safe, check\nimport os\n\napi_key = os.environ[\"COMPLYEDGE_API_KEY\"]\n\n# Boolean check: returns True if no violations\nif not is_safe(prompt, api_key=api_key, jurisdiction=\"EU\"):\n    raise ValueError(\"Prompt violates EU AI Act\")\n\n# Full result: returns ComplianceResult with the violations that blocked it\nresult = check(prompt, api_key=api_key, jurisdiction=\"EU\")\nif not result.allowed:\n    for v in result.violations:\n        print(v.rule_id, v.severity, v.rule_description)\n```\n\n`rule_id` is the citation key: every rule carries its article reference in the corpus (`rego-art5-1c-001` → Article 5(1)(c)), and the full citation text ships with the rule under [`rules/`](rules).\n\nJurisdiction maps to the rule corpus: `EU` evaluates against EU AI Act Article 5, Article 50, and GPAI obligations. `US` evaluates against HIPAA, SOX, COPPA, TCPA, BIPA, CCPA, Colorado AI Act, NYC LL144, ECPA.\n\n## TrustLint, Offline Linter\n\nNo API key required. Scans text against the YAML rule corpus using regex patterns. Published as a standalone package, versioned independently of the SDK.\n\n```bash\npip install trustlint\n\ntrustlint check --text \"We use social credit scoring to evaluate applicants\"\n# → CRITICAL: EU_AI_ACT_ART5_SOCIAL_SCORING_001, Article 5(1)(c)\n```\n\nExit codes: `0` = pass, `1` = violations found. Designed for CI/CD pipelines. Source: [`packages/trustlint/`](packages/trustlint).\n\n## Rule IDs: two namespaces\n\nComplyEdge resolves the same regulations through two engines, each with its own rule-ID namespace:\n\n- **Runtime API (OPA/Rego):** IDs like `rego-art5-1c-001`: returned by `compliance_check` and the `/v1/check` API. This is the audit trail your production system logs.\n- **TrustLint (offline, YAML corpus):** IDs like `EU_AI_ACT_ART5_SOCIAL_SCORING_001`: emitted by the offline linter.\n\nBoth cite the same legal article and differ only in engine. Map between them via the article reference carried in every rule.\n\n## What's In This Repo\n\n```\nsdks/python/          Python SDK (@compliance_check decorator, CLI)\n  └ complyedge/mcp_server.py   MCP server (stdio): check_compliance, list_rules, scan_prompt\npackages/trustlint/   Offline regex linter (TrustLint): no API key, for CI/CD\nrules/regulations/    64 YAML rules (EU AI Act, GDPR, HIPAA, SOX, PCI DSS, and more)\nrules/rego/           64 leaf OPA/Rego policies + 7 package aggregators\nrules/schemas/        Rule validation schema\nrules/scripts/        Schema validator (`validate_rules.py`)\nexamples/             Usage examples (decorators, OpenAI Agents)\nscripts/benchmark/    Runtime benchmark (runner + prompt YAMLs + committed results)\ntests/                Rule validation + acceptance tests\n```\n\n## Rules\n\n64 YAML rules + 64 deterministic leaf OPA/Rego policies (+ 7 package aggregators) across 4 jurisdictions.\n\n**What a decision from these policies establishes is not uniform, and we publish the split.** Every leaf decides by matching the evaluated text (no LLM on the hot path). For 21 of them the text *is* the regulated act — Article 5 prohibited practices, Article 15 prompt-injection resilience, one US disclosure control — so a block prevents the act and the citation on the decision is load-bearing. The other 43 fire on text *describing* a state the engine cannot verify: no text matcher can establish whether a technical file, a quality management system, a human-oversight assignment or a FRIA exists. Those are useful for triage; they are not a compliance finding, and their silence is not one either. Per-rule table: [`docs/rules-management/corpus-evidence-classification.md`](docs/rules-management/corpus-evidence-classification.md).\n\n| Jurisdiction | Rules | Regulations |\n|---|---|---|\n| **EU** | 36 YAML | EU AI Act Articles 4–6, 9–10, 12–16, 26–27, 50, 53, GPAI, GDPR + Art 15 IPI |\n| **US** | 16 YAML | HIPAA, SOX, COPPA, TCPA, BIPA, CCPA, Colorado AI Act, NYC LL144, ECPA |\n| **Global** | 1 YAML | PCI DSS |\n| **Universal** | 11 YAML | PII detection, prompt injection (direct + indirect) |\n\nEach rule specifies conditions, severity, detection scope, and remediation with legal citations. See the [rule schema](rules/schemas/rule-schema.json) for the format.\n\n### Writing Custom Rules\n\n```yaml\nid: MY_CUSTOM_RULE_001\njurisdiction: EU\neffective_date: \"2025-02-02\"\ndescription: \"Detect prohibited practice X under Article Y\"\nseverity: critical\nconditions:\n  - type: regex\n    value: \"prohibited pattern\"\nsource:\n  regulation: \"EU AI Act\"\n  article: \"Article Y(1)(z)\"\n```\n\nValidate: `cd rules && python scripts/validate_rules.py`\n\n## Architecture\n\n**Layer 1, Deterministic (hot path):** 64 leaf OPA/Rego policies (+ 7 package aggregators) evaluate every request, no LLM. The engine (OPA/Rego + TrustLint) evaluates in 4.87ms p99 in a local microbenchmark against the current 6-package bundle (`layer1_latency_latest.json`, best of 5 trials, 2026-08-04). End-to-end through the live API, the published 60-prompt run measured a p50 of 139ms and p95 of 2,519ms across the 39 OPA-decided prompts, with individual requests spanning 47ms to 10.7s (`runtime_benchmark_latest.json`, 2026-07-28). That run mixes cold and concurrent invocations against a Lambda-backed API, which is where the long tail comes from; we publish the whole run rather than a hand-picked warm figure. Opting into the Layer 2 LLM adds 2–5s on the long tail. Binary pass/block, legal citation on every decision. (TrustLint applies the same regex corpus offline for CI use.)\n\n**Layer 2, Interpretive (synchronous, opt-in):** When called with `use_semantic_fallback=True`, an LLM evaluates the request and blocks if a violation is found. Off by default since v0.2.2. Adds 2–5s latency per request.\n\nSecurity products protect AI from bad actors. **ComplyEdge blocks EU AI Act violations at runtime: and logs a cited record on every decision.**\n\n## Benchmark\n\nA 60-prompt corpus runs against the live API. The runner, prompt YAMLs, and the latest result JSON are committed under [`scripts/benchmark/`](scripts/benchmark): inspect the results directly, or re-run with your own `COMPLYEDGE_API_KEY`.\n\n## Contributing\n\nWe welcome rule contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\nEvery rule must include: article + paragraph citation, verifiable detection condition, and test cases.\n\n## Security\n\nTo report a vulnerability, see [SECURITY.md](SECURITY.md). Do not open a public issue for security reports.\n\n## License\n\nApache License 2.0: see [LICENSE](LICENSE).\n\n## Links\n\n- **Website**: [complyedge.io](https://complyedge.io)\n- **MCP server docs**: [sdks/python/README.md](sdks/python/README.md) · remote endpoint `https://mcp.complyedge.io/mcp`\n- **Blog**: [complyedge.io/blog/](https://complyedge.io/blog/)\n- **GPAI Compliance Benchmark**: [complyedge.io/blog/gpai-compliance-benchmark.html](https://complyedge.io/blog/gpai-compliance-benchmark.html)\n- **Why OPA/Rego for EU AI Act**: [complyedge.io/blog/why-opa-rego-eu-ai-act.html](https://complyedge.io/blog/why-opa-rego-eu-ai-act.html)\n- **PyPI**: [pypi.org/project/complyedge](https://pypi.org/project/complyedge/)\n- **Changelog**: [CHANGELOG.md](CHANGELOG.md)\n- **Rule Schema**: [rules/schemas/rule-schema.json](rules/schemas/rule-schema.json)\n",
  "bytes": 12698,
  "sha": "3a37a39d6e77e5755d810fcdbcaaeca383a626fadbd2d44802510af3d79e1a81",
  "repo_slug": "complyedge/complyedge",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_complyedge_complyedge_3d73e05d/readme"
}