Skip to main content
Glama

zh-dict-mcp

MCP server for Chinese figurative language lookup, backed by CC-CEDICT.

What it does: given a Chinese word or phrase, tells you whether its figurative usage has been lexicalized (recorded in the dictionary as an independent sense) or is a one-off creative expression.

Why it exists: LLMs writing Chinese dialogue, fiction, or roleplay tend to invent purple-prose figurative expressions that no real person would say (e.g., "他把心锁进铁盒里" / "墙比夜更厚"). This tool gives you an objective dictionary-backed check.


Install

Pick your MCP-aware client. Across all of them the runtime command is the same — uvx zh-dict-mcp — but the wrapping config differs.

Claude Code

claude mcp add zh-dict-mcp -- uvx zh-dict-mcp

Codex CLI

codex mcp add zh-dict-mcp -- uvx zh-dict-mcp

Or edit ~/.codex/config.toml directly:

[mcp_servers.zh-dict-mcp]
command = "uvx"
args = ["zh-dict-mcp"]

Cursor

In Cursor: Settings → MCP → Add new server (UI), or edit ~/.cursor/mcp.json:

{
  "mcpServers": {
    "zh-dict-mcp": {
      "command": "uvx",
      "args": ["zh-dict-mcp"]
    }
  }
}

Claude Desktop

Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):

{
  "mcpServers": {
    "zh-dict-mcp": {
      "command": "uvx",
      "args": ["zh-dict-mcp"]
    }
  }
}

Restart Claude Desktop to load the server.

Windsurf / Zed / other MCP-aware clients

The JSON block above is universal — find your client's MCP config file (search for "MCP" in its settings docs) and paste it in.

With an optional project whitelist

If you have a project-level whitelist of "approved dead metaphors" the dictionary happens to miss, point the server at it:

"args": ["zh-dict-mcp", "--whitelist", "/abs/path/to/your_whitelist.yaml"]

Or set the environment variable ZH_DICT_WHITELIST=/abs/path/to/your_whitelist.yaml.


After install, the lookup_dictionary tool is exposed to your AI client. uvx pulls the package from PyPI on first run, caches it locally, then launches the stdio MCP server. No pip install needed.


Related MCP server: FHL Bible MCP Server

What you get

A single MCP tool:

lookup_dictionary(word: string) → JSON

Example: lookup_dictionary("看见") returns:

{
  "word": "看见",
  "found_in_cedict": true,
  "simplified": "看见",
  "traditional": "看見",
  "pinyin": "kan4 jian4",
  "definitions": ["to see", "to catch sight of"],
  "tags": {
    "has_figurative": false,
    "is_neologism": false,
    "is_slang": false,
    "has_idiom_marker": false
  }
}

Example: lookup_dictionary("内卷") returns:

{
  "word": "内卷",
  "found_in_cedict": true,
  "definitions": [
    "(embryology) to involute; involution",
    "(neologism, attested by 2017) (of a society) to become more and more involuted..."
  ],
  "tags": { "is_neologism": true, ... }
}

Example: lookup_dictionary("锁进铁盒里") (a creative one-off) returns:

{
  "word": "锁进铁盒里",
  "found_in_cedict": false,
  "found_in_whitelist": false,
  "definitions": []
}

Use cases

  • AI-generated dialogue review: catch live metaphors LLM invents but no real speaker would use

  • AI writing lint: pipeline filter for game NPC dialogue / interactive fiction / chatbot scripts

  • Lexicalization research: check whether a figurative expression has been recorded in standard dictionaries

  • New word verification: confirm neologisms / slang with (neologism, attested by YEAR) attribution

  • Idiom / 典故 lookup: get figurative sense for idioms like "滑铁卢" → "(fig.) a defeat"


Data source

CC-CEDICT — open Chinese-English dictionary, 12.5万条目, community-maintained, weekly updates.

License: CC BY-SA 4.0. Bundled in package. See LICENSE-CC-CEDICT.

Why CC-CEDICT vs 现代汉语词典 (XDHYCD) or other sources:

Source

Coverage on AI-writing test set

Notes

chinese-xinhua (GitHub data)

46%

Heavy classical/古汉语 bias

现代汉语词典 第7版 (XDHYCD7th)

56%

Doesn't list literal compound words (放下/抓住/等等)

CC-CEDICT

~95%

Modern usage + neologisms + (fig.) / (slang) / (neologism) markers

CC-CEDICT explicitly tags figurative senses, neologisms with attestation years, slang, and idioms — exactly the structure needed for figurative-language analysis.


Optional: project whitelist

For project-specific overrides (e.g., words CC-CEDICT happens to miss):

# my_whitelist.yaml
allowed:
  - word: 凛然
    note: Standard literary usage, CC-CEDICT misses it
  - word: 头疼
    note: Override to include "annoyance" figurative sense

Pass via CLI:

{
  "mcpServers": {
    "zh-dict-mcp": {
      "command": "uvx",
      "args": ["zh-dict-mcp", "--whitelist", "/abs/path/to/my_whitelist.yaml"]
    }
  }
}

Or via env var ZH_DICT_WHITELIST=/path/to/file.yaml.

When a word is in the whitelist, the result includes "found_in_whitelist": true and the note.


Python API (no MCP needed)

Use the lookup library directly without launching a server:

from zh_dict_mcp import DictionaryLookup

lookup = DictionaryLookup()  # bundled CC-CEDICT loads in ~200ms
result = lookup.lookup("滑铁卢")

print(result.found)              # True
print(result.definitions)        # ['Waterloo (Belgium)', 'Battle of Waterloo (1815)', '(fig.) a defeat']
print(result.tags.has_figurative)  # True
print(result.pinyin)             # 'Hua2 tie3 lu2'

With custom whitelist:

from pathlib import Path
lookup = DictionaryLookup(whitelist_path=Path("my_whitelist.yaml"))

lookup.py has zero external dependencies (stdlib only). The mcp dependency is only needed for the MCP server.


Install standalone (no MCP, just Python library)

pip install zh-dict-mcp

Or with uv:

uv add zh-dict-mcp

Limitations

  • English-language definitions (CC-CEDICT is a Chinese-English dictionary). Works well with LLMs that handle cross-lingual judgment (Claude, GPT-4+, Gemini). For monolingual Chinese consumers you'd need a translation layer.

  • Sense matching is on the caller — this tool returns all senses; deciding whether the speaker's intended sense matches a returned sense is left to the LLM or human reviewer.

  • Single-word / single-phrase lookup — doesn't parse full sentences. Wrap with your own NLP layer for sentence-level work.

  • 9.4 MB data bundle — CC-CEDICT data is included in the wheel for offline use.


How it fits with broader writing-quality pipelines

This tool is one piece of a larger "AI-generated text quality" framework. Typical usage flow:

LLM generates Chinese dialogue
   ↓
Scan for figurative expressions (比喻 / 借代 / 委婉 / ...)
   ↓
For each: lookup_dictionary(expression)
   ↓
  ├── found + sense matches intent → pass
  └── not found or sense mismatch → flag for rewrite

A reference review prompt for this flow is documented in Forgewright (the project that spawned this tool).


Project status

v0.1.0 — initial release. Validated on a 39-case test set covering 6 categories (dead metaphors / live metaphors / literal words / boundary cases / idioms / neologisms) with 100% accuracy.

Bug reports and PRs welcome.

License

  • Code: MIT (see LICENSE)

  • CC-CEDICT data: CC BY-SA 4.0 (see LICENSE-CC-CEDICT)

Available Tools

1 tool
lookup_dictionaryA

Look up a Chinese word or phrase in CC-CEDICT (12.5万条目,含简繁双码), optionally augmented by a project whitelist. Returns definitions, pinyin, and structured tags (has_figurative / is_neologism / is_slang / has_idiom_marker / has_literal_only).

Use cases:

  • Detect whether a Chinese figurative expression has been lexicalized (dead metaphor → intended sense in dictionary) or is creative (live metaphor → not in dictionary).

  • Verify neologisms / slang acceptability.

  • Look up idiom (成语 / 典故) figurative senses.

Returns JSON with: word, found_in_cedict, found_in_whitelist, simplified, traditional, pinyin, definitions, tags, whitelist_note.

ParametersJSON Schema
NameRequiredDescriptionDefault
wordYesChinese word or phrase (simplified or traditional accepted)

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It details return structure (word, found flags, pinyin, definitions, tags) and explains tags like figurative and idiom. It omits potential error handling or performance aspects, but overall transparent for a lookup tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is compact but includes use cases and return structure in a logical order. Could be slightly tighter, but no wasted sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, description explains return fields adequately. It covers purpose, use cases, and return format. Missing details on error cases or performance, but sufficient for a simple lookup tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the description adds context about whitelist augmentation and return values but does not provide additional parameter-specific constraints (e.g., allowed characters, length limits). Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it looks up Chinese words in CC-CEDICT, with details on dictionary size, optional whitelist, and return values. It leaves no ambiguity about the tool's function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly lists three use cases: detecting figurative expressions, verifying neologisms/slang, and looking up idiom senses. This provides clear when-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observedlookup_dictionary

TDQS

A4.4/5.0
Disambiguation5/5

Only one tool exists, so there is no risk of confusion between tools.

Naming Consistency5/5

With a single tool, naming is trivially consistent.

Tool Count4/5

A single lookup tool is appropriate for a dictionary server, though additional tools for batch lookup or word management could be justified.

Completeness5/5

The tool provides comprehensive coverage: lookup with definitions, pinyin, tags, and support for neologisms, idioms, and figurative language.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables querying Chinese enterprise business data including company profiles, shareholder information, investments, branch offices, and key personnel through fuzzy search and detailed lookups.
    4
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides access to comprehensive Chinese and multilingual Bible study resources from the Faith, Hope, Love (信望愛站) API, including verse lookup, original language analysis, commentaries, apocrypha, and topical studies.
    16
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Multilingual name romanization lookup across Chinese, Japanese, Korean, Arabic, Vietnamese, and more. Resolves whether two name spellings refer to the same person — Chan/Chen/陳/陈, Hsu/Xu, Chou/Zhou — across Pinyin, Wade-Giles, Cantonese, Hokkien, and other romanization systems.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/outsiderrr/zh-dict-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server