Skip to main content

Welsh proofing/validation MCP server — deterministic spelling (hunspell cy_GB) and mutation (treiglad) checking, 100% offline

Project description

cymraeg-mcp

Gweinydd MCP prawfddarllen Cymraeg / Welsh proofing & validation MCP server

cymraeg-mcp yn dal gwallau treiglo / catching mutation errors

English below


Cymraeg

Haen ddilysu benderfynadwy ar gyfer testun Cymraeg: gwirio sillafu (hunspell cy_GB) a gwirio treigladau (peiriant rheolau lleol). 100% lleol — dim APIau allanol, dim allweddi API, dim lawrlwytho wrth redeg, yn gweithio'n gyfan gwbl all-lein.

Nid pecyn cymorth Cymraeg cyffredinol mo hwn. Mae LLMau eisoes yn ysgrifennu Cymraeg dda — y broblem yw nad oes modd gwarantu cywirdeb allbwn tebygolaethol. Yr egwyddor yma yw: "Claude sy'n drafftio, hwn sy'n dilysu." Wedi'i anelu at unrhyw un sy'n cyhoeddi cynnwys dwyieithog dan Safonau'r Gymraeg — cynghorau, GIG Cymru, cyrff cyhoeddus — sydd angen gramadeg gwarantedig-gywir.

Offer

Offeryn Mewnbwn Allbwn
cymraeg_check_spelling testun Cymraeg camsillafiadau + awgrymiadau (hunspell cy_GB Prifysgol Bangor)
cymraeg_check_mutations testun Cymraeg gwallau treiglo (meddal / trwynol / llaes) gyda chywiriadau, hyder, a'r rheol yn ddwyieithog
cymraeg_explain_mutation gair + cyd-destun pa dreiglad sy'n berthnasol a pham, ynghyd â thabl treiglo llawn y gair
cymraeg_proof_text testun Cymraeg adroddiad cyfun: sillafu + treigladau mewn un pas

Gosod

Gweler y cyfarwyddiadau gosod yn yr adran Saesneg isod — mae'r gorchmynion yn union yr un fath.

Cyfrannu

Mae'r rheolau treiglo yn data/mutation_rules.yaml — ychwanegwch sbardunau, enwau benywaidd, neu eithriadau yno a chyflwynwch PR. Rhedwch uv run pytest cyn cyflwyno.


English

A deterministic validation layer for Welsh text: spellchecking (hunspell cy_GB) and mutation checking (a local rules engine). 100% local — no external APIs, no API keys, no first-run downloads, fully offline.

This is NOT a general Welsh toolkit. LLMs already write good Welsh — the problem is that probabilistic output can't be guaranteed correct. The positioning here is: "Claude drafts it, this verifies it." Target users: anyone publishing bilingual content under the Welsh Language Standards (councils, NHS Wales, public bodies) who need guaranteed-correct grammar rather than probabilistic LLM output.

Novelty: as of July 2026, no other Welsh-language MCP server exists.

Tools

Tool Input Output
cymraeg_check_spelling Welsh text misspellings + up to 5 suggestions each (Bangor University hunspell cy_GB, 72k+ entries, bundled)
cymraeg_check_mutations Welsh text mutation errors (treiglad meddal / trwynol / llaes) with corrections, confidence levels, and the rule cited bilingually
cymraeg_explain_mutation word + context which mutation applies and why, whether the word is radical or mutated, and the word's full mutation table
cymraeg_proof_text Welsh text combined report: spelling + mutation issues in one pass

All tools are read-only, idempotent, and fully offline.

What the mutation engine covers

  • Soft mutation (treiglad meddal): after the prepositions am, ar, at, dan, tan, dros, drwy/trwy, gan, heb, hyd, i, o, wrth; after dy, dau, dwy, neu, mor, rhy, pur, go, dyma, dyna, dacw, pa; feminine singular nouns after y/yr/'r/un (using an extensible noun list); with the ll/rh exceptions applied.
  • Nasal mutation (treiglad trwynol): after fy; yn/ym/yng locative with form agreement (flags "yn Nghaerdydd" → "yng Nghaerdydd", "ym Bangor" → "ym Mangor"); blynedd/blwydd after numerals (pum mlynedd).
  • Aspirate mutation (treiglad llaes): after â, gyda, tua, tri, chwe, a (and), ei (her), na.
  • Ambiguity handled honestly: "ei" (his/her) is disambiguated by an echoing pronoun where present ("ei tad hi" → "ei thad hi"); "a" offers both the aspirate (conjunction) and soft (relative pronoun) readings; genuinely ambiguous cases are reported at low confidence and hidden by default.

The engine is tuned for precision over recall: it only flags what it can justify from an explicit trigger rule plus a dictionary check, and every finding carries a confidence level. A clean result does not guarantee every mutation is correct — see limitations.

Install

Requires Python 3.11+. With uv (preferred):

git clone https://github.com/dwain-barnes/cymraeg-mcp
cd cymraeg-mcp
uv sync

Or with pip:

pip install .

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "cymraeg": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/cymraeg-mcp", "cymraeg-mcp"]
    }
  }
}

Claude Code

claude mcp add cymraeg -- uv run --directory /path/to/cymraeg-mcp cymraeg-mcp

Example

Input: cymraeg_proof_text("Dw i eisiau mynd i Caerdydd gyda fy cath.")

Output: 2 mutation issues — CaerdyddGaerdydd (soft mutation after the preposition 'i'), cathnghath (nasal mutation after 'fy').

Limitations (read this)

  • A clean report is not a proof of correctness. The engine deliberately stays silent where Welsh is genuinely ambiguous without deeper parsing — e.g. unmutated words after predicative/locative "yn", gender of nouns not in its list, mutation after inflected verbs (object soft mutation), and wrong-mutation-type cases like "gyda dad".
  • The feminine-noun rule only covers nouns listed in data/mutation_rules.yaml (extensible by PR).
  • The dictionary includes correctly mutated forms, so the spellchecker will not flag a mutation error as a misspelling — that's the mutation checker's job.
  • hunspell cy_GB is comprehensive (72k+ stems plus affix rules) but no dictionary is complete; rare proper nouns may be reported as unknown.

Licensing

  • Code: MIT © Dwain Barnes (EryriLabs).
  • Bundled dictionary (data/dictionaries/cy_GB.*): © Bangor University (Prifysgol Bangor) and Troi, licensed under the LGPL v3 or later — see data/dictionaries/LICENCE. It is redistributed unmodified with its licence and attribution intact, as permitted by the LGPL.
  • No data leaves your machine; there is no telemetry and no network access.

Contributing

Mutation rules live in data/mutation_rules.yaml — triggers, feminine nouns, exceptions and never-mutate words are all data, not code. Add a rule, add a test case to tests/test_mutations.py, and run:

uv run pytest
uv run ruff check src tests

Credits

Built by Dwain Barnes / EryriLabsHuggingFace. Dictionary by Uned Technolegau Iaith, Prifysgol Bangor.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cymraeg_mcp-0.1.0.tar.gz (424.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cymraeg_mcp-0.1.0-py3-none-any.whl (270.2 kB view details)

Uploaded Python 3

File details

Details for the file cymraeg_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: cymraeg_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 424.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for cymraeg_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62b8a3a1f6ec42f4a03aadc13bf2e27b44af8df00179d4e9f90ab08bb1b123a7
MD5 2c9974d6944e7afc576ef33a046847b5
BLAKE2b-256 baf276cee38b307a96ae1167039f77306ef05dc5124b641ea10c994e26617d24

See more details on using hashes here.

Provenance

The following attestation bundles were made for cymraeg_mcp-0.1.0.tar.gz:

Publisher: release.yml on dwain-barnes/cymraeg-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cymraeg_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cymraeg_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 270.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for cymraeg_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e9aa21127aed6bc1e2b62eaa76d924acd8405214a8183e9d17f231df5a26d03
MD5 cd313eb3f82bd69228209a27f0713999
BLAKE2b-256 089505f73ff5a0670292d43deab60b0041b5fb0f42e02d13da7bdd71bc2c5949

See more details on using hashes here.

Provenance

The following attestation bundles were made for cymraeg_mcp-0.1.0-py3-none-any.whl:

Publisher: release.yml on dwain-barnes/cymraeg-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page