MCP server for searching Canadian Building Codes (NBC, OBC, BCBC, etc.)
Project description
Canadian Building Code MCP Server
A Model Context Protocol (MCP) server that enables Claude to search and navigate Canadian building codes.
What It Does
Ask Claude questions like:
- "Find fire separation requirements for garages in NBC"
- "What are the stair width requirements in OBC?"
- "Show me section 9.10.14 of the Building Code"
Claude will search 20,000+ indexed sections across 13 Canadian building codes and return relevant sections with page numbers.
Supported Codes
| Code | Version | Sections | Description |
|---|---|---|---|
| NBC | 2025 | 2,783 | National Building Code |
| NFC | 2025 | 1,044 | National Fire Code |
| NPC | 2025 | 413 | National Plumbing Code |
| NECB | 2025 | 475 | National Energy Code for Buildings |
| OBC | 2024 | 4,108 | Ontario Building Code (Vol 1 & 2) |
| BCBC | 2024 | 2,584 | British Columbia Building Code |
| ABC | 2023 | 2,832 | Alberta Building Code |
| QCC | 2020 | 2,726 | Quebec Construction Code |
| QECB | 2020 | 384 | Quebec Energy Code |
| QPC | 2020 | 428 | Quebec Plumbing Code |
| QSC | 2020 | 1,063 | Quebec Safety Code (Fire) |
| OFC | O. Reg. 213/07 | 1,906 | Ontario Fire Code |
Installation
Option A: pip install (Recommended)
# Basic installation
pip install git+https://github.com/DavidCho1999/Canada-AEC-Code-MCP.git
# With PDF text extraction support
pip install "git+https://github.com/DavidCho1999/Canada-AEC-Code-MCP.git#egg=building-code-mcp[pdf]"
Option B: Clone and install
git clone https://github.com/DavidCho1999/Canada-AEC-Code-MCP.git
cd Canada-AEC-Code-MCP
pip install -e . # Basic
pip install -e ".[pdf]" # With PDF support
Configure Claude Desktop
Find your Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - Mac:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this to the config file:
{
"mcpServers": {
"building-code": {
"command": "building-code-mcp"
}
}
}
Or if using the cloned repository:
{
"mcpServers": {
"building-code": {
"command": "python",
"args": ["C:/full/path/to/Canada-AEC-Code-MCP/src/mcp_server.py"]
}
}
}
Restart Claude Desktop
Close and reopen Claude Desktop. You should see "building-code" in the MCP tools.
Usage Examples
Once installed, just ask Claude naturally:
"Search for egress requirements in NBC"
"What does section 3.2.4.1 say in OBC?"
"Find fire resistance ratings for walls"
"List all available building codes"
Available Tools
| Tool | Description |
|---|---|
list_codes |
List all available codes and section counts |
search_code |
Search by keywords (e.g., "fire separation") |
get_section |
Get specific section by ID (e.g., "9.10.14.1") |
get_hierarchy |
Get parent, children, siblings of a section |
set_pdf_path |
Connect your PDF for full text extraction (BYOD) |
How It Works
Mode A: Map Only (Default)
Returns section metadata: ID, title, page number, keywords. Works without any PDF files.
Mode B: BYOD (Bring Your Own Document)
Connect your legally obtained PDF to get full text:
"Connect my NBC PDF at C:/codes/NBC2025.pdf"
The server extracts text from the exact page and coordinates.
Project Structure
Canada-AEC-Code-MCP/
├── maps/ # 12 code index files (JSON)
├── src/
│ └── mcp_server.py # MCP server
├── scripts/
│ └── generate_map_v2.py # Map generation tool
└── README.md
For Developers
Adding New Codes
- Convert PDF with Docling:
pip install docling
python scripts/convert_with_docling.py path/to/code.pdf
- Generate map:
python scripts/generate_map_v2.py docling_output/code_name/
Disclaimer
This is a structural index for Canadian Building Codes. No copyrighted text is distributed. This is not an official NRC or government product.
Building codes are published by the National Research Council of Canada (NRC) and provincial authorities. Please obtain official copies through proper channels.
Running Tests
# Install test dependencies
pip install pytest
# Run smoke tests
pytest tests/test_smoke.py -v
Troubleshooting
"MCP server not showing in Claude Desktop"
- Check the path in config is absolute (not relative)
- Make sure Python is in your PATH
- Restart Claude Desktop completely
"No results found"
- Try simpler search terms (e.g., "fire" instead of "fire separation requirements")
- Check if the code exists: ask Claude "list available codes"
"PDF text extraction not working"
- Ensure the PDF path is correct and file exists
- The PDF version must match the map version (e.g., NBC 2025 map needs NBC 2025 PDF)
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Run tests:
pytest tests/test_smoke.py -v - Submit a pull request
Changelog
v1.0.0 (2026-01)
- Initial release with 12 Canadian building codes
- 18,000+ indexed sections
- BYOD mode for full text extraction
License
MIT License - See LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file building_code_mcp-1.0.0.tar.gz.
File metadata
- Download URL: building_code_mcp-1.0.0.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd100768976a56189471f0e04eeb02647ab18f026b47c12cf3799c628f598bd4
|
|
| MD5 |
c55178959ed66cc1f596c8699e8ba638
|
|
| BLAKE2b-256 |
080003ccd6b461ccc2f34a0bb3f330abeca8253e46e64b46590aa02b5fbac6d9
|
File details
Details for the file building_code_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: building_code_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d60985696a34798d84cfe46f0e2d33c85d088f816fef6b25898396d79e071df
|
|
| MD5 |
9c7f7e21bcf0ef3b0cf12057750778a8
|
|
| BLAKE2b-256 |
02852a46060d4449cbf905613cd766490d96e2985c59d7aa0f55b9ed3bae0ab0
|