Skip to main content
Glama
README.md
# AI50 MCP — Provenance Marker for AI-Generated Content

A clean, listing-ready Model Context Protocol (MCP) tool server that wraps the
existing Art50 marking engine as **one** payable per-call tool:
`mark_art50_provenance`.

## The buyer problem (plain language)

If you ship an AI product in Europe, the EU AI Act (Article 50) requires you to
mark AI-generated or AI-manipulated content so people and machines can tell it
apart from human-made content. The deadline for systems already on the market is
**2 December 2026**. Marking must be machine-readable, not just a visible
watermark.

Most teams do not have a reliable, repeatable way to do this. They either skip
it, bolt on an ad-hoc script, or trust a model to "remember" to add metadata.
None of those is auditable.

This tool fixes that in one call: hand it a local file and it embeds a
standards-based marking (JPEG/PNG) or writes a tamper-evident sidecar (anything
else), then verifies the result and returns a boolean. It is deterministic,
stdlib-only, and runs entirely on the user's own machine.

## What it does

- **JPEG** — injects an APP1 XMP packet carrying
  `IPTC DigitalSourceType = trainedAlgorithmicMedia`.
- **PNG** — injects an iTXt chunk (`XML:com.adobe.xmp`) with the same packet,
  CRC-correct.
- **Any other file** — writes a sha256-bound `<file>.art50.json` sidecar
  manifest (hash, size, standard, UTC timestamp) and verifies it.
- **Idempotent** — re-marking replaces the previous packet; it never
  duplicates.
- **Verifiable** — every call returns `verified: true/false`.

## Run the server

```bash
python server.py
```

The server speaks MCP over stdio (JSON-RPC 2.0, newline-delimited). Point any
MCP client at it.

## Tool

Single tool: `mark_art50_provenance`

Inputs (typed):
- `path` (string, required) — local file to mark. Remote URLs are rejected.
- `output_path` (string, optional) — destination for a marked JPEG/PNG copy.
- `generator` (string, optional) — label embedded in the XMP packet.

Returns JSON: `ok`, `kind`, `source`, `output`, `source_sha256`,
`output_sha256`, `bytes`, `verified`.

## Safety

- Local files only. URLs and non-file paths are rejected.
- Regular files only; directories are rejected.
- 50 MiB per-call size cap.
- Output parent directory must already exist.
- No network access, no subprocesses, no secrets.

## Test

```bash
python -m unittest test_ai50_mcp -v
# or: python -m pytest -q
```

Last verified run: **35 tests (plus 15 subtests), exit code 0**.

## License

MIT. Engineering aid for EU AI Act Art.50(2) marking. Not legal advice, not a
conformity certificate. Built with AI assistance.

TDQS

A4.3/5.0

Scored across 1 tool

Disambiguation5/5

With a single, highly specific tool there is no possibility of selection confusion between tools. The description clearly bounds the action (mark one local file), the formats handled (JPEG/PNG XMP vs. SHA-256 sidecar), and the exclusions (URLs, directories, oversized files, overwriting the source).

Naming Consistency5/5

The lone tool name uses clean snake_case with an explicit verb + object structure (mark_art50_provenance), which is readable and predictable. A single tool cannot exhibit mixed conventions.

Tool Count3/5

The scope is genuinely narrow (stamp provenance onto one file and verify the write), so one tool is defensible rather than absurd. Still, a 1-tool surface is thin: there is no way to query marking status, inspect a sidecar, or process a batch without re-invoking the marking action.

Completeness3/5

Core lifecycle is partially covered: marking and in-band verification are present, and re-marking is idempotent. However, obvious gaps remain — no read-only/verify-only tool to check whether a file is already marked or to validate a sidecar, and no batch or directory-level operation, both of which are natural for compliance workflows.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues