npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

legislation-gov-uk-mcp

v1.0.2

Published

MCP server for the legislation.gov.uk API — search, retrieve, and summarise UK legislation with jurisdiction, status, and amendment tracking

Readme

legislation-gov-uk-mcp

An MCP server that wraps the legislation.gov.uk API, letting AI agents search, retrieve, and summarise UK legislation. It tracks jurisdiction, enforcement status, and amendment history, and always links back to the original source.

[!WARNING] Community Project, Not Official This is an independent, community-maintained project. It is not affiliated with, endorsed by, or officially supported by the UK Government, The National Archives, or legislation.gov.uk. It uses the publicly available legislation.gov.uk API under their reuse licence. Always verify information against the official legislation.gov.uk website.

Features

  • 13 tools across 6 resource areas: search, legislation content, changes/effects, metadata, publication log, and SPARQL
  • Labels every result with its jurisdiction (UK, England, Wales, Scotland, Northern Ireland)
  • Shows whether legislation is In Force, Repealed, Not Yet In Force, Revoked, or Partially In Force
  • Tracks amendments, repeals, and commencements with their application status
  • Supports point-in-time retrieval so you can see what the law said on any given date
  • Every response includes the legislation.gov.uk URL so users can check the original
  • Generates proper legal citations (e.g. "Equality Act 2010 (c.15)")
  • Passes instructions to AI agents on connection so they cite and reference correctly
  • No API key needed. Just install and go.

Installation

npm install -g legislation-gov-uk-mcp

Claude Desktop Quick Start

Add the legislation-gov-uk entry to the mcpServers object in your Claude Desktop config file. If you already have other servers configured, add it alongside them. Don't replace what's already there:

{
  "mcpServers": {
    "your-existing-server": {
      "...": "keep your existing servers here"
    },
    "legislation-gov-uk": {
      "command": "npx",
      "args": ["-y", "legislation-gov-uk-mcp"]
    }
  },
  "preferences": {
    "...": "keep your existing preferences here"
  }
}

Auto-approve tools

If you'd like to skip confirmation prompts for the read-only tools, add an autoApprove array:

{
  "mcpServers": {
    "your-existing-server": {
      "...": "keep your existing servers here"
    },
    "legislation-gov-uk": {
      "command": "npx",
      "args": ["-y", "legislation-gov-uk-mcp"],
      "autoApprove": [
        "leg_search",
        "leg_search_advanced",
        "leg_search_new",
        "leg_get",
        "leg_get_section",
        "leg_get_version",
        "leg_get_contents",
        "leg_changes_affecting",
        "leg_changes_by",
        "leg_status",
        "leg_types",
        "leg_updates",
        "leg_sparql"
      ]
    }
  },
  "preferences": {
    "...": "keep your existing preferences here"
  }
}

Config file locations

| Platform | Path | |----------|------| | macOS | ~/Library/Application Support/Claude/claude_desktop_config.json | | Windows | %APPDATA%\Claude\claude_desktop_config.json | | Linux | ~/.config/Claude/claude_desktop_config.json |

Tools

Search (3 tools)

| Tool | Description | |------|-------------| | leg_search | Search legislation by title or text content, with type, year, and jurisdiction filters | | leg_search_advanced | Full search with boolean operators, year/number ranges, extent matching, and sort options | | leg_search_new | Get newly published or recently updated legislation |

Legislation Content (4 tools)

| Tool | Description | |------|-------------| | leg_get | Fetch a legislation item by type/year/number, including metadata and table of contents | | leg_get_section | Fetch a specific section or part with its content text | | leg_get_version | Fetch legislation as it stood on a given date (point-in-time) | | leg_get_contents | Fetch the table of contents structure for a piece of legislation |

Changes & Effects (2 tools)

| Tool | Description | |------|-------------| | leg_changes_affecting | List amendments, repeals, and commencements that affect a piece of legislation | | leg_changes_by | List changes that a piece of legislation makes to other legislation |

Metadata (2 tools)

| Tool | Description | |------|-------------| | leg_status | Check status (in force, repealed, etc.), pending amendments, jurisdiction, and extent | | leg_types | List all legislation type codes with descriptions and jurisdictions |

Publication Log (1 tool)

| Tool | Description | |------|-------------| | leg_updates | Get recent publications and updates from the legislation.gov.uk publication log |

SPARQL (1 tool)

| Tool | Description | |------|-------------| | leg_sparql | Run SPARQL queries against the legislation.gov.uk linked data endpoint |

Legislation Type Codes

| Code | Description | Jurisdiction | |------|-------------|-------------| | ukpga | UK Public General Acts | UK | | uksi | UK Statutory Instruments | UK | | asp | Acts of the Scottish Parliament | Scotland | | ssi | Scottish Statutory Instruments | Scotland | | asc | Acts of Senedd Cymru | Wales | | anaw | Acts of the National Assembly for Wales | Wales | | wsi | Welsh Statutory Instruments | Wales | | nia | Northern Ireland Assembly Acts | Northern Ireland | | nisr | Northern Ireland Statutory Rules | Northern Ireland |

Run leg_types for the full list.

Rate Limits

The legislation.gov.uk API allows 3,000 requests per 5 minutes per IP address. No API key is needed. The server sends a User-Agent header as required by the API.

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint
npm run lint

# Start the server
npm start

License

MIT