字典查询服务器

为卢森堡在线词典提供优化的MCP服务器,支持搜索、查询、动词变位和缓存功能,专为减少AI工具令牌消耗设计。

  • by OpenSprooch
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 Mohammed-Ashour/lod-mcp

使用说明

LOD-MCP

A token-optimized MCP server for the Luxembourgish Online Dictionary

Look up Luxembourgish words in the LOD dictionary from any MCP-compatible AI tool — search, look up, conjugate, and cache, all shaped to cost the model as few tokens as possible.


快速开始

先决条件: 紫外线 Python 3.13+

git clone https://github.com/OpenSprooch/lod-mcp
cd lod-mcp
./install.sh          # uv venv + install + test

然后添加到 克劳德桌面 (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "lod-mcp": {
      "command": "/path/to/lod-mcp/run-mcp.sh"
    }
  }
}

重新启动克劳德(Cmd+Q→ 重新打开),你就完成了。

Manual installation
uv venv .venv --python 3.13
uv pip install --python .venv/bin/python -e .

创建 run-mcp.sh:

#!/bin/bash
export PYTHONUNBUFFERED=1
exec /path/to/lod-mcp/.venv/bin/lod-mcp

chmod +x run-mcp.sh

工具

所有工具都遵循一个简单的两步流程-- 搜索 为了让一个单词获得一个ID,那么 查找 详细信息请参考该ID:

graph LR
  subgraph Search["🔍 Search"]
    direction LR
    W["word(s)"] --> search_word
    W --> search_word_brief
    W --> search_words
    P["prefix"] --> autocomplete
  end

  subgraph Lookup["📖 Lookup"]
    direction LR
    ID["lod_id"] --> get_entry
    ID --> get_def
    ID --> get_conjugation
    IDs["lod_ids"] --> get_entries
    IDs --> get_defs
    IDs --> get_conjugations
  end

  search_word & search_word_brief & autocomplete --> ID
  search_words --> IDs

  subgraph Cache["⚙️ Cache"]
    cache_stats
    cache_clear
  end
工具 功能 关键参数
search_word 查找单词→ LOD ID列表 word, max_results
search_word_brief 查找单词→ {id: "word (POS)"} word, max_results
search_words ⭐ 批量搜索多个单词 words[], max_results
autocomplete 提前键入建议 prefix, limit
get_entry 完整的参赛详情 lod_id, langs, max_examples
get_entries ⭐ 批量输入详细信息 lod_ids[], langs, max_examples
get_def 单语言定义字符串 lod_id, lang
get_defs ⭐ 批次定义 lod_ids[], lang
get_conjugation 动词变位表 lod_id
get_conjugations ⭐ 批量偶联 lod_ids[]
cache_stats 缓存命中/未命中统计数据 --
cache_clear 清除缓存 --

⭐ = 比起在循环中调用单个单词的工具,更喜欢这些工具——更少的工具调用和令牌。

快速示例

# Search
search_word("haus")              → ["HAUS1", "HAUSEN1"]
search_word_brief("haus")        → {"HAUS1": "Haus (N)", "HAUSEN1": "hausen (V)"}
autocomplete("ha", limit=3)      → "haus, hausen, hausfrau"

# Look up
get_def("HAUS1", "en")           → "Haus: house building; house household, family"
get_entry("GOEN1", langs="en")   → {id, w, pos, ipa, tr, ex, infl, audio …}
get_conjugation("GOEN1")         → {inf, pp, aux, ind, cnd, imp …}

# Batch (recommended for multiple words)
search_words(["haus","schoul"])  → {"haus": {"HAUS1": "Haus (N)"}, "schoul": {"SCHOUL1": "Schoul (N)"}}
get_defs(["HAUS1","SCHOUL1"])    → {"HAUS1": "Haus: house …", "SCHOUL1": "Schoul: school …"}

故障排除

  • 安装失败? --确保 紫外线 已安装,Python 3.13+可用
  • 服务器无法启动? --手动测试: ./run-mcp.sh 应输出JSON
  • 导入错误? --重新安装: uv pip install --python .venv/bin/python -e .
  • 重新开始: ./uninstall.sh && ./install.sh

详情

  • 缓存 -1小时TTL,减少重复的API调用
  • 频率限制 -请求间隔100ms,遵守LOD API
  • 语言 --德语、法语、英语、葡萄牙语、荷兰语
  • 源 — API LOD 卢森堡文化部
Part of OpenSprooch — Luxembourgish-language tooling.

MIT许可证