# Buggy1111/anonymize-mcp [Health: Active]

**Category:** 🔒 Security  
**Repository:** https://github.com/Buggy1111/anonymize-mcp  
**GitHub Stars:** 4  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/buggy1111-anonymize-mcp

## Description
Anonymize PII and redact text for GDPR across Czech and 35+ languages. Real NLP via ÚFAL/LINDAT (MasKIT + NameTag NER, not just regex), 80+ PII patterns, plus morphology, translation, and spellcheck. Czech-first, non-commercial. Install: pip install anonymize-mcp.

## Tools
Capabilities this server exposes over MCP:

- **extract_entities** — Rozpozná pojmenované entity pomocí NameTag 3 — CZ i 30+ dalších jazyků.

    Pro **češtinu** používá bohatý CNEC 2.0 tagset (osoba/firma/instituce/
    PSČ/telefon/datum/…). Pro ostatní jazyky (SK, EN, DE, FR, IT, ES, PT,
    NL, PL, HU, UK, RU, RO, SL, BG, EL, HR, SR, FI, LT, LV, ET, DA, SV,
    NO, ZH, AR, TR, VI, HI a další) přepne na multilingvální UNER model
    s tagsetem PER/ORG/LOC.

    Args:
        text: Vstupní text (UTF-8).
        model: ``auto`` (default) — automatická detekce CZ vs non-CZ.
            ``czech`` vynutí CNEC 2.0 (bohatý CZ tagset). ``multilingual``
            vynutí UNER PER/ORG/LOC pro non-CZ. Lze zadat i plné jméno
            modelu (např. ``nametag3-multilingual-onto-250203``).
        fix_romance: Default True. Pro PT/ES texty oprava typického
            UNER bugu, kdy se "X de Place" zaeviduje celé jako PER —
            wrapper rozdělí na PER + LOC a generuje warning.
        include_xml: Default ``False``. Inline XML s ``<ne type="...">`` tagy
            pro HTML highlighting (extra API call).
        include_vertical: Default ``False``. Tabulkový formát ``id\ttype\ttext``
            (extra API call).

    Returns:
        ``entities`` (list s ``type``, ``label``, ``text``, ``tokens``,
        ``nested``), ``model``, ``count``, ``warnings``,
        ``detected_language`` (jen u ``auto``),
        ``xml`` (jen pokud ``include_xml``),
        ``vertical`` (jen pokud ``include_vertical``).
    
- **anonymize** — Production-grade pseudonymizace českých právních textů (v0.6.0).

    Pipeline (8 kroků):

    1. **Regex pre-pass** (`regex_pre_pass=True`) — strukturovaná PII
       (telefon, IČO, RČ, č.j., sp. zn., e-mail, URL, PSČ, SPZ, IBAN, DIČ,
       OP, datovka) se anonymizuje **PŘED** MasKITem, aby nebyly fragmentovány.
       Telefon "777 123 456" se anonymizuje **celý** jako jeden blok TELEFON1.

    2. **Strict wrapper pre-pass** (`strict=True`) — NameTag najde
       firmy/úřady/instituce, které MasKIT vynechává nebo fragmentuje,
       a anonymizuje je sentinely → FIRMA1, INSTITUCE1.

    3. **MasKIT** — pseudonymizace zbývajících PII (jména, adresy, ...).

    4. **Stop-list filter** (`stop_list_filter=True`) — MasKIT občas
       chybně nahrazuje běžná slova ("stát" → "UniAgentury", "sporu" →
       "Pardubic"). Wrapper detekuje a vrátí originál, přidá warning.

    5. **Restore sentinely** → finální placeholdery (TELEFON1, FIRMA1, ...).

    6. **Fragmentation warnings** — detekce známých MasKIT problémů.

    7. **Type classification** — NameTag dohledá typ entity pro každou náhradu.

    8. **Placeholder mode** (`placeholder_mode=True`) — místo MasKIT náhodných
       fake names (`Jan Novák`) použij deterministické `OSOBA1`, `OSOBA2`...,
       `MESTO1`, `ULICE1`, ... S dedupingem: Jiří × 15× v textu → OSOBA1 × 15×.
       **Reprodukovatelné** (stejný vstup → stejný výstup) a **auditovatelné**.

    Args:
        text: Vstupní text (čeština).
        output: Formát výstupu — ``txt`` (default), ``html``, ``conllu``.
        keep_mapping: Když True, vrátí mapping. **POZOR**: pokud má text
            dál opustit důvěrné prostředí, mapping vypni!
        classify_types: NameTag dohledá typ entity. Default ``True``.
        strict: Wrapper pre-pass na firmy/úřady. Default ``True``.
        placeholder_mode: ⭐ **NEW v0.6.0** — deterministic placeholdery
            místo MasKIT fake names. Pro reprodukovatelnost a auditovatelnost.
        regex_pre_pass: Default ``True``. Strukturovaná PII regexem PŘED MasKITem.
        stop_list_filter: Default ``True``. Rollback MasKIT false positives.

    Returns:
        ``anonymized`` (čistý text), ``raw`` (MasKIT raw), ``replacements``
        (list s ``original``, ``placeholder``, ``type``, ``source``),
        ``warnings``, ``sources`` ({maskit, wrapper-regex, wrapper-strict,
        wrapper-placeholder}).
    
- **analyze_morphology** — Tokenizuje, lemmatizuje a označuje slovní druhy pomocí UDPipe 2.

    Pro každý token vrací **lemma** (základní tvar), **UPOS** (universal POS tag),
    **morphological features** (pád, rod, číslo, čas...) a volitelně závislostní
    parse (head + deprel) nebo character ranges (offsety do originálu).

    UDPipe 2 podporuje **961 modelů** pro téměř všechny jazyky světa.
    Auto-detect (default) rozezná: czech, slovak, ukrainian, russian, polish,
    german, english, french (via heuristics).

    Hodí se pro:
    - Fulltextové vyhledávání v právních textech (lemma "soud" matchuje "soudu/soudem/soudy")
    - Filtrování podle slovních druhů (jen substantiva, jen verba)
    - Detekce pasivních konstrukcí (Voice=Pass)
    - Vícejazyčné dokumenty (UA legal aid, EN smlouvy, DE Klage…)

    Args:
        text: Vstupní text.
        model: UDPipe model alias. ``auto`` (default) detekuje jazyk podle markerů.
            Explicit: ``czech``, ``slovak``, ``english``, ``ukrainian``, ``russian``,
            ``polish``, ``german``, ``french``, atd. — 961 modelů celkem.
        include_parse: True = vrátí závislostní parse (head, deprel).
        include_ranges: True = vrátí ``token_range`` (char offsets do originálu).
            Užitečné pro inline highlighting nebo mapování token → text position.

    Returns:
        ``sentences``, ``model``, ``token_count``, ``sentence_count``,
        ``detected_language`` (jen u auto).
    
- **check_readability** — Analyzuje čitelnost českého textu pomocí PONK — 4 feature sety (v0.7.0).

    PONK byl navržen pro úřední komunikaci s občany. V0.7.0 wrapper vystavuje
    všechny 4 jeho feature sety, ne jen metriky:

    1. **Overall metrics** — ARI (years of education needed), Verb Distance,
       Activity, Lexical diversity. (Always returned.)

    2. **Grammatical rules** (``include_rules=True``) — list pravidel které se
       v textu aktivovala. Každé pravidlo má český název a popis. Aktuálně PONK
       detekuje: Nedostatek sloves, Přemíra podstatných jmen, Dlouhé věty,
       Sloveso příliš daleko v klauzi, ...

    3. **Lexical surprise** (``include_lexical_surprise=True``) — distribuce
       sémantické překvapivosti slov (1=běžné, 16=velmi vzácné/odborné).
       Vrátí summary: kolik slov je common / surprising / very_surprising.

    4. **Speech acts** (``include_speech_acts=True``) — typy vět (Situace,
       Kontext, Postup, Proces, Podmínky, Doporučení, Odkazy, Prameny).

    Args:
        text: Vstupní text.
        input_format: ``txt`` (default), ``md``, ``docx``.
        include_rules: Default ``True``. List aktivovaných gramatických pravidel.
        include_lexical_surprise: Default ``True``. Distribuce vzácnosti slov.
        include_speech_acts: Default ``True``. Typy vět/řečové akty.
        include_highlighted_html: Default ``False`` (úspora bandwidthu — HTML
            má 100+ KB). Zapni pro vizualizační report/PDF.

    Returns:
        ``metrics``, ``counts``, ``version``, ``processing_time_s``,
        + volitelné ``rules`` (list), ``lexical_surprise`` (dict),
        ``speech_acts`` (dict), ``highlighted_html`` (str).
    
- **correct_text** — Opraví český text pomocí Korektor — pravopis nebo doplnění diakritiky.

    Use cases pro legal-tech:
    - **spellcheck** (default) — kontrola pravopisu před odesláním podání
    - **spellcheck_strict** — agresivnější (až 2 edits/word)
    - **diacritics** — doplnění diakritiky do textu bez ní
      (OCR výstupy, emaily, mobilní zprávy: ``Jan Vzorek bez hacku`` → ``Jan Vzorek bez háčků``)
    - **strip** — odstranění diakritiky (např. pro URL slugy nebo legacy systémy)

    Pozor: CZ-only. Modely jsou z roku 2013, vlastní jména a nová slova mohou
    mít omezenou přesnost.

    Args:
        text: Vstupní český text.
        mode: Operace — ``spellcheck`` (default), ``spellcheck_strict``,
            ``diacritics``, ``strip``.

    Returns:
        ``corrected`` (upravený text), ``model``, ``mode``, ``changed`` (bool).
    
- **translate_text** — Přeloží text přes Charles Translator (LINDAT) — 8 jazyků, 17 přímých párů
    + auto EN-pivot pro nepřímé páry.

    Podporované jazyky: ``cs`` (čeština), ``en``, ``fr``, ``de``, ``pl``,
    ``ru``, ``uk`` (ukrajinština), ``hi`` (hindština).

    **Přímé páry** (17): cs↔en (+doc), cs↔uk, cs↔ru, en↔fr, en↔de, en↔ru,
    en↔pl, en→hi (jednosměrně).

    **EN-pivot** (auto): pro páry mimo seznam (typicky de→cs, pl→cs, fr→cs,
    fr→de) wrapper provede 2 volání ``src→en→tgt`` a vrátí finální překlad
    + warning + ``pivot=True``. Doc-mode v pivotu nepodporován.

    Klíčové páry pro legal-tech:
    - ``cs-en`` / ``en-cs`` — anglické sumáře, mezinárodní komunikace
    - ``doc-cs-en`` / ``doc-en-cs`` (s ``document_mode=True``) — celé dokumenty
      se zachovanou strukturou odstavců
    - ``cs-uk`` / ``uk-cs`` — ukrajinští klienti / legal aid pro UA migranty
    - ``cs-ru`` / ``ru-cs`` — ruskojazyční klienti
    - ``de-cs`` / ``pl-cs`` / ``fr-cs`` — automatický EN-pivot pro EU sousedy

    Pozor: SK ↔ CZ pár v Charles Translatoru chybí. SK je auto-alias na CS
    (mutual intelligibility). HI lze jen jako tgt (en→hi), ne jako src.

    Charles Translator umí vlastní jména zachovat v originále — užitečné
    pro legal: *"Jan Vzorek podal žalobu u Krajského soudu v Ostravě."*
    → *"Jan Vzorek filed a lawsuit at the Krajský soud v Ostrava."*

    Args:
        text: Text k překladu (UTF-8).
        src: Zdrojový jazyk (default ``cs``).
        tgt: Cílový jazyk (default ``en``).
        document_mode: True pro doc mode (cs↔en only). Zachová strukturu.

    Returns:
        ``translated`` (přeložený text), ``src``, ``tgt``, ``pair``
        (skutečně použitý model name), ``document_mode``, ``input_chars``,
        ``output_chars``.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "anonymize-mcp": {
    "command": "uvx",
    "args": ["anonymize-mcp"]
  }
}
```

## Documentation

## What Buggy1111/anonymize-mcp does

Buggy1111/anonymize-mcp exposes six NLP tools through the Model Context Protocol. It is centered on Czech-language document processing, while its entity recognition and morphology tools cover dozens of languages. The server wraps services from LINDAT and ÚFAL, including NameTag 3, MasKIT, UDPipe 2, PONK, Korektor, and Charles Translator.

Its main privacy workflow is `anonymize`. Structured personal data is detected before broader NLP processing, then remaining entities are pseudonymized. Supported patterns include Czech identifiers and contact data, international IBAN and VAT numbers, selected national identifiers, cryptocurrency addresses, and common API tokens. The result includes anonymized text, replacements, warnings, and the sources used for each replacement.

## How it works

`extract_entities` uses NameTag 3. Czech input can use the detailed CNEC 2.0 categories, while other supported languages use a multilingual PER/ORG/LOC model. Automatic language selection is available, as are optional XML and vertical output formats.

`anonymize` can run a regex pre-pass, a strict entity pre-pass, MasKIT pseudonymization, stop-list filtering, and entity-type classification. With `placeholder_mode`, repeated entities receive stable labels such as `OSOBA1` or `MESTO1` instead of generated substitute names. This produces repeatable output that is easier to audit. The tool can also return a mapping, but that mapping should remain inside the confidential environment when the cleaned text is sent elsewhere.

The morphology tool tokenizes, lemmatizes, and assigns universal part-of-speech tags with UDPipe. It can add dependency parses or character offsets. Readability analysis targets Czech administrative text and can return metrics, grammatical rules, lexical-surprise data, speech-act categories, and optional highlighted HTML. Translation supports eight languages, direct language pairs, document mode for Czech-English, and an English pivot for some indirect pairs.

## Setup and configuration

Install the package from PyPI:

```bash
pip install anonymize-mcp
```

The server uses the standard stdio transport. Register the `anonymize-mcp` executable in an MCP client configuration, or add it to Claude Code with:

```bash
claude mcp add anonymize -s user -- anonymize-mcp
```

For a local zero-egress anonymization workflow, set `ANONYMIZE_MCP_LOCAL=1`. In the default cloud configuration, text is sent to LINDAT and `quest.ms.mff.cuni.cz`; service terms may allow submitted data to be used to improve those systems.

## Tools and capabilities

- `extract_entities`: multilingual named-entity recognition with automatic or explicit model selection.
- `anonymize`: pseudonymization with more than 80 structured PII patterns, warnings, replacement metadata, and deterministic placeholders.
- `analyze_morphology`: tokenization, lemmas, POS tags, morphology, dependency parsing, and character ranges.
- `check_readability`: Czech readability metrics, grammar findings, lexical surprise, speech acts, and optional HTML highlighting.
- `correct_text`: Czech spellchecking, stricter correction, diacritic restoration, or diacritic removal.
- `translate_text`: translation among Czech, English, French, German, Polish, Russian, Ukrainian, and Hindi, including selected document and pivot modes.

## Limitations and notes

The project is intended for non-commercial use. The NameTag and UDPipe models are licensed CC BY-NC-SA, and commercial deployment requires contacting the relevant tool authors. `correct_text` is Czech-only and uses older models, so names and newer vocabulary may be less accurate. Hindi is supported as a translation target from English, not as a source, and Czech-Slovak translation is handled as a Czech alias rather than a dedicated pair.

The newer Claude Desktop Microsoft Store/appx application accepts remote HTTP MCP servers only, so it cannot add this local stdio server. On Windows, the executable may require an absolute path if its Scripts directory is not on `PATH`.

_Full upstream README: https://allmcps.com/mcp/buggy1111-anonymize-mcp/readme_

