Thai Text
FreeNot checkedMCP server giving AI agents correct Thai text handling: word segmentation, caption line wrapping, and tone-mark-safe rendering
About
MCP server giving AI agents correct Thai text handling: word segmentation, caption line wrapping, and tone-mark-safe rendering
README
An MCP server that gives AI agents correct Thai text handling: word segmentation, caption line wrapping, and tone-mark-safe text rendering.
Why
Agents working with Thai run into three problems that do not exist in English:
- No spaces between words. Splitting on whitespace returns the whole sentence as one token. Anything that needs word boundaries (wrapping, counting, alignment to speech) needs a dictionary-based tokenizer.
- Line breaking is a language problem, not a length problem. Breaking captions on character count splits words in half. And even at word boundaries, a line that ends on a lead-in word (เพราะ, แล้ว, คือ) or starts with an enclitic (ครับ, นะ, ไหม) reads wrong on screen.
- Renderers silently misspell Thai. Pillow without libraqm and libass subtitle burn-in both drop stacked tone marks: เนื่อง comes out as เนือง, นี้ as นี. No error is raised. The output is just wrong.
This server packages the fixes as three MCP tools so any client (Claude Code, Claude Desktop, or your own agent loop) can call them.
Tools
| tool | input | output |
|---|---|---|
segment_words |
Thai text | list of words (PyThaiNLP newmm) |
wrap_caption_lines |
Thai text, max chars per line | caption lines broken at word boundaries, with lead-in and enclitic rules applied |
render_text_png |
text, output path, font, size, color, glow | a PNG with HarfBuzz-shaped, correctly stacked Thai text |
Install
pip install -r requirements.txt
Register with Claude Code:
claude mcp add thai-text -- python /path/to/mcp-thai-text/server.py
Or in any MCP client config:
{
"mcpServers": {
"thai-text": {
"command": "python",
"args": ["/path/to/mcp-thai-text/server.py"]
}
}
}
render_text_png needs a Thai-capable font (Kanit, Sarabun, Noto Sans Thai). It checks common install locations and takes an explicit font_path otherwise.
Test
python test_client.py
Spawns the server over stdio as a real MCP client, lists the tools, and exercises all three, including writing an actual PNG and asserting it exists.
Example
wrap_caption_lines on a sentence with max_chars: 14:
เพราะภาษาไทย
ไม่มีช่องว่าง
ระหว่างคำการ
ตัดบรรทัดจึง
ต้องตัด
ที่ขอบเขตของคำ
จริง
Every break lands on a word boundary, no line starts with an enclitic, and no line ends on a lead-in.
Related
- thai-text-render: the standalone rendering library this server's
render_text_pngis built on, with a visual before/after of the tone-mark bug. - thai-talkinghead-autocut: the video pipeline where these rules were battle-tested against real footage.
License
MIT
Install Thai Text in Claude Desktop, Claude Code & Cursor
unyly install thai-textInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add thai-text -- uvx --from git+https://github.com/anthonychkwn/mcp-thai-text mcp-thai-textStep-by-step: how to install Thai Text
FAQ
Is Thai Text MCP free?
Yes, Thai Text MCP is free — one-click install via Unyly at no cost.
Does Thai Text need an API key?
No, Thai Text runs without API keys or environment variables.
Is Thai Text hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Thai Text in Claude Desktop, Claude Code or Cursor?
Open Thai Text on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
by lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Thai Text with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
