韵典网(ytenx.org)音韵查询 MCP Server — 支持查詢廣韻、中原音韻、洪武正韻牋、分韻撮要、上古音系五部韻書的漢字音韻數據。v0.3.0 全面加固传输层稳定性:CancelledError 全链路捕获、信号处理器重构(task cancel 替代 sys.exit)、工具调用 30s 超时保护、asyncio 后台异常捕获,彻底修复反复出现的 -32000 Connection closed 错误。
Project description
ytenx-mcp
韵典网(ytenx.org)音韵查询 MCP Server — 支持查询单个汉字的音韵数据,覆盖五部韵书。
功能
通过 MCP 协议提供 query_character_phonology 工具,查询以下五部韵书:
| 韵书 | dict key | 说明 |
|---|---|---|
| 廣韻 | guangyun |
宋代韵书,记录中古音 |
| 中原音韻 | zhongyuan |
元代韵书,记录近古音 |
| 洪武正韻牋 | hongwu |
明代韵书 |
| 分韻撮要 | fenyun |
清代粤语韵书 |
| 上古音系 | shanggu |
郑张尚芳上古音拟音 |
安装
使用 uvx(推荐,无需手动安装)
uvx ytenx-mcp
使用 pip
pip install ytenx-mcp
python -m ytenx_mcp
MCP Client 配置
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"ytenx": {
"command": "uvx",
"args": ["ytenx-mcp"]
}
}
}
或使用 pip 安装后:
{
"mcpServers": {
"ytenx": {
"command": "python",
"args": ["-m", "ytenx_mcp"]
}
}
}
Claude Code (mcp.json)
{
"mcpServers": {
"ytenx": {
"command": "uvx",
"args": ["ytenx-mcp"]
}
}
}
Tool Schema
query_character_phonology
查询单个汉字的音韵数据。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
character |
string | 是 | 要查询的单个汉字,如 東、魚 |
dictionaries |
string[] | 否 | 指定查询的韵书列表,默认全部五部。可选值:guangyun、zhongyuan、hongwu、fenyun、shanggu |
返回格式:
{
"character": "東",
"dictionaries": {
"guangyun": {
"name": "廣韻",
"entries": [
{
"character": "東",
"entry_index": 1,
"fanqie": "德紅切",
"xiaoyun": "東",
"yun_she": "通開一平",
"rhyme_group": "東",
"initial": "端",
"baxter": "tuwng",
"gu_yun": "tung",
"annotation": "春方也說文曰動也从日在木中...",
"raw_phonetic_header": "德 紅 切 東 小韻",
"raw_rhyme_info": "通開一平 東 端 (白一平: tuwng; 古韻: tung)"
}
],
"not_found": false
},
"zhongyuan": {
"name": "中原音韻",
"entries": [
{
"character": "東",
"entry_index": 1,
"initial": "端",
"rhyme_group": "東鍾",
"tone": "陰平",
"xiaoyun": "東",
"raw_phonetic_info": "端 母 東鍾 韻 陰平 東 小韻"
}
],
"not_found": false
},
"hongwu": {
"name": "洪武正韻牋",
"entries": [
{
"character": "東",
"entry_index": 1,
"fanqie": "德紅切",
"tone": "平聲",
"rhyme_group": "一東",
"xiaoyun": "東",
"romanization": "tuŋ",
"annotation": "【正韻】徳紅切春方也..."
}
],
"not_found": false
},
"fenyun": {
"name": "分韻撮要",
"entries": [
{
"character": "東",
"entry_index": 1,
"initial": "端",
"rhyme_group": "東",
"tone": "陰平",
"xiaoyun": "東",
"annotation": "東西"
}
],
"not_found": false
},
"shanggu": {
"name": "上古音系",
"entries": [
{
"character": "東",
"entry_index": 1,
"phonetic_element": "東",
"rhyme_group": "東",
"rhyme_subdivision": 0,
"reconstruction": "toːŋ",
"annotation": "種(種籽)初文..."
}
],
"not_found": false
}
}
}
当某部韵书查询不到数据时,entries 为空数组且 not_found 为 true,不会抛出错误。
依赖
- Python 3.10+
- httpx — 异步 HTTP 客户端
- beautifulsoup4 + lxml — HTML 解析
- mcp — MCP Python SDK
许可证
MIT
数据来源
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
dhcckb_ytenx_mcp-0.3.0.tar.gz
(13.4 kB
view details)
File details
Details for the file dhcckb_ytenx_mcp-0.3.0.tar.gz.
File metadata
- Download URL: dhcckb_ytenx_mcp-0.3.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Bun/1.3.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba9de31bb28be81e76bb2f4313d964c941d2da22dd2c48e1cf907086a8b22590
|
|
| MD5 |
46851ef2ba7cef030f29b6f9bfd8d904
|
|
| BLAKE2b-256 |
03c352f703774d5636efaae0775634520b47cd0e17ce39bf0561f7e42fc6d284
|