Skip to main content
Glama
satyamkumar420

AI Image Metadata Cleaner

README.md
<div align="center">

<img src="./banner.svg" alt="AI Image Metadata Cleaner MCP Server" width="100%" />

<br/>

[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
[![MCP SDK](https://img.shields.io/badge/MCP%20SDK-v2.x-7C3AED?style=for-the-badge&logo=anthropic&logoColor=white)](https://modelcontextprotocol.io/)
[![Transport](https://img.shields.io/badge/Transport-stdio-06B6D4?style=for-the-badge&logo=fastapi&logoColor=white)](https://modelcontextprotocol.io/)
[![C2PA Purge](https://img.shields.io/badge/C2PA-100%25%20Purge-10B981?style=for-the-badge&logo=shield&logoColor=white)](https://c2pa.org/)
[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Donate-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/satyam404)
[![License](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](LICENSE)

<br/>

# 🛡️ AI Image Metadata Cleaner (MCP Server)

**High-performance Model Context Protocol (MCP 2.x) server designed to strip AI provenance tags (C2PA, EXIF, XMP, IPTC), disrupt invisible frequency watermarks, and simulate authentic camera sensor physics.**

</div>

---

## 💡 Purpose

Modern generative AI tools (Midjourney, DALL-E, Adobe Firefly, Canva, Stable Diffusion) embed cryptographic provenance manifests (**C2PA / JUMBF**), invisible spatial watermarks, and prompt parameters into every generated image. 

Major platforms like **LinkedIn**, **Twitter/X**, and algorithmic newsfeeds automatically read these tags to **label, flag, or suppress organic reach** of content.

The purpose of **AI Image Metadata Cleaner** is to give creators and developers complete sovereign control over their media by:
1. **Scrubbing 100% of embedded tracking provenance** and generator signatures.
2. **Disrupting invisible frequency-domain watermarks** without visual quality loss.
3. **Restoring physical camera realism** (CMOS sensor grain, optical PSF) so images blend seamlessly with authentic photography.

---

## 🎯 Real-World Use Cases

| Use Case | Description |
|---|---|
| **LinkedIn Posts & Profile Media** | Prevent LinkedIn from automatically attaching "AI-generated" labels, reducing reach penalties or triggering account restriction reviews. |
| **Social Media & Content Marketing** | Publish AI-assisted blog banners, promotional graphics, and tech memes without algorithmic downranking across platforms. |
| **Privacy & Anti-Fingerprinting** | Strip embedded generation prompts, seed parameters, workflow graphs (ComfyUI), and system timestamps before sharing publicly. |
| **Portfolio & Headshot Naturalization** | Transform synthetic, plastic-looking portraits into authentic-looking shots by adding realistic CMOS photon grain and lens falloff. |
| **Batch Asset Pipeline Automation** | Automatically sanitize entire folders of marketing assets or user uploads via the `batch_sanitize_directory` tool. |

---

## ⚡ How Platforms Detect AI Images

1. **C2PA / Content Credentials Metadata:** Embedded in JPEG `APP11` (JUMBF) segments, PNG `c2pa`/`caPt` chunks, and XMP packets declaring synthetic origin.
2. **Invisible / Frequency-Domain Watermarks:** Encoded in latent frequency space (e.g. Google SynthID, latent diffusion watermarks).
3. **Statistical AI Footprints:** Unnaturally smooth surfaces with 0 variance (absence of camera sensor photon noise) and transposed-convolution grid harmonics.
4. **Suspicious Zero Metadata:** Heuristic checkers often flag files with 0 EXIF. Injected authentic camera EXIF (iPhone 15 Pro, Sony A7 IV) passes authenticity audits.

---

## 🛠️ MCP Tools

| Tool | Type | Description |
|---|---|---|
| `anti_ai_sanitize` | **Flagship** | Full pipeline: strips C2PA/EXIF, executes 0.3% micro-resample, injects luminance-adaptive CMOS grain, and embeds realistic camera EXIF. |
| `strip_metadata_only` | Utility | Fast, lossless metadata stripping (EXIF, XMP, IPTC, C2PA) without altering pixel values. |
| `inspect_image_metadata` | Audit | Deep diagnostic inspection scanning for C2PA byte manifests, AI keywords, and risk assessment. |
| `inject_camera_profile` | Stealth | Injects authentic camera EXIF into clean JPEG images. |
| `get_camera_profiles` | Info | Returns list of supported camera profiles and optical specifications. |
| `batch_sanitize_directory` | Automation | Batch-sanitizes an entire directory of images with parallel processing. |

---

## 📷 Supported Realistic Camera Profiles

- `iphone_15_pro`: Apple iPhone 15 Pro (iOS 17.5.1, 24mm f/1.78, ISO 80, 1/120s)
- `sony_a7iv`: Sony Alpha A7 IV (FE 24-70mm F2.8 GM II, f/2.8, 50mm, ISO 160)
- `samsung_s24_ultra`: Samsung Galaxy S24 Ultra (6.3mm f/1.7, ISO 100)
- `canon_r6`: Canon EOS R6 Mark II (RF24-105mm F4 L IS USM, ISO 200)

---

## 🚀 Installation & Setup

### Requirements
- Python 3.10+
- `uv` (recommended) or `pip`

```bash
# Clone the repository
git clone https://github.com/satyamkumar420/ai-image-meta-cleaner.git
cd ai-image-meta-cleaner

# Create and activate virtual environment
uv venv .venv
source .venv/bin/activate

# Install dependencies
uv pip install -r requirements.txt
```

### Running Tests
```bash
pytest -v
```

---

## ⚙️ MCP Configuration

Add this server to your `mcp_config.json` (Antigravity, Claude Desktop, Cursor):

```json
{
  "mcpServers": {
    "meta-cleaner": {
      "command": "/path/to/ai-image-meta-cleaner/.venv/bin/python",
      "args": [
        "-u",
        "/path/to/ai-image-meta-cleaner/server.py"
      ],
      "env": {
        "PYTHONPATH": "/path/to/ai-image-meta-cleaner"
      }
    }
  }
}
```

---

## ☕ Support & Sponsor

If you find **AI Image Metadata Cleaner** helpful and want to support its maintenance:

<div align="center">

<a href="https://buymeacoffee.com/satyam404" target="_blank">
  <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="200" />
</a>

<br/><br/>

<a href="https://buymeacoffee.com/satyam404" target="_blank">
  <img src="./bmc_qr.png" alt="Scan to Buy Me A Coffee" width="170" style="border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.15);" />
</a>

<br/>

<sub>Scan the QR code or click the button above to buy me a coffee! Thank you for your support! ☕✨</sub>

</div>

---

## 📄 License

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.