Swift native MCP Server for converting Chinese Mainland terms to Taiwanese Mandarin equivalents.
Detects and replaces mainland Chinese vocabulary with Taiwan-standard phrasing, powered by dictionaries from g0v (MOE data) and Wikipedia.
Requires Swift 5.9+ and macOS 13+.
git clone https://github.com/kiki830621/che-cn2tw-mcp.git
cd che-cn2tw-mcp
swift build -c releaseBinary location: .build/release/CheCn2TwMCP
claude mcp add che-cn2tw-mcp -s user -- /path/to/.build/release/CheCn2TwMCPVerify:
claude mcp get che-cn2tw-mcp
# Should show: Status: ✓ ConnectedAdd to ~/.claude.json:
{
"mcpServers": {
"che-cn2tw-mcp": {
"type": "stdio",
"command": "/path/to/.build/release/CheCn2TwMCP"
}
}
}Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"che-cn2tw-mcp": {
"command": "/path/to/.build/release/CheCn2TwMCP"
}
}
}After connecting, run update_dictionary to download term data:
update_dictionary # Download from all sources
update_dictionary source=g0v # g0v only
update_dictionary source=wikipedia # Wikipedia only
Dictionary files are stored at ~/.che-cn2tw-mcp/.
| Tool | Description |
|---|---|
convert_text |
Detect and replace mainland terms in text, returns converted text + change list |
lookup_term |
Look up a single term (supports both CN→TW and TW→CN) |
search_terms |
Fuzzy search the dictionary |
| Tool | Description |
|---|---|
update_dictionary |
Download/refresh dictionary from online sources (g0v, Wikipedia) |
add_term |
Add a custom CN→TW mapping (saved to ~/.che-cn2tw-mcp/custom.json) |
remove_term |
Remove a custom mapping |
| Tool | Description |
|---|---|
list_categories |
List all term categories with counts |
get_stats |
Show dictionary stats (entry count, sources, last update) |
| Source | Format | Scale |
|---|---|---|
g0v/moedict-data-csld (=同實異名.json) |
JSON | ~750 pairs |
| g0v/moedict-data-csld (同實異名.csv) | CSV | ~1,000 pairs |
| Wikipedia (兩岸四地用語差異, 海峽兩岸術語差異) | Wikitext | Community-maintained |
User custom (~/.che-cn2tw-mcp/custom.json) |
JSON | Unlimited |
Once connected, ask Claude things like:
- "幫我把這段文字轉成台灣用語:这个视频的质量很高"
- "查一下「軟件」的台灣說法"
- "搜尋跟「網路」有關的對照詞彙"
- "新增自訂對照:信息 → 資訊"
- "更新詞庫"
- "顯示詞庫統計"
Sources/
├── CheCn2TwMCP/
│ └── main.swift # Entry point
└── CheCn2TwMCPCore/
├── Server.swift # MCP Server (8 tools + dispatch)
├── TermDictionary.swift # Dictionary load/save/search/convert
└── DictionaryUpdater.swift # Online fetcher (g0v + Wikipedia)
- No third-party dependencies beyond MCP Swift SDK
- Uses
URLSessionfor all HTTP requests - Longest-match-first algorithm prevents substring false positives
- Custom terms override built-in dictionary entries
The convert_text tool uses a longest-match-first algorithm:
- Sort all CN terms by length (descending)
- Scan through input text, matching the longest term first
- Track replaced positions to avoid overlapping replacements
- Return converted text + a change list with positions
Input: "這個視頻的質量很高"
Output: "這個影片的品質很高"
Changes: [
{ "視頻" → "影片", position: 3 },
{ "質量" → "品質", position: 6 }
]
MIT