nz-legislation-mcp
Unofficial Model Context Protocol (MCP) server for the New Zealand Legislation API
(api.legislation.govt.nz). Search and read NZ Acts, Bills and secondary legislation
from Claude, ChatGPT/Codex, Cursor, Grok and other MCP clients, using your own API key.
Status: released. Available on npm as nz-legislation-mcp, as a Claude Desktop bundle on the
GitHub releases page, and as the container image
ghcr.io/thatskiff33/nz-legislation-mcp.
Not an official Parliamentary Counsel Office product. Always check the official
version on legislation.govt.nz before relying on it.
What it can do
| Tool | What it does |
|---|
search_legislation | Find Acts, Bills, secondary legislation and amendment papers by title, full text or filters. |
get_legislation | One work or version, including the version in force on a past date (as_at). |
list_versions | The point-in-time version history of a work. |
get_table_of_contents | Parts, subparts, sections and schedules. |
get_provision_text | The text of a section, schedule clause or schedule, from the official XML. |
compare_versions | What changed in a provision between two versions or dates. |
get_api_quota | How much of your daily API quota is left (makes no API call). |
For clients that support them, there are also:
- Resources you can attach as context:
legislation://version/{version_id}/contents,
.../section/{section} and .../schedule/{schedule} (for example
legislation://version/act_public_1976_33_en_2014-01-01/section/6A).
- Two prompts:
find_provision (find and quote the provision on a topic) and what_changed
(how legislation, or one provision, has changed since a date).
Quick start
You need Node.js 22 or later and your own Legislation API key. Request one by email to
[email protected] (see legislation.govt.nz/developer-api).
The key is personal: PCO's terms do not allow it to be shared.
-
Save your key once. Input is hidden, the key is checked with the API, and it is stored
in a file only you can read:
npx -y nz-legislation-mcp setup
If your terminal can't hide typing (for example Git Bash on Windows), setup stops
without reading the key: use PowerShell or Windows Terminal, or pipe it from a file with --key-stdin < keyfile.
-
Add the server to your AI client. For example, Claude Code:
claude mcp add --transport stdio --scope user nz-legislation -- npx -y nz-legislation-mcp
or Codex CLI:
codex mcp add nz-legislation -- npx -y nz-legislation-mcp
-
Check it works: npx -y nz-legislation-mcp doctor. It exits with code 1 if a required check
fails; a warning (for example about legislation.govt.nz) does not change the exit code.
Steps for Claude Desktop (one-click bundle), Cursor, VS Code, Gemini CLI and others are in
docs/clients.md.
Claude Code plugin
The plugin asks for your key and keeps it in your system's secure credential store, so you
can skip setup:
/plugin install nz-legislation-mcp --marketplace thatskiff33/nz-legislation-mcp
On Claude Code versions before 2.1.275, run
/plugin marketplace add thatskiff33/nz-legislation-mcp and then
/plugin install nz-legislation-mcp@nz-legislation-mcp.
Remote endpoint (ChatGPT on the web, Claude on the web, Grok)
Clients that cannot start a local program need a remote HTTPS endpoint. The server has a hardened HTTP mode that only admits you, through your own OAuth provider. See docs/self-hosting.md.
Tested clients
Checked by hand with version 1.0.1 on 7 and 8 November 2026
(results). The local clients ran on Windows 11.
- Claude Code, with the
claude mcp add command above.
- Claude Desktop, with the one-click bundle.
- The ChatGPT desktop app, running the server locally. OpenAI's documentation says it shares one configuration
(
~/.codex/config.toml) with Codex CLI, so the codex mcp add command above should also add it there. It worked in
both a normal ChatGPT chat and the Codex side of the app.
- ChatGPT on the web, through a self-hosted endpoint with Auth0 and Google sign-in
(docs/self-hosting.md).