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
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 —
Caerdydd→Gaerdydd(soft mutation after the preposition 'i'),cath→nghath(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_GBis 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 / EryriLabs — HuggingFace. Dictionary by Uned Technolegau Iaith, Prifysgol Bangor.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62b8a3a1f6ec42f4a03aadc13bf2e27b44af8df00179d4e9f90ab08bb1b123a7
|
|
| MD5 |
2c9974d6944e7afc576ef33a046847b5
|
|
| BLAKE2b-256 |
baf276cee38b307a96ae1167039f77306ef05dc5124b641ea10c994e26617d24
|
Provenance
The following attestation bundles were made for cymraeg_mcp-0.1.0.tar.gz:
Publisher:
release.yml on dwain-barnes/cymraeg-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cymraeg_mcp-0.1.0.tar.gz -
Subject digest:
62b8a3a1f6ec42f4a03aadc13bf2e27b44af8df00179d4e9f90ab08bb1b123a7 - Sigstore transparency entry: 2223513745
- Sigstore integration time:
-
Permalink:
dwain-barnes/cymraeg-mcp@d24de72f67e6a52beb0a1174ccc143a625f1aa15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dwain-barnes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d24de72f67e6a52beb0a1174ccc143a625f1aa15 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e9aa21127aed6bc1e2b62eaa76d924acd8405214a8183e9d17f231df5a26d03
|
|
| MD5 |
cd313eb3f82bd69228209a27f0713999
|
|
| BLAKE2b-256 |
089505f73ff5a0670292d43deab60b0041b5fb0f42e02d13da7bdd71bc2c5949
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cymraeg_mcp-0.1.0-py3-none-any.whl -
Subject digest:
9e9aa21127aed6bc1e2b62eaa76d924acd8405214a8183e9d17f231df5a26d03 - Sigstore transparency entry: 2223514101
- Sigstore integration time:
-
Permalink:
dwain-barnes/cymraeg-mcp@d24de72f67e6a52beb0a1174ccc143a625f1aa15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dwain-barnes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d24de72f67e6a52beb0a1174ccc143a625f1aa15 -
Trigger Event:
release
-
Statement type: