Skip to main content

Máy chủ MCP cho lớp nền

Tiếng Việt · English · 中文 · 日本語 · 한국어

Máy chủ này giúp trợ lý AI (Claude Desktop, Claude Code hay ứng dụng khách MCP bất kỳ) trả lời bốn câu hỏi tuân thủ của người làm sản phẩm bằng đúng dữ liệu và động cơ của repo, mỗi câu trả lời kèm mã điều khoản.

Tài liệu được viết dựa trên kinh nghiệm, nhằm giúp tham khảo khi phát triển AI tại thời điểm cập nhật. Vui lòng tham khảo thêm pháp chế, cơ quan nhà nước để có thông tin chính xác và được cập nhật mới nhất.

Cập nhật: 25/11/2026.

Đây là một máy chủ Model Context Protocol chạy qua stdio. Các công cụ của nó gọi phân loại, bộ luật áp dụng, mẫu hồ sơ, công thức chấm và kho luật của repo. Kết quả ở trạng thái de-xuat, tức là diễn giải của repo.

Bốn câu hỏi, mười công cụ

Mỗi công cụ làm một việc, và mỗi câu hỏi có đúng một nhóm công cụ trả lời, giống bảng bốn câu hỏi của repo.

Câu hỏi Công cụ Đầu vào chính Đầu ra chính Động cơ được gọi
Trước khi hỏi validate_profile profile hop_le, loi, truong_khong_ro, truong_thieu, phan_loai_se_dien framework/obligations/engine/ap_dung.py (kiem_ho_so)
1. Tôi là ai trước luật? classify profile, interpretations (PL-DG-xx) phan_loai (phạm vi ba luật, vai trò AI, mức rủi ro, hành vi cấm, vai trò dữ liệu, ly_do kèm căn cứ, khong_xac_dinh kèm câu cần hỏi), ghi_vao_ho_so, diem_dien_giai phan-loai
2. Tôi phải làm gì? list_obligations profile, interpretations (PL-DG-xx, GT-xx), groups, states tom_tat, nghia_vu chia sáu nhóm kết luận (ap_dung, khong_xac_dinh, mien, tuy_chon, chua_kich_hoat, khong_ap), mỗi mục có lý do, căn cứ, hạn, ô chưa rõ, miễn trừ; diem_dien_giai kèm mọi phương án và phương án đang dùng nghia-vu
2. get_obligation obligation_id việc, khi nào, điều kiện, miễn trừ, căn cứ, xử phạt, hạn, tần suất, bằng chứng, mẫu (kèm mã schema), đường dẫn trang cách làm, điểm diễn giải framework/obligations/rules/
3. Làm thế nào, nộp gì? get_form form_id (vắng thì trả danh sách) schema mẫu: ô, nhãn nguyên văn, kiểu, bắt buộc, căn cứ, ánh xạ từ hồ sơ mau
3. fill_form form_id, profile, answers, markdown gia_tri từng ô, thieu (ô bắt buộc còn trống, kèm nhãn), bản Markdown framework/forms/export/xuat.py
3. check_forms profile, forms dat, lỗi và cảnh báo theo từng mẫu và chéo giữa các mẫu framework/forms/checks/bo.py
4. Đã đủ chưa? score_readiness profile, statuses, default_status, interpretations, config cham (điểm nhóm, hạng, nghĩa vụ chặn, ưu tiên sửa), danh sách nghĩa vụ được chấm danh-gia
Tra luật get_article article_id, ví dụ luat-91-2025-qh15/d20/k2 nguyên văn Điều, khoản hay điểm, hiệu lực, liên kết văn bản, nghĩa vụ của repo trích dẫn nó laws/data/dieu.jsonl
Tra luật search_law query, document, limit Điều khớp, khoản khớp kèm đoạn trích laws/data/dieu.jsonl

list_obligations và score_readiness chạy đúng chuỗi của framework/golden-cases/chay.py: phân loại, ghi kết quả vào hồ sơ (phan_loai.ghi_vao_ho_so, giữ ô người dùng đã tự khai), bộ luật áp dụng, chấm. Máy chủ không chép lại quy tắc, bảng quyết định hay công thức nào: mọi kết luận do động cơ của repo tính, nên khi sửa dữ liệu ở framework/obligations/, framework/classification/, framework/readiness/, framework/forms/ thì kết quả của máy chủ đổi theo.

Phản hồi

Mọi công cụ trả về cùng một cấu trúc vỏ:

{
 "cong_cu": "classify",
 "trang_thai": "de-xuat",
 "trang_thai_mo_ta": "Diễn giải của repo, kèm căn cứ; không phải ý kiến pháp lý.",
 "cau_rao": "Tài liệu được viết dựa trên kinh nghiệm, ...",
 "ket_qua": {}
}
  • trang_thai luôn là de-xuat. Mọi mục repo diễn giải trong phản hồi (khối quy tắc, điểm diễn giải, kết quả phân loại, công thức chấm, schema mẫu) là diễn giải của repo, kèm căn cứ, không phải ý kiến pháp lý. Từng mục cũng mang trang_thai: de-xuat.
  • ap_dung khác trang_thai. Trong list_obligations, ap_dung là kết luận áp dụng của động cơ (ap-dung, khong-xac-dinh, mien, tuy-chon, chua-kich-hoat, khong-ap), còn trang_thai là trạng thái diễn giải của khối quy tắc (luôn de-xuat).
  • cau_rao là câu rào nguyên văn của repo. Câu ấy có đúng một lần trong mỗi phản hồi.
  • Lỗi đầu vào trả isError: true. Hồ sơ sai schema, mã lạ hay tham số thiếu đều trả isError: true kèm khoá loi, trong cùng cấu trúc vỏ.
  • Ô chưa biết ghi khong-ro. Kết luận phụ thuộc ô ấy ra "không xác định"; công cụ không đoán.
  • Hai khối trên giao thức mang cùng nội dung. Khối content mang bản JSON của đúng vỏ ấy và structuredContent mang chính vỏ ấy (MCP đòi khối chữ cho ứng dụng khách cũ); trợ lý đọc một trong hai.

Phương án diễn giải được chọn bằng tham số interpretations, ví dụ {"GT-01": "b-chi-la-chuyen-neu-ben-nhan-luu-giu"} cho câu hỏi gọi API AI ở nước ngoài có phải chuyển dữ liệu xuyên biên giới không (luat-91-2025-qh15/d20/k1). Mã PL-DG-xx đi vào phân loại, mã GT-xx đi vào bộ luật áp dụng, còn CD-DG-01 đi vào công thức chấm.

Cài

Máy chủ đọc dữ liệu trong repo và không gọi mạng, nên cần cài từ một bản sao của repo:

git clone https://github.com/Nhat-Nguyet/awesome-ai-compliance-vietnam
cd awesome-ai-compliance-vietnam
python3 -m venv .venv
.venv/bin/pip install -e packages/vietnam-ai-compliance-mcp

Cần Python 3.10 trở lên. Phụ thuộc duy nhất là SDK MCP chính thức cho Python (mcp>=2,<3, khai ở pyproject.toml), chỉ dùng cho lớp giao thức (server.py). Phần còn lại của repo cố ý chỉ dùng thư viện chuẩn, nên logic công cụ (core.py) cũng vậy: gọi được thẳng bằng goi(ten, tham_so) mà không cần SDK, và test của nó chạy trong scripts/check_all.py trên máy không cài gì. Repo chọn dùng SDK thay vì tự viết JSON-RPC vì giao thức còn thay đổi (bản 2 của SDK đổi cách khai máy chủ so với bản 1), và SDK theo kịp các bản giao thức mới.

Khi cài kiểu -e, máy chủ tự tìm thư mục gốc của repo. Khi cài kiểu khác, đặt biến VIETNAM_AI_COMPLIANCE_ROOT trỏ tới thư mục gốc của repo.

Cấu hình ứng dụng khách

Claude Code:

claude mcp add vietnam-ai-compliance -- /duong/dan/awesome-ai-compliance-vietnam/.venv/bin/vietnam-ai-compliance-mcp

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "vietnam-ai-compliance": {
      "command": "/duong/dan/awesome-ai-compliance-vietnam/.venv/bin/vietnam-ai-compliance-mcp",
      "env": {"VIETNAM_AI_COMPLIANCE_ROOT": "/duong/dan/awesome-ai-compliance-vietnam"}
    }
  }
}

Để chạy thử bằng tay, dùng .venv/bin/python -m vietnam_ai_compliance_mcp; máy chủ đọc JSON-RPC từ stdin và ghi ra stdout.

Ví dụ

Ví dụ dưới đây gọi thẳng logic công cụ, không cần SDK, trên ca vàng hư cấu ca01-chatbot-ban-le. Chạy từ thư mục gốc của repo:

import sys
sys.path.insert(0, "packages/vietnam-ai-compliance-mcp")
from vietnam_ai_compliance_mcp import goi
from vietnam_ai_compliance_mcp.core import ap_dung, GOC

ho_so = ap_dung.yaml_nho.doc_tep(GOC / "framework/golden-cases/ca01-chatbot-ban-le.yaml")[0]["ho_so"]
r, loi = goi("classify", {"profile": ho_so})
pl = r["ket_qua"]["phan_loai"]
print(r["trang_thai"], pl["muc_rui_ro"]["ma"], pl["vai_tro_ai"]["co"])
r, loi = goi("list_obligations", {"profile": ho_so})
print(r["ket_qua"]["tom_tat"])
r, loi = goi("score_readiness", {"profile": ho_so, "default_status": "dat", "statuses": {"XB-01": "thieu"}})
print(r["ket_qua"]["cham"]["hang"], r["ket_qua"]["cham"]["nghia_vu_chan"]["thieu"])
de-xuat trung-binh ['nha-cung-cap', 'ben-trien-khai', 'nguoi-su-dung']
{'ap_dung': 63, 'khong_xac_dinh': 0, 'mien': 0, 'tuy_chon': 0, 'chua_kich_hoat': 0, 'khong_ap': 38}
chua_san_sang ['XB-01']

Hồ sơ chuyển xuyên biên giới (XB-01, hạn 60 ngày theo luat-91-2025-qh15/d20/k2) là nghĩa vụ chặn, nên khi thiếu hồ sơ này, hạng vẫn là chưa sẵn sàng dù mọi việc khác đều đạt. Qua giao thức, trợ lý gọi cùng tên công cụ với cùng tham số, ví dụ tools/call với {"name": "get_article", "arguments": {"article_id": "luat-91-2025-qh15/d20/k2"}}.

Test

python3 -I -m unittest discover -s packages/vietnam-ai-compliance-mcp/tests
  • tests/test_core.py: chạy cả 23 ca vàng qua classify, list_obligations, score_readiness và so từng phép so với framework/golden-cases/chay.py (phải trùng, gồm trạng thái của mọi nghĩa vụ chứ không chỉ nghĩa vụ ca nhắc); thử từng công cụ còn lại: hồ sơ sai, ô khong-ro, mọi nghĩa vụ có trang cách làm, điền mẫu ví dụ ra đúng bản đã lưu ở framework/forms/examples/, bộ kiểm mẫu, tra và tìm luật; câu rào đúng một lần, mọi phản hồi mang de-xuat và không chữ nào nói nội dung đã được ai chấp thuận.
  • tests/test_server.py: khởi động máy chủ thật qua stdio, nói JSON-RPC từng dòng (initialize, tools/list, tools/call), so với kết quả của core.py. Bỏ qua khi chưa cài SDK; scripts/check_all.py in rõ dòng bỏ qua.

Giới hạn

  • Thang chấm là thang của repo, không phải thang của cơ quan nhà nước.
  • Không có công cụ ghi. Máy chủ chỉ đọc repo và không lưu hồ sơ hay trạng thái của người dùng giữa các lượt.
  • Bản dịch chỉ để tham khảo. Các bản English, 中文, 日本語, 한국어 chỉ để tham khảo; bản tiếng Việt là bản chính.

Metadata

Release files for vietnam-ai-compliance-mcp 0.1.1

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

Source distribution (sdist)

Source distribution for vietnam-ai-compliance-mcp 0.1.1
File Size Uploaded Provenance Actions
vietnam_ai_compliance_mcp-0.1.1.tar.gz 31.9 kB With provenance Details for vietnam_ai_compliance_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vietnam-ai-compliance-mcp 0.1.1
File Interpreter ABI Platform Actions
vietnam_ai_compliance_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for vietnam_ai_compliance_mcp-0.1.1-py3-none-any.whl

Total release size: 56.0 kB

Release files / vietnam_ai_compliance_mcp-0.1.1.tar.gz

Download URL vietnam_ai_compliance_mcp-0.1.1.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
20cd7b2df5554630cf4ac1c1f3ff2d44f8f34fa5e756f0e1a65c71f1483e3fc0
BLAKE2b-256 checksum
How to use checksums
3cc3e84a4c0cbe424835f50f2d26379392c86b622387de03985b96fd7a25eade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / vietnam_ai_compliance_mcp-0.1.1-py3-none-any.whl

Download URL vietnam_ai_compliance_mcp-0.1.1-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d177bb514417f5fe4778fbe2dc2f5c6556816f38f0c47490a96fcf3fea8530be
BLAKE2b-256 checksum
How to use checksums
1789dfa438285ec4a958eae49cd367eba4b70c0a81be522062910f2fa912466a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for vietnam-ai-compliance-mcp 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vietnam_ai_compliance_mcp-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

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.1.1 This release

2 release files Full 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