Skip to main content

HT32 Wiki MCP Server

为 AI Agent 提供 HT32 MCU 选型与知识检索能力的 MCP Server。

功能

共 14 个工具 + 3 个资源:

  • search_knowledge(query, limit, include_datasheets) — 知识页混合检索(词法 + 向量 + 重排),片段按查询词锚定并附章节面包屑
  • search_datasheets(query, limit) — Datasheet / User Manual 章节级检索
  • get_wiki_page(path, section) — 按路径直读 wiki 页面全文或指定小节(search 命中后的下一跳)
  • get_chip_info(model) / get_model(model) — 芯片系列详情 / 型号到文档映射
  • get_peripheral_info(name) — 获取外设详情
  • compare_chips(models) — 对比多个芯片型号
  • list_chips() / list_peripherals() / list_datasheets() — 列出芯片 / 外设 / 原档清单
  • get_datasheet(series, max_length) — 获取 Datasheet / User Manual 全文
  • get_wiki_version() — 获取知识库与 MCP 版本信息
  • report_skill_version(version) — 会话开始上报本机 ht32-skills 版本,用于用量日志打标
  • submit_feedback(question, issue_type, ...) — 提交纠正反馈,帮助改进知识库

资源:wiki://overview、wiki://chips/{model}、wiki://peripherals/{name}。

使用方法

环境变量

变量 默认值 说明
WIKI_ROOT 当前目录 wiki 仓库根目录(含 entities/concepts/md)
MCP_TRANSPORT stdio stdio / streamable-http / sse
MCP_HOST 0.0.0.0 HTTP 模式监听地址
MCP_PORT 8100 HTTP 模式监听端口
MCP_PATH /mcp streamable-http 端点路径(线上 /ht32-wiki)
CACHE_DIR <WIKI_ROOT>/.work 原档索引与向量缓存目录
FEEDBACK_ROOT 空(关闭落盘) 用量 / 反馈根目录;本服务写 <FEEDBACK_ROOT>/wiki/
MCP_WARMUP 1 启动时预建原档索引

stdio 模式(本地调试)

uvx ht32-wiki-mcp

Streamable HTTP 模式

MCP_TRANSPORT=streamable-http uvx ht32-wiki-mcp

反馈机制(submit_feedback)

用户 Agent 在回答不准确、用户指出错误、或知识库信息缺失时,可调用 submit_feedback 提交纠正反馈。反馈以 JSON Lines 格式写入 <FEEDBACK_ROOT>/wiki/,按日期分文件(feedback_YYYY-MM-DD.jsonl);每次工具调用另由服务端写入 usage_YYYY-MM-DD.jsonl。

示例记录:

{"timestamp":"2026-08-10T10:00:00+00:00","question":"F52231 GPTM 最高频率?","issue_type":"wrong_spec","answer":"48MHz","correction":"72MHz,参考 UserManual 时钟章节","details":""}

System Prompt 提示词模板

部署 Open WebUI 或其他 MCP 客户端时,建议在系统提示词中加入以下内容,提升反馈触发率:

你是一个 HT32 MCU 技术专家助手,基于 HT32 Wiki 知识库回答问题。

工具使用规范:
1. 回答涉及芯片选型、外设规格、参数对比时,优先调用 search_knowledge / get_chip_info / get_peripheral_info / compare_chips 检索知识库,不要凭记忆回答。
2. 当出现以下情况时,必须调用 submit_feedback 工具提交反馈:
   - 用户明确指出你的回答有误(如"不对"、"错了"、"应该是...")
   - 你从知识库查到的数据与用户描述矛盾
   - 知识库查不到相关信息,你只能给出推测性回答
   - 用户提供了比你回答更准确的型号/规格/参数信息
3. submit_feedback 的 question 参数尽量完整抄录用户原始问题;correction 填写你认为正确的信息或用户指出的正确内容。
4. 不确定的信息要如实说明"知识库未覆盖",不要编造参数。

开发

uv sync --frozen
uv run python -m ht32_wiki_mcp

Metadata

Release files for ht32-wiki-mcp 0.8.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ht32-wiki-mcp 0.8.7
File Size Uploaded Provenance Actions
ht32_wiki_mcp-0.8.7.tar.gz 294.3 kB Without provenance Details for ht32_wiki_mcp-0.8.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ht32-wiki-mcp 0.8.7
File Interpreter ABI Platform Actions
ht32_wiki_mcp-0.8.7-py3-none-any.whl Python 3 none any Details for ht32_wiki_mcp-0.8.7-py3-none-any.whl

Total release size: 419.2 kB

Release files / ht32_wiki_mcp-0.8.7.tar.gz

Download URL ht32_wiki_mcp-0.8.7.tar.gz
Size 294.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c2a1c073b14558b8a7944e3d0e421045ae95b25d1986a1b8cd1feeb7fe7a1d54
BLAKE2b-256 checksum
How to use checksums
d4412b83c4ec4c41419c44fc8afde2f0549adcad18623542bd8b548894951420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ht32_wiki_mcp-0.8.7-py3-none-any.whl

Download URL ht32_wiki_mcp-0.8.7-py3-none-any.whl
Size 124.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19485158560b6927dddeaed42034a82eda6661814d12aa7e23d37d8a6d285b9e
BLAKE2b-256 checksum
How to use checksums
4f33e084ceb0f8825a0418b0780b534459a9f5d5a31695409ca9002af85de900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ht32-wiki-mcp 0.8.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page