加拿大建筑规范MCP
](https://pypi.org/project/building-code-mcp/)  
人工智能搜索24000多个加拿大建筑规范部分。
使人工智能助手能够在NBC、OBC、BCBC和其他13个加拿大法规中搜索、导航和引用建筑法规。
适用于Claude Desktop和任何兼容MCP的客户端(Cursor、Windsurf等)
______________________________________________________________________
为什么存在
建筑师和工程师浪费数小时搜索数千页的建筑规范。这个MCP服务器让AI完成繁重的工作:
You: "What are the fire separation requirements for a 3-storey
residential building in Saskatchewan?"
Claude: [Searches NBC 2025, finds relevant sections, extracts text]
"According to NBC 2025 Section 3.2.2.55, Group C buildings
up to 3 storeys with sprinklers require:
- Maximum area: 1,800 m²
- Floor assemblies: 45-min fire-resistance rating
- Load-bearing walls: Same rating as supported assembly"______________________________________________________________________
特性
| 特性 | 描述 |
|---|---|
| 24000+节 | NBC、OBC、BCBC、ABC、QCC+11更多代码已索引 |
| 智能搜索 | 模糊匹配、同义词、“你是说什么?”建议 |
| 令牌优化 | 与初始方法(v1.2.0)相比减少81% |
| 版权安全 | BYOD模型-仅坐标,您提供PDF |
| 司法管辖权意识 | 知道哪个代码适用于(ON→英国广播公司→BCBC) |
______________________________________________________________________
建筑
┌─────────────────────────────────────────────────────────────┐
│ MCP Client (Claude, Cursor, etc.) │
└─────────────────────────┬───────────────────────────────────┘
│ MCP Protocol
▼
┌─────────────────────────────────────────────────────────────┐
│ Building Code MCP Server │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ search_code │ │ get_section │ │ get_table │ │
│ │ (fuzzy+TF-IDF│ │ (BYOD text) │ │ (markdown) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ maps/*.json (15.9 MB) │ │
│ │ Section IDs, pages, keywords, bbox │ │
│ └─────────────────────────────────────────────────┘ │
│ │ │
│ ▼ (BYOD mode only) │
│ ┌─────────────────────────────────────────────────┐ │
│ │ User's PDF (via PyMuPDF) │ │
│ │ Text extraction at runtime │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘两种模式:
- 仅地图 (默认):返回页码和坐标。不需要PDF。
- 自带设备:通过以下方式连接您的PDF
set_pdf_path用于全文提取。
______________________________________________________________________
快速入门(1分钟)
选项1:uvx(推荐)
# Install uv (one-time)
pip install uv添加到 claude_desktop_config.json:
{
"mcpServers": {
"building-code": {
"command": "uvx",
"args": ["building-code-mcp"]
}
}
}选项2:pip
pip install building-code-mcp{
"mcpServers": {
"building-code": {
"command": "building-code-mcp"
}
}
}______________________________________________________________________
对话示例
查找需求
You: "I'm designing a 6-storey office building in Vancouver.
What are the fire separation requirements?"
Claude: Let me search the BC Building Code...
[Uses search_code("fire separation office", code="BCBC")]
[Uses get_section("3.2.2.57", code="BCBC")]
Based on BCBC 2024 Section 3.2.2.57, a 6-storey Group D
(business) building requires:
- Sprinkler system: Required
- Floor assemblies: 1-hour fire-resistance rating
- Maximum building area: 7,200 m²检查特定部分
You: "What does OBC section 9.10.14.1 say about spatial separation?"
Claude: [Uses get_section("9.10.14.1", code="OBC_Vol1")]
OBC Section 9.10.14.1 - Spatial Separation Between Buildings:
"Buildings on the same property shall have spatial separation
between them based on the aggregate area of unprotected openings
in exposing building faces..."管辖权查询
You: "Which building code applies in Calgary?"
Claude: [Uses get_applicable_code("Calgary, Alberta")]
Calgary follows the Alberta Building Code (ABC) 2023.
Primary codes: ABC, AFC (Fire), APC (Plumbing)
Also check: National codes (NBC, NFC) for reference______________________________________________________________________
支持的代码
国家规范(4)
NBC 2025、NFC 2025、NPC 2025、NECB 2025
省代码(9)
- 安大略:OBC 2024(第1卷和第2卷),OFC
- 不列颠哥伦比亚:公元前2024年
- 阿尔伯塔:ABC 2023
- 魁北克:质量控制中心、质量控制委员会、质量保证委员会、质量控制中心(2020)
用户指南(3)
IUGP9(第9部分外壳)、UGP4(结构)、UGNECB(能源)
总计:24000多个索引部分
______________________________________________________________________
令牌效率(v1.2.0)
内置优化可减少令牌使用:
| 优化 | 减少 |
|---|---|
list_codes 紧凑模式 | 81% |
disclaimer 作为资源 | 61% |
默认值 verbose=false | ~50% |
最佳实践: 使用 limit=5-10 只请求 verbose=true 必要时。
看 代币效率指南 了解详情。
______________________________________________________________________
可用工具
| 工具 | 目的 |
|---|---|
list_codes | 显示可用代码和连接状态 |
search_code | 按关键字查找部分 |
get_section | 获取章节详细信息(页面、引用、文本) |
get_table | 以markdown格式获取表格内容 |
get_hierarchy | 导航父/子部分 |
verify_section | 检查节ID是否存在 |
get_applicable_code | 查找位置代码 |
set_pdf_path | 连接PDF进行文本提取 |
______________________________________________________________________
API访问
REST API:https://canada-aec-code-mcp.onrender.com
curl https://canada-aec-code-mcp.onrender.com/search/fire+separation注:托管API在Map-Only模式下运行。使用本地MCP获取全文。
______________________________________________________________________
发展
git clone https://github.com/DavidCho1999/Canada_building_code_mcp.git
cd Canada_building_code_mcp
pip install -e ".[all]"
python src/mcp_server.py______________________________________________________________________
许可证
MIT许可证-请参阅 许可证
______________________________________________________________________
