# UK Legislation MCP

> UK Legislation MCP Server connects your AI agent directly to the official UK law database. Search, retrieve, and analyze Acts, Statutory Instruments, and specific sections of British law in real-time. Need to verify a rule or track legislative changes? This server gives you direct access to primary legal sources from the UK Parliament.

## Overview
- **Category:** knowledge-management
- **Price:** Free
- **Tags:** law, public-records, regulatory-data, parliamentary-acts, search-engine

## Description

Your AI agent connects directly to the official UK legal database using this **UK Legislation MCP Server**. You'll find real-time access to Acts, Statutory Instruments, and specific British law sections straight from the Parliament. When you need to verify a rule or track legislative changes, your agent pulls primary source data instantly.

### Searching for Law

To start looking through the massive body of UK law, you've got two main search paths. If you know what subject matter you're dealing with—say, environmental regulations or banking rules—you use **`search_by_subject`**. This tool searches across multiple Acts and Instruments using broad keywords related to that topic, giving you a pool of relevant laws. If your criteria are more general (like searching by title or a specific year), you run **`search_legislation`**; it returns a list of matching acts, instruments, or legislative documents based on those general search terms.

### Deep Structural Analysis and Retrieval

Once you've got a promising act from the searches, you need to understand its structure. You can use **`get_table_of_contents`** to generate a complete, hierarchical map of chapters and sections for that specific Act. This shows you exactly how the law is organized—it’s crucial for knowing your scope. If you're looking at a detailed section of text, you don't have to wade through pages; **`get_section`** pulls the full, verbatim text for one defined section within any law immediately. You also use **`get_schedule`** when an Act references specific supplementary content attached to it; this tool retrieves that precise schedule material.

### Time-Based and Targeted Retrieval

For tracking changes or finding foundational laws, you've got time-stamped tools. If you want to see every major law passed during a specific calendar year, you run **`get_legislation_by_year`**, which lists all Acts and instruments enacted in that chosen year. To stay ahead of the curve and know what just dropped, you use **`get_recent_legislation`**; this pulls up the full details for legislative documents published most recently by the government. If you're targeting one specific piece of legislation by its known name, **`get_legislation`** retrieves all the core details about that named Act or Instrument.

### Putting It All Together

You don’t just search; you analyze. You can combine these tools to build a complete legal picture for your agent. You'll use **`search_by_subject`** to narrow down general topics, then run **`get_table_of_contents`** on the results to map out their internal scope, and finally pull specific details using **`get_section`** or **`get_schedule`**. This whole process gives your AI client direct, reliable access that beats searching through dusty PDFs. You're getting primary legal sources directly from the UK Parliament into your workflow.

## Tools

### get_legislation_by_year
Lists all Acts and instruments that were enacted during a specified calendar year.

### get_table_of_contents
Generates and returns a hierarchical map of all chapters and sections for a given act.

### get_legislation
Retrieves specific details about a named piece of UK legislation.

### get_recent_legislation
Pulls the full details of legislative documents published most recently by the government.

### get_schedule
Retrieves the content of a specific schedule attached to an act or instrument.

### get_section
Pulls the full, verbatim text for one defined section within any law.

### search_by_subject
Searches the entire database for laws that pertain to a defined subject area or keyword group.

### search_legislation
Returns a list of matching acts, statutory instruments, and legislative documents based on general search criteria.

## Prompt Examples

**Prompt:** 
```
Search for the 'Data Protection Act 2018' in UK legislation.
```

**Response:** 
```
I've searched the database and found the 'Data Protection Act 2018' (ukpga/2018/12). I can retrieve its full table of contents or specific sections for you. Which part would you like to examine?
```

**Prompt:** 
```
List all Public General Acts enacted in 2024.
```

**Response:** 
```
Retrieving the list for 2024... I found several acts including the 'Finance Act 2024'. Would you like me to get the details or table of contents for any of these?
```

**Prompt:** 
```
What is Section 1 of the Human Rights Act 1998?
```

**Response:** 
```
Fetching Section 1... This section defines 'The Convention rights' and lists the specific articles of the European Convention on Human Rights that are given effect in the UK. Would you like me to list those articles?
```

## Capabilities

### Search by subject matter
The agent searches across multiple acts and instruments using broad keywords related to a topic.

### Find specific sections of law
You pinpoint an exact section within a piece of legislation, retrieving its full text immediately.

### Retrieve annual acts
The agent lists all major acts and instruments passed during a specified calendar year.

### Get the latest laws
You pull up a list of legislative documents that were most recently published, ensuring you see new rules fast.

### Map legal structure
The agent fetches the complete table of contents for an act, showing its full hierarchy and scope.

## Use Cases

### Updating internal policy after a regulatory change
A compliance officer sees a news alert about new regulations. Instead of reading multiple government circulars, they prompt their agent: 'Show me all recent changes regarding financial reporting.' The agent uses `get_recent_legislation` and filters the results, immediately giving them the necessary text to update company policy.

### Drafting a legal memo requiring historical context
A lawyer needs to reference how data protection rules changed after 2015. They use `get_legislation_by_year` for that period, then combine it with `search_by_subject` (e.g., 'data retention') to pull all relevant acts and sections for their memo.

### Mapping the structure of a massive act
A student is studying constitutional law and needs to know how an Act is organized. They use `get_table_of_contents` on the main act, which provides the full, chapter-by-chapter breakdown, allowing them to understand the document's hierarchy without reading everything.

### Verifying a specific legal clause for a client
A user needs to confirm exactly what 'The Convention rights' are under UK law. They use `get_section` on the Human Rights Act 1998, which immediately pulls the definitive text of that section, ensuring zero ambiguity.

## Benefits

- Verify legal compliance instantly. Instead of manually checking government sites, use `get_recent_legislation` to pull the text of new statutory instruments and confirm if they affect your operations.
- Build a chronological legal history. Use `get_legislation_by_year` to list all acts passed in 1998 or 2004, letting you trace how specific laws have evolved over decades.
- Understand the full scope of an Act. Calling `get_table_of_contents` shows you the entire structure of a complex law, preventing you from missing a critical chapter buried deep inside.
- Target precise data points. If you need to quote a rule, use `get_section`. It pulls only that specific section's text, cutting out pages of irrelevant legal boilerplate.
- Find laws by theme. Don't know the exact name of the law? Use `search_by_subject` to find all relevant legislation related to 'data privacy,' even if the acts are from different years.

## How It Works

The bottom line is that your AI client handles the complex query flow—you just ask what law you need.

1. First, subscribe to the UK Legislation server. No API key is needed; access is public.
2. Next, instruct your AI client (Claude, Cursor, etc.) using natural language. For example: 'What is Section 5 of the Data Protection Act?'
3. The agent selects and executes the appropriate tool (like `get_section`), pulls the raw data from the official source, and delivers the specific text back to you.

## Frequently Asked Questions

**How do I find all laws related to finance from a specific year using get_legislation_by_year?**
You must first call `get_legislation_by_year` with the target year (e.g., 2024). Then, use `search_by_subject` on the resulting list of acts to filter for 'finance' or 'taxation' laws.

**Is search_legislation better than get_section when I just need a general overview?**
No. `search_legislation` gives you a list of documents, which is too vague. If you want to see the actual text and structure of one document, use `get_table_of_contents` first, then drill down with `get_section`.

**What do I use if I need to know what laws were published last week?**
You run the `get_recent_legislation` tool. This pulls the most recently published documents and gives you a list of acts, instruments, or amendments that are active now.

**Can I find all regulations concerning data privacy using search_by_subject?**
Yes, this is the right tool. `search_by_subject` lets you input a high-level topic like 'data privacy' and retrieves every law across different years that touches on it.

**How does using `get_table_of_contents` help me understand a complex Act's structure?**
It provides the full document hierarchy. This returns all chapters, parts, and sections within an Act, letting you map out the entire legal framework before diving into specifics.

**When should I use `get_schedule` instead of retrieving a main section using `get_section`?**
Use `get_schedule` when the law contains supporting documents or detailed lists that aren't part of the narrative text. It isolates these structured appendix items for clean extraction.

**What is the best sequence to use `search_legislation` and then look up details?**
First, run `search_legislation` to narrow results down to the specific Act or instrument you need. Then, pass that identifier directly into `get_table_of_contents` or `get_legislation`. This minimizes calls.

**If I know an Act's name and year, how do I use `get_legislation` efficiently?**
You pass the specific identifier to get all core details in one go. This single call retrieves both the metadata and the main text, bypassing the need for multiple lookup steps.

**Can I find the 'Human Rights Act 1998' and read its sections?**
Yes! Use the `search_legislation` tool with the title 'Human Rights' and year '1998'. Once you have the type (ukpga) and number (42), you can use `get_section` to read specific parts of the act.

**How do I see all legislation enacted in 2023?**
Use the `get_legislation_by_year` tool and specify the `year` as '2023' and the `type` (e.g., 'ukpga' for Public General Acts). It will list all documents registered for that year.

**Does this server provide recently published laws?**
Yes, you can use the `get_recent_legislation` tool to fetch a list of the most recently enacted and published legislative documents in the UK.