Skip to main content
Glama
spray272598

regs-knowledge

by spray272598

Automotive Regulation Intelligent MCP Platform (regs-mcp)

Turn domestic and international automotive regulations and standards into intelligent capabilities that are searchable, comparable, traceable, capable of Q&A with citations, and callable by enterprise systems, provided as an MCP service.

Features

  • Intelligent Regulation/Clause Processing Core: retieval, Q&A with citations, comparison (planned).

  • Mandatory provenance: every compliance conclusion must carry the standard number, clause number, and an excerpt of the original text; conclusions without provenance are automatically downgraded to unknown and flagged as requiring manual review.

  • Unified protocol: MCP 2026-07-28 + Streamable HTTP; both the Java platform and 飞书 can directly invoke it as MCP clients, with no separate adaptation required for either party.

  • Regulation comparison: comparsion of domestic and international regulations, comparison of current standards and drafts for comment, and export to editable Excel (planned).

Related MCP server: spec-assistant

Architecture

src/regs_mcp/
├── core/        领域模型与引用强制规则(不依赖 MCP/LLM/DB)
├── retrieval/   数据持久化与混合检索(SQLite + 纯 Python 打分,零外部依赖)
├── llm/         OpenAI 兼容 LLM 客户端 + 离线 mock 兜底
├── qa/          问答管线(检索→草稿→引用校验→结构化)
├── ingest/      种子数据加载
├── mcp/         MCP 适配层(regs-knowledge 智能核)
├── feishu/      飞书适配器(规划)
└── eval/        评测集 + 指标

Architecture Principles

  • Dependency Inversion (DIP): the domain/application layer only defines ports; capabilities such as retrieval, LLM, and export are injected by the infra layer as replaceable implementations. Switching between open-source components and self-developed implementations does not affect the core logic.

  • Standard protocol first: MCP 2026-07-28 + Streamable HTTP; callers need no separate adaptation.

  • Extensible: tools are split by the rule "each server ≤ 8 tools"; retrievers, models, and export formats are registered as strategies/plugins; adding data sources or export formats does not change the core.

  • Pragmatic open source: parsing (MinerU/Docling), vector databases, 飞书 SDK, etc. can all be integrated; the protocol layer depends only on the official MCP SDK, avoiding lock-in to a single product.

Running

cd vehicle-regs-mcp
python -m venv .venv && . .venv/Scripts/activate
pip install -e ".[dev]"

# 灌入种子数据
PYTHONPATH=src python -c "from regs_mcp.ingest.loader import load_seed; \
from regs_mcp.retrieval.store import RegulationStore; \
s=RegulationStore('data/regs.db'); print(load_seed(s, 'data/seed'))"

# 评测(离线可跑,无需任何 API key)
PYTHONPATH=src python -m regs_mcp.eval.run

# 测试
pytest

# 启动 MCP 服务(Streamable HTTP)
PYTHONPATH=src python -m regs_mcp.mcp.server

Integrating an LLM (Optional)

By default, it uses an offline mock (extractive synthesis) to ensure it can be demonstrated anywhere. To integrate a local or cloud LLM:

export REGS_LLM_BASE_URL=http://<endpoint>/v1
export REGS_LLM_API_KEY=<token>
export REGS_LLM_MODEL=<model>
export REGS_LLM_MOCK=0

Evaluation

20 real business questions: 100% citation coverage, 95% clause location accuracy.

Roadmap

  • M1 (Completed): regs-knowledge intelligent core (retrieval + Q&A with citations + evaluation set).

  • M2: regs-graph (reverse lookup by part/function, impact analysis) + compare (domestic vs. international comparison, current vs. draft for comment, Excel export).

  • M3: regs-jobs (parsing and ingestion) + 飞书 bot adapter (event subscription → call MCP → rich text cards).

License

MIT

Related MCP Connectors

Related MCP Servers