Skip to main content

MCP server for searching Canadian Building Codes (NBC, OBC, BCBC, etc.)

Project description

Canadian Building Code MCP Server

PyPI version License: MIT

A Model Context Protocol (MCP) server that enables Claude to search and navigate Canadian building codes.

How It Works

This MCP server operates in two modes:

Mode Use Case PDF Required Text Extraction
Map-Only Hosted API, Quick lookup No Page numbers & coordinates only
BYOD Local MCP with full text Yes (your own) Full section text

Map-Only Mode (Default)

  • Returns page numbers, section IDs, and coordinates
  • Works everywhere (local, Vercel, Render, etc.)
  • No PDF needed - just the indexed maps

BYOD Mode (Bring Your Own Document)

  • Connect YOUR legally obtained PDF using set_pdf_path
  • Get full text extraction from sections
  • Local MCP only - not available in hosted API

Note: The hosted API at canada-aec-code-mcp.onrender.com runs in Map-Only mode. For full text extraction, run the MCP server locally and connect your own PDFs.


Quick Setup

Option A: Smithery (One-click install)

npx -y @smithery/cli@latest install davidcho/ca-building-code-mcp --client claude

Option B: uvx (Auto-updates, recommended)

Prerequisites: Install uv first (one-time setup):

# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or via pip
pip install uv

Then add to Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on Mac):

{
  "mcpServers": {
    "building-code": {
      "command": "uvx",
      "args": ["building-code-mcp"]
    }
  }
}

Benefits: Automatically checks for updates on each run - always get the latest version!

Option C: pip install (Manual updates)

pip install building-code-mcp
{
  "mcpServers": {
    "building-code": {
      "command": "building-code-mcp"
    }
  }
}

To update: Run pip install --upgrade building-code-mcp


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 22,500+ indexed sections across 16 Canadian building codes and guides.

Supported Codes

Building Codes (13)

Code Version Sections Description
NBC 2025 2,700+ National Building Code
NFC 2025 1,000+ National Fire Code
NPC 2025 400+ National Plumbing Code
NECB 2025 450+ National Energy Code for Buildings
OBC 2024 4,100+ Ontario Building Code (Vol 1 & 2)
OFC O. Reg. 213/07 1,900+ Ontario Fire Code
BCBC 2024 2,500+ British Columbia Building Code
ABC 2023 2,800+ Alberta Building Code
QCC 2020 2,700+ Quebec Construction Code
QECB 2020 380+ Quebec Energy Code
QPC 2020 420+ Quebec Plumbing Code
QSC 2020 1,000+ Quebec Safety Code

User's Guides (3)

Guide Version Sections Description
IUGP9 2020 1,000+ Illustrated Guide - Part 9 Housing
UGP4 2020 490+ User's Guide - NBC Structural Commentaries
UGNECB 2020 160+ User's Guide - NECB

💡 Best Practices (Token Efficiency)

New in v1.1.1: Reduce token usage by up to 97% with these best practices.

For Claude Desktop Users

Copy the optimization rules to your ~/.claude/CLAUDE.md file:

Key Principles:

  • 3-Strike Rule: Maximum 3 searches per topic
  • Plan before searching: Know what you're looking for
  • Use default parameters: limit=10, verbose=false (already optimized)
  • Token budget: Simple questions: 100-300 tokens, Complex: 500-1000 tokens

Example Improvement

Before: 29 searches, 5,100 tokens → "Balcony dimensions not in OBC"

After: 3 searches, 150 tokens → Same conclusion, 97% fewer tokens

See full guide: Token Efficiency Documentation


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"
"Which building code applies in Toronto?"
"List all available building codes"

API Access

REST API available at: https://canada-aec-code-mcp.onrender.com

GET /codes              - List all codes
GET /search/{query}     - Search sections
GET /section/{id}       - Get section details

Hosted API Limitation: The hosted API runs in Map-Only mode. set_pdf_path is not available - use local MCP for full text extraction.

License

MIT License - See LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

building_code_mcp-1.2.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

building_code_mcp-1.2.0-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file building_code_mcp-1.2.0.tar.gz.

File metadata

  • Download URL: building_code_mcp-1.2.0.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for building_code_mcp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c642bf8b91e78971af62823b6962a2cb02cd040bcdaaa771c9f7295a6321ec84
MD5 0e6b0bb1f9064fcf75290feaf9542e9d
BLAKE2b-256 ec2cd2c293871571533583a5f6caeb47d700fd689f7703ef20919cb6c8c1479c

See more details on using hashes here.

File details

Details for the file building_code_mcp-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for building_code_mcp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9e3ee5dbad11c6f1c7f0d4f06619af4b8c7998b122626d53899077437b5f9d
MD5 240e179155828a01ad3858d58dcc1bbe
BLAKE2b-256 aa39ef1949da6c871f58f1fb213f031f9632213a605f8e656b440921e01ac074

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page