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 分