Lex
Allows GitHub Copilot to access UK legislation data for grounding AI assistants in authoritative legal sources.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Lexfind the Data Protection Act 2018"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Lex
UK legal API for AI agents and researchers. Access comprehensive UK legislation data with semantic search and Model Context Protocol integration.
What is Lex?
Lex provides programmatic access to 8.4M+ UK legal documents - legislation, amendments, and explanatory notes - with hybrid semantic search.
This is an experimental service and should not be used as a production dependency.
Dataset Coverage
Legislation - 220K Acts and Statutory Instruments (1267-present, complete from 1963)
Amendments - 892K legislative changes and modifications
Explanatory Notes - 89K notes providing legislative context
Case Law - 70K judgments and 4.7M paragraphs (temporarily disabled pending TNA licence)
PDF Digitisation - Historical legislation (pre-1963) digitised using AI
What Can You Build?
Legal Research - Find relevant legislation in seconds
Policy Analysis - Track legislative changes over time
AI Grounding - Ground AI assistants in authoritative UK legal sources
Related MCP server: UK Legal Research MCP Server
MCP Integration
Connect AI assistants to Lex via Model Context Protocol. See the live documentation for setup instructions for:
Claude Desktop
Claude Code
Cursor
Microsoft Copilot Studio
VS Code + GitHub Copilot
Local Development
Prerequisites
Python 3.12+
Docker & Docker Compose
Azure OpenAI credentials
Quick Start
# Clone and setup
git clone https://github.com/i-dot-ai/lex.git && cd lex
cp .env.example .env # Add your Azure OpenAI keys
# Start services and load sample data
docker compose up -d
make ingest-all-sample
# Visit http://localhost:8000/docs for API documentationData Loading
# Quick samples (recommended for testing)
make ingest-legislation-sample
make ingest-all-sample
# Full datasets (production use)
make ingest-legislation-full
make ingest-all-full
# Create indexes for fast filtering
uv run python scripts/create_payload_indexes.pyDevelopment Commands
make install # Install dependencies
make test # Run tests
make run # Start API locally (without Docker)
uv run ruff format . # Format codeArchitecture
lex/
├── src/
│ ├── lex/ # Data pipeline (scraping, parsing, indexing)
│ └── backend/ # API server (FastAPI + MCP)
├── infrastructure/ # Azure Bicep templates and deploy scripts
├── scripts/ # Maintenance, migration, and export utilities
├── tests/ # Test suite
└── docs/ # DocumentationDocumentation
System Architecture - Start here for the full picture
Acknowledgements
Built with support from The National Archives and Ministry of Justice.
License
MIT - See LICENSE for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/i-dot-ai/lex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server