Skip to main content

Python SDK, MCP server, and CLI for Australian heavy vehicle compliance — fatigue rules, mass limits, dimensions, chain of responsibility, and more.

Project description

NHVR Tools

Python SDK, MCP server, and CLI for Australian heavy vehicle compliance data.

PyPI version PyPI downloads Python CI License: MIT

pip install nhvr-tools

NHVR Tools gives you instant access to Australian heavy vehicle compliance information — fatigue rules, mass limits, dimension limits, breach categories, chain of responsibility duties, accreditation, permits, and more.

Three ways to use it:

Interface For Install
Python SDK Developers building apps pip install nhvr-tools
MCP Server AI assistants (Claude, etc.) pip install nhvr-tools[mcp]
CLI Terminal users pip install nhvr-tools[cli]

Quick Start

Install

# SDK only (minimal dependencies)
pip install nhvr-tools

# Everything (SDK + MCP server + CLI + scraper)
pip install nhvr-tools[all]

Python SDK

from nhvr_mcp import NHVR

client = NHVR()

# Fatigue rules
rules = client.fatigue_rules(scheme="standard")
print(rules["solo_driver"])

# Mass limits (with HML)
limits = client.mass_limits(include_hml=True)
print(limits["hml"]["b_double_gross"])  # "Up to 62.5 t"

# Dimension limits
dims = client.dimension_limits()
print(dims["height"])  # "4.3 m maximum ..."

# Breach categories
breaches = client.breach_categories(breach_type="mass")

# Chain of Responsibility
cor = client.cor_duties(role="operator")

# All other lookups
speed = client.speed_limits()
accred = client.accreditation(module="mass")
permits = client.permit_types(permit_type="class_1")
hml = client.hml_info()

Async Methods (Network)

import asyncio
from nhvr_mcp import NHVR

client = NHVR(api_key="your-nhvr-api-key")  # or set NHVR_API_KEY env var

# Vehicle registration lookup
rego = asyncio.run(client.search_registration("ABC123"))

# Search NHVR regulations (scrapes nhvr.gov.au)
results = asyncio.run(client.search("fatigue management"))

# Scrape a specific NHVR page
page = asyncio.run(client.scrape("https://www.nhvr.gov.au/road-access/mass-and-dimension/mass-limits"))

API Reference

NHVR(api_key=None)

Create a client. The API key is optional — only needed for vehicle registration lookups. Falls back to the NHVR_API_KEY environment variable.

Sync Methods

All sync methods return Python dicts from the built-in knowledge base. No network calls, no API key required.

Method Parameters Returns
fatigue_rules(scheme) scheme: "standard", "bfm", or "afm" Fatigue work/rest rules
mass_limits(include_hml) include_hml: bool (default False) General + optional HML limits
dimension_limits() Height, width, length limits
breach_categories(breach_type) breach_type: "mass", "dimension", "fatigue", "speed", "loading", or None for all Breach severity categories
speed_limits() Speed limits and limiter rules
cor_duties(role) role: "operator", "driver", "primary_duty", etc. or None for all Chain of Responsibility duties
accreditation(module) module: "mass", "maintenance", "fatigue", or None for all NHVAS accreditation info
permit_types(permit_type) permit_type: "class_1", "class_2", "class_3", "hml", "oversize", or None for all Access permit information
hml_info() Higher Mass Limits eligibility, limits, application

Async Methods

These methods make network requests and must be awaited.

Method Parameters Returns
search_registration(plate_number) plate_number: str Vehicle registration data from NHVR API
search(query) query: str (e.g. "fatigue", "mass", "cor") Scraped NHVR page matching the topic
scrape(url) url: str (must be nhvr.gov.au) Parsed page content (text, tables, links)

MCP Server (for AI Assistants)

Easy Setup

pip install nhvr-tools[mcp]
python setup.py

The setup wizard handles everything — installs dependencies, configures Claude Desktop, and verifies the server works.

Manual Setup

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "nhvr-tools": {
      "command": "python3",
      "args": ["/path/to/nhvr-tools/nhvr_mcp/server.py"]
    }
  }
}

Run Standalone

# stdio (default, for Claude Desktop)
python -m nhvr_mcp.server

# HTTP (for remote/web clients)
NHVR_MCP_TRANSPORT=streamable_http NHVR_MCP_PORT=8080 python -m nhvr_mcp.server

Available MCP Tools

Tool Description
nhvr_get_fatigue_rules Work/rest hour requirements by scheme
nhvr_get_mass_limits General and HML mass limits
nhvr_get_dimension_limits Vehicle height, width, length limits
nhvr_get_breach_categories Breach severity categories
nhvr_get_speed_limits Speed limits and speed limiter rules
nhvr_get_cor_duties Chain of Responsibility duties
nhvr_get_accreditation_info NHVAS accreditation modules
nhvr_get_permit_types Access permit types
nhvr_get_hml_info Higher Mass Limits info
nhvr_search_vehicle_registration Look up a vehicle by plate number
nhvr_search_regulations Search NHVR topics by keyword
nhvr_scrape_page Scrape any nhvr.gov.au page

Example Questions for Claude

  • "What are the standard fatigue rules for heavy vehicle drivers?"
  • "What are the mass limits for a B-double?"
  • "Explain chain of responsibility duties for a consignor"
  • "What are the breach categories for mass offences?"
  • "What do I need for NHVAS mass management accreditation?"

CLI

pip install nhvr-tools[cli]
nhvr fatigue rules                        # Standard fatigue rules
nhvr fatigue rules --scheme bfm           # BFM fatigue rules
nhvr mass limits                          # General mass limits
nhvr mass limits --include-hml            # Include HML
nhvr mass hml                             # HML details
nhvr dimension limits                     # Dimension limits
nhvr breach categories                    # All breach categories
nhvr breach categories --type mass        # Mass breaches only
nhvr speed                                # Speed limits
nhvr cor duties                           # All CoR duties
nhvr cor duties --role operator           # Operator duties
nhvr accreditation                        # All NHVAS modules
nhvr accreditation --module mass          # Mass management
nhvr permits                              # All permit types
nhvr permits --type class_1               # Class 1 permits
nhvr rego ABC123                          # Vehicle registration lookup
nhvr search "fatigue management"          # Search NHVR topics
nhvr scrape "https://www.nhvr.gov.au/..." # Scrape a page

# Output as JSON
nhvr --format json fatigue rules

Docker

docker build -t nhvr-tools .
docker run nhvr-tools

Development

# Clone and install with dev dependencies
git clone https://github.com/MBemera/nhvr-tools.git
cd nhvr-tools
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check .
ruff format .

Data Sources

All built-in knowledge base data is sourced from:

This is an unofficial tool. It is not affiliated with or endorsed by the NHVR. Always verify compliance information against official NHVR sources.


License

MIT

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

nhvr_tools-0.2.1.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

nhvr_tools-0.2.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file nhvr_tools-0.2.1.tar.gz.

File metadata

  • Download URL: nhvr_tools-0.2.1.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nhvr_tools-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6ea98091abd73f2f1032d5f4f003e68352e5c99fdad3785ed845fcc485905ce5
MD5 b6a63467fe1da9b7a58d30d560aef848
BLAKE2b-256 221553d5135017445ea02d67a86f59a6c68cc2ec3a5cc4af0b865684ce479eee

See more details on using hashes here.

Provenance

The following attestation bundles were made for nhvr_tools-0.2.1.tar.gz:

Publisher: publish.yml on MBemera/nhvr-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nhvr_tools-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: nhvr_tools-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nhvr_tools-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 000193adcb3c0081fc6bc5daa1429727180cba214775dfc01d56506502c52735
MD5 865f76aba0d5af174d71520edc3fb29a
BLAKE2b-256 5d5f0372ee846bf53e920f07035275b80081ef88e09818f1eff4176237ecb2cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nhvr_tools-0.2.1-py3-none-any.whl:

Publisher: publish.yml on MBemera/nhvr-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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