Canadian Building Code MCP
AI-powered search for 24,000+ Canadian building code sections.
Enable AI assistants to search, navigate, and cite building regulations across NBC, OBC, BCBC, and 13 other Canadian codes.
Works with Claude Desktop and any MCP-compatible client (Cursor, Windsurf, etc.)
Why This Exists
Architects and engineers waste hours searching through thousands of pages of building codes. This MCP server lets AI do the heavy lifting:
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"
Features
| Feature | Description |
|---|---|
| 24,000+ Sections | NBC, OBC, BCBC, ABC, QCC + 11 more codes indexed |
| Smart Search | Fuzzy matching, synonyms, "Did you mean?" suggestions |
| Token Optimized | 81% reduction vs naive approach (v1.2.0) |
| Copyright Safe | BYOD model - coordinates only, you provide the PDF |
| Jurisdiction Aware | Knows which code applies where (ON→OBC, BC→BCBC) |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ 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 │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Two Modes:
- Map-Only (default): Returns page numbers & coordinates. No PDF needed.
- BYOD: Connect your PDF via
set_pdf_pathfor full text extraction.
Quick Start (1 minute)
Option 1: Smithery (Recommended)
npx -y @smithery/cli@latest install davidcho/ca-building-code-mcp --client claude
Option 2: uvx
# Install uv (one-time)
pip install uv
Add to claude_desktop_config.json:
{
"mcpServers": {
"building-code": {
"command": "uvx",
"args": ["building-code-mcp"]
}
}
}
Option 3: pip
pip install building-code-mcp
{
"mcpServers": {
"building-code": {
"command": "building-code-mcp"
}
}
}
Example Conversations
Finding Requirements
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²
Checking Specific Sections
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..."
Jurisdiction Lookup
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
Supported Codes
National Codes (4)
NBC 2025, NFC 2025, NPC 2025, NECB 2025
Provincial Codes (9)
- Ontario: OBC 2024 (Vol 1 & 2), OFC
- British Columbia: BCBC 2024
- Alberta: ABC 2023
- Quebec: QCC, QECB, QPC, QSC (2020)
User's Guides (3)
IUGP9 (Part 9 Housing), UGP4 (Structural), UGNECB (Energy)
Total: 24,000+ indexed sections
Token Efficiency (v1.2.0)
Built-in optimizations reduce token usage:
| Optimization | Reduction |
|---|---|
list_codes compact mode |
81% |
disclaimer as resource |
61% |
Default verbose=false |
~50% |
Best practice: Use limit=5-10 and only request verbose=true when needed.
See Token Efficiency Guide for details.
Tools Available
| Tool | Purpose |
|---|---|
list_codes |
Show available codes and connection status |
search_code |
Find sections by keywords |
get_section |
Get section details (page, citation, text) |
get_table |
Get table content as markdown |
get_hierarchy |
Navigate parent/child sections |
verify_section |
Check if section ID exists |
get_applicable_code |
Find codes for a location |
set_pdf_path |
Connect PDF for text extraction |
API Access
REST API: https://canada-aec-code-mcp.onrender.com
curl https://canada-aec-code-mcp.onrender.com/search/fire+separation
Note: Hosted API runs in Map-Only mode. Use local MCP for full text.
Development
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
License
MIT License - See LICENSE
Links
Metadata
Release files for building-code-mcp 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| building_code_mcp-1.3.2.tar.gz | 2.1 MB | Without provenance | Details for building_code_mcp-1.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| building_code_mcp-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for building_code_mcp-1.3.2-py3-none-any.whl |
Total release size: 4.2 MB
Release files / building_code_mcp-1.3.2.tar.gz
| Download URL | building_code_mcp-1.3.2.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df8c7bee9f19e59149b03ac8e15795d3b14c4cc2d4c1c3bc98348b5430227c25
|
|
BLAKE2b-256 checksum How to use checksums |
30b4e8919ebffd92f866cce330ec1e1632c9c046051920b0a89498d28cf51352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / building_code_mcp-1.3.2-py3-none-any.whl
| Download URL | building_code_mcp-1.3.2-py3-none-any.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e85cb0aed459ed30085f436444b50185edb9aecb574f0208c0463fe202c14181
|
|
BLAKE2b-256 checksum How to use checksums |
c052fbb8176a1d528e270a3de985c34c575cdc31ed82f3f1f91949f6cbdc1952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for building-code-mcp 1.3.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.