Back to Browse

Zongyuan Gateway MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Routing gateway kernel MCP: exact and prefix routes, default-deny, pass ledger, bitwise replay.

About

Routing gateway kernel MCP: exact and prefix routes, default-deny, pass ledger, bitwise replay.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (1 strong, 4 medium validity signals). No known CVEs in dependencies. Imported from the Official MCP Registry.

9 files analyzed · No issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

How to Install

Install command not verified. See the repository for install instructions.

View repository

Documentation

View on GitHub

From the project's GitHub README.

zongyuan-gateway 枢纽网关

路由网关内核:路由在册、默认拒绝、通行留痕、重放可验,纯标准库。

|元枢体系 YUANSHU

定名语义

  • 道统出处:枢纽者,众辐所凑;网关者,门以限行——所向有表,所禁有门
  • 工程映射:纯标准库的路由网关内核——路由注册制,未注册路径一律拒,裁决留痕可重演

这是什么

一个纯标准库的路由网关内核:路由在册(精确路径与前缀路径分册注册,重复注册即拒);过门裁决按「精确优先于前缀、前缀最长者胜」定序,未注册路径默认拒绝,不静默放行;每次放行或拒绝都记入只追加的通行簿(路径、路由、裁决、序号);任意时刻可从通行簿重放裁决序,逐位一致——「裁决可重演」是本内核的第一契约;通行簿摘要在册,一字被改必现形。

道统映射

道统名内核对象职责
路由在册register精确与前缀分册注册,重复即拒,不静默覆盖
所向有表match精确优先于前缀,前缀最长者胜
所禁有门handle未注册路径默认拒绝,裁决一律留痕
通行留痕ledger只追加通行簿:路径、路由、裁决、序号
重放核验replay按簿重演裁决序,逐位一致
摘要digestSHA-256(canonical 通行簿),篡改现形

快速开始

from zongyuan_gateway import Gateway

gw = Gateway()
gw.register("/health", "体检门")
gw.register("/api/", "总门", prefix=True)
gw.register("/api/v2/", "二版门", prefix=True)

gw.handle("/api/v2/users")   # 放行(二版门:最长前缀胜)
gw.handle("/secret")          # 拒绝(未注册路径默认拒)

print(gw.ledger())            # 通行留痕
print(gw.replay() == gw.ledger())  # True:裁决可重演
print(gw.digest())            # 摘要:篡改现形

命令行:

python tools/zongyuan_gateway.py stats  ledger.json
python tools/zongyuan_gateway.py digest ledger.json
python tools/zongyuan_gateway.py replay ledger.json

MCP 门面

内核已拧成 MCP 服务器(stdio,FastMCP,八工具):register_route/match_route/handle_path/ledger_view/replay_ledger/digest/stats/describe。进程内持有网关正本,通行簿随进程累积。

pip install "mcp>=1.0"   # 仅门面需要,内核保持纯标准库
python run_mcp_server.py

注册配置(server.json:io.github.tanbopiao/zongyuan-gateway,v0.2.0)。

设计约定

  • 纯标准库(json/hashlib),无第三方依赖,无网络服务。
  • 路由注册制:路径须以 / 开头,重复注册(含跨册同路径)一律 GatewayError,不静默覆盖。
  • 路径合制:非字符串路径在匹配与过门入口一律拒以 GatewayError,不撞裸异常。
  • 默认拒绝:未注册路径不猜测、不放行,裁决与拒绝理由同簿留痕。
  • 摘要基于通行簿原字节序:任何一字被改,重放摘要必不一致——「篡改现形」是本内核的第一契约。
  • 防篡改前提(统一声明):本链可发现局部或单点篡改;持有全量记录的攻击者可整体重写并重算通过——链头哈希需带外留存(或对链头签名)方可对抗整体重写。

回归

regression.md 登记回归铁律(路由、匹配、拒绝、日志、摘要五域契约)。运行:

python3 -m unittest discover -s . -p "test_*.py"

许可证

Dual-licensed: AGPL-3.0 (default) or a commercial license for closed-source use — see DUAL-LICENSE.md。仓库:https://github.com/tanbopiao/zongyuan-gateway

Reviews

No reviews yet

Be the first to review this server!