Chinese History Mcp

io.github.lizhuojunx86由 GitHub 帳號 lizhuojunx86 發布v0.3.0更新於 Oct 24, 2026

Traceable Chinese-history MCP: 4 cited tools over 9 classical texts (pre-Qin to Wei-Jin).

概覽

AI 產生的概覽

一個在本機執行、唯讀的 MCP 伺服器,讓助理檢索九部中國古典史籍並取得附出處的結果。

可以做什麼
依關鍵字、典籍、人物或類型跨書檢索歷史事件,每筆結果標註書名、篇章、段落與來源角色。依姓名或別名查詢人物,回傳人物簡介、原文評價、品質標籤、相關事件與人物關係。依現代地名查找古代故事,同名異地時回傳候選供消歧。依受控詞表中的品質檢索代表性事件、人物與故事,並附原文證據引文。所有結果以 JSON 回傳並帶引用。
適用情境
適合需要助理回答先秦至魏晉中國歷史問題並給出可溯源引用,而非無出處敘述的情境;也適合用固定的九部典籍語料核對某項說法。
執行需求
以 stdio 在本機執行。需要 Python 3.9 或更新版本(僅用標準函式庫),或以 uvx 免安裝執行。語料資料庫檔案未隨套件提供,需從專案 Releases 另行下載,並透過 --db 參數或 STORYEXTRACTOR_DB 環境變數指定。未宣告需要驗證、API 金鑰或網路存取。
安裝前請注意
結果並非逐筆人工審核:事件紀錄多為機器批次核准,人物簡介為 LLM 生成的草稿,品質與地名對應多為多個 LLM 的共識。標點、斷詞與白話翻譯皆為機器生成。引用僅是供人工查核的依據,伺服器無法阻止助理在其周邊憑空編造內容。涵蓋範圍僅限這九部典籍,查不到只表示不在該語料中,並不代表史實不存在。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Chinese History Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

chinese-history-mcp

[CI] [PyPI] [License: MIT] [Data: CC BY 4.0] [Python 3.9+] [Dependencies: zero] [MCP] [Release]

A traceable Chinese-history MCP server. Four Model Context Protocol tools over 9 classical Chinese texts (pre-Qin to Wei-Jin — 史记 / 汉书 / 后汉书 / 三国志 / 左传 / 论语 / 孟子 / 吕氏春秋 / 资治通鉴). Every result carries a 【book → chapter → paragraph】 citation, and honestly reports its review_status — the server never claims per-item human review it doesn't have.

一个可溯源的中国历史故事 MCP server:按事件 / 人物 / 今地名 / 品质四轴查询 先秦-汉魏九部正史子书,每条返回都带原文出处,机器生成/机审内容如实标注。

[Demo — every result is cited]

  • Zero runtime dependencies — pure Python standard library. No pip install of a framework, no MCP SDK; the whole server is auditable in a few files.
  • Read-only — opens the corpus with mode=ro + PRAGMA query_only; never writes.
  • Honest by construction — machine-generated punctuation / translation and machine-adjudicated status are labeled in every response (AIGC-compliant).

Why this exists: as of mid-2026 the public MCP ecosystem has no classical Chinese / Chinese-history server. This fills that gap. Income expectation is zero; the goal is a useful public good.

Contents: The four tools · Install & run · The corpus database · Honesty · Data & provenance · Design notes


The four tools

toolinputreturns
search_eventskeyword / book / person / kind / limitCross-book fused historical events with per-source provenance (book · chapter · paragraph + role: primary/detailed/brief/comment/corroborating). canonical_summary is an LLM-fused machine narrative. Optional kind filter (事件/场景/评价; unset = all, including appraisal events). time_label may be derived from reviewed time anchors — time_label_source says which (manual vs derived; omitted on pre-0.2 data).
get_personname (given name or alias)Person profile (LLM-synthesized, draft) + others' appraisals (verbatim source quotes, each cited) + attributed qualities + events mentioning them + person-to-person relations (closed 26-type vocabulary — kinship/ruler-minister/mentorship/alliance/enmity; machine-reviewed, only approved/auto_approved exposed, no temporal bounds; empty on pre-0.2 data).
query_by_placeplace (today's place name) / limitAncient stories set on the land of a modern place, with citations. Same-name-different-place returns candidates for you to disambiguate — it never silently picks one. Directional/regional generic names are excluded.
query_by_qualityquality (from a 55-term controlled vocabulary, e.g. 忠 loyalty, 谋略 strategy) / limit / include_draftRepresentative events, people, and stories for a quality, each with an original-text evidence_quote and rationale.

Each tool call returns JSON. Multi-source events, person appraisals, and place/quality edges all carry the exact 【book → chapter → paragraph】 they came from — that is the point of the server.


Install & run

Requires Python 3.9+ (standard library only — nothing else is installed). The server speaks MCP over stdio (newline-delimited JSON-RPC 2.0).

bash
pip install chinese-history-mcp# then (after downloading corpus.db from Releases — see below):chinese-history-mcp --db /path/to/corpus.db

Or run without installing, straight from a checkout:

bash
PYTHONPATH=src python3 -m storyextractor.mcp.server --db /path/to/corpus.db

Configure in an MCP client

Claude Desktop (claude_desktop_config.json), Cline, Continue, etc. — add one stdio server. After pip install chinese-history-mcp:

json
{  "mcpServers": {    "chinese-history": {      "command": "chinese-history-mcp",      "args": ["--db", "/path/to/corpus.db"]    }  }}
Alternative: run from a checkout (no install), or with uvx
json
{  "mcpServers": {    "chinese-history": {      "command": "python3",      "args": ["-m", "storyextractor.mcp.server", "--db", "/path/to/corpus.db"],      "env": { "PYTHONPATH": "src" },      "cwd": "/absolute/path/to/chinese-history-mcp"    }  }}

Or zero-install with uv: uvx chinese-history-mcp --db /path/to/corpus.db.

Try one handshake by hand

bash
printf '%s\n' \  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{}}}' \  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \  '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"query_by_quality","arguments":{"quality":"忠","limit":2}}}' \  | chinese-history-mcp --db /path/to/corpus.db

Demo + hallucination comparison

python3 scripts/mcp_demo.py --db /path/to/corpus.db runs a scripted tour of all four tools (also a minimal MCP-client reference). See docs/MCP_DEMO.md for a side-by-side of a bare LLM (fabricated / uncitable) vs. this server (cited) on the same questions.


The corpus database

corpus.db is not in this repository (it is a ~90 MB binary). Download it from this repo's Releases and point --db at it, or set STORYEXTRACTOR_DB=/path/to/corpus.db.

The database is read-only at runtime. If you host it on a read-only medium, make sure the release artifact was produced with sqlite3 corpus.db "VACUUM INTO 'corpus_release.db'" (single file, no -wal/-shm sidecars).


Honesty (please read)

This server is designed for provenance, not to launder machine output as scholarship. Downstream clients and LLMs must not present its results as "individually human-reviewed." Every response labels what it is:

  • Events review_status='approved' — mostly machine bulk-approved credible inferences, not per-item human review.
  • Person profiles review_status='draft' — LLM-synthesized, not human-vetted.
  • Quality mappings — auto_approved = multi-LLM machine consensus, draft = pending review; evidence_quote is a real substring of the source, rationale is an LLM's reasoning.
  • Place mappings — mostly multi-LLM machine consensus (auto_approved), a few human-approved; confidence is bucketed high/medium/doubtful.
  • Text — original is public-domain 白文 with machine-generated punctuation/segmentation; vernacular translation is fully machine-generated.

The server also does not eliminate downstream hallucination: it gives you citable retrieval facts; an LLM built on top can still confabulate around them. The citations are anchors for human verification.

Scope is the 9 texts above — "not found" means "not in this corpus," not "did not happen."


Data & provenance

  • Original text: public-domain classical Chinese 白文 (unpunctuated base text from public-domain editions), with self-produced, machine-generated punctuation and segmentation (not copied from any modern annotated/collated edition).
  • Vernacular translation: machine-generated across the whole corpus.
  • Annotations (events / entities / places / qualities): machine-assisted, with human review gating on selected layers; status is reported per record.

License

  • Code (this repository): MIT — see LICENSE.
  • Corpus data (corpus.db, distributed via Releases): CC BY 4.0.

The text layer is self-produced (punctuation/segmentation) over public-domain base text, so it is distributed freely; machine-generated attributes are labeled throughout for AIGC compliance.


Design notes

  • Pure stdlib hand-written stdio JSON-RPC 2.0 (initialize / tools/list / tools/call + ping / notifications). No third-party MCP SDK.
  • Read-only DB access (src/storyextractor/mcp/db.py): mode=ro + PRAGMA query_only; the migration-running db.connect is never used at serve time.
  • Tests: python3 tests/test_mcp_server.py (read-only enforcement, protocol shapes/error codes, honest review_status, alias token-exact matching + disambiguation, LIKE-wildcard escaping) — builds a temporary fixture DB, so it runs without corpus.db.

Contributing & project meta

  • CONTRIBUTING.md — how to run tests/lint and the principles this project holds to.
  • CHANGELOG.md — release history.
  • SECURITY.md — threat surface (read-only, no network) and how to report issues.

Issues and pull requests are welcome. Please keep the constraints in mind: zero runtime dependencies, read-only, every result cited, honest review_status.

來源:README.md,提交 62833c5

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分