Skip to main content
Glama

ProjectPermit / BuildRequirements — 阶段 0

ProjectPermit 是一个用于建筑和翻新项目的、与证据关联的市政许可预检引擎。BuildRequirements 是其内部的确定性规则引擎。

阶段 0 支持:

  • gatineau_qc

  • ottawa_on

  • 8 个项目类别

  • 使用市政 GIS/地理编码器进行地址解析

  • 规则版本和叠加感知的结果

  • 每条规则结果附带的官方来源证据

  • 一个 FastAPI 端点和标准 MCP 工具

  • x402 就绪的付费传输层与规则引擎之间的分离

该引擎刻意不调用 LLM。调用代理将自然语言描述的项目范围规范化为结构化事实;BuildRequirements 应用确定性的市政规则。

快速开始

python -m venv .venv
source .venv/bin/activate
pip install -e .
uvicorn projectpermit.api:app --host 127.0.0.1 --port 8000

如需 MCP 支持:

pip install -e '.[mcp]'
projectpermit-mcp

projectpermit-mcp 使用 MCP Python SDK v2 Streamable HTTP、JSON 响应和无状态 HTTP。默认监听 127.0.0.1:8001。可通过 PROJECTPERMIT_MCP_HOST 和 PROJECTPERMIT_MCP_PORT 覆盖。

运行测试:

PYTHONPATH=src python -m unittest discover -s tests -v

Related MCP server: LCS CAD MCP

API

POST /v1/check-project-requirements

示例:

{
  "jurisdiction": "ottawa_on",
  "address": "110 Laurier Ave W, Ottawa, ON",
  "resolve_address": false,
  "project": {
    "family": "window_door",
    "action": "enlarge_existing_window",
    "structural_change": true
  }
}

结果是预检信息包,而不是市政授权、法律建议、工程认证或建筑规范设计批准。

仓库结构

  • src/projectpermit/engine.py — 确定性规则引擎

  • src/projectpermit/address.py — 市政地址/GIS 适配器

  • src/projectpermit/api.py — HTTP API

  • src/projectpermit/mcp_server.py — 标准 MCP 服务器

  • data/golden_cases.json — 确定性回归语料库

  • data/source_manifest.json — 官方来源注册表/新鲜度元数据

  • schemas/ — 公共请求/响应模式

  • docs/PHASE0_SPEC.md — 产品和工程范围

  • docs/X402_ARCHITECTURE.md — 支付/发现设计

Base Sepolia x402 冒烟测试配置

在 config/x402.base-sepolia.env.example 提供了一个仅包含公共值的测试网配置。它面向 Base Sepolia(eip155:84532)和 x402.org 测试网促进器。接收地址是公开的;切勿在此仓库中放入私钥或助记词。

set -a
source config/x402.base-sepolia.env.example
set +a
pip install -e '.[x402]'
uvicorn projectpermit.api:app --host 0.0.0.0 --port 8000

受保护的资源是 POST /v1/check-project-requirements。/health 仍可免费用于部署监控。

真实付费冒烟测试

仅在你自己的机器上运行此测试。将付款方私钥保存在本地;切勿粘贴或提交它。

python -m venv .venv-buyer
source .venv-buyer/bin/activate
pip install -e '.[buyer]'
export EVM_PRIVATE_KEY='0x...'
python scripts/x402_paid_smoke.py

付款方钱包需要有足够的 Base Sepolia USDC 来支付 $0.01 的测试费用。成功运行应返回 HTTP 200 和已解码的结算响应。服务器本身永远不需要付款方私钥。

阶段 0 安全边界

在存在不确定性的情况下,判定结果有意使用预检语言,例如 LIKELY_REQUIRED、LIKELY_NOT_REQUIRED、ADDITIONAL_REVIEW_REQUIRED 和 MUNICIPAL_CONFIRMATION_REQUIRED。引擎不应被呈现为市政当局、许可证签发机构、律师、建筑师或工程师。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Professional building code compliance assistant that interfaces with municipal building codes, helping contractors and builders navigate complex regulatory requirements with precision.
    1
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Exposes Pre-DCR and Auto-DCR building scrutiny workflows as AI-consumable tools, enabling AI assistants to open DXF drawings, validate layers, compute areas, run regulatory checks, and generate compliance reports via natural language.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables users to run deterministic rule checks against their own metrics or HTTP/CSV sources and pull back a short decision brief: only the items that crossed a threshold, each with the number that tripped it and suggested next steps. Users can also record accept/reject/edit feedback so subsequent briefs reflect their own playbook, all without API keys or a live LLM.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to retrieve verbatim U.S. mortgage regulations with citations and effective dates, verify quotes, and run guided compliance playbooks without sending user documents to the server.
    MIT