Open Legal Compliance MCP Server
A Model Context Protocol (MCP) server that provides legal compliance analysis using free/open government APIs. This server enables AI assistants to search and analyze legal documents from multiple jurisdictions including US federal law, state law, case law, EU regulations, and more.
š Quick Links:
Installation Guide - Get started in 3 steps
MCP Setup Guide - Configure with Cursor IDE or Claude Desktop
API Key Setup - Get your free API keys
Available Tools - See what this server can do
Features
US Federal Law: Search United States Code (USC) and Code of Federal Regulations (CFR) via GovInfo API
US Case Law: Search federal and state court decisions via CourtListener API
EU Regulations: Search EU regulations (GDPR, AI Act, etc.) via EUR-Lex scraping
State Law: Scrape state codes for CA, NY, and IL
Congress Bills: Search US Congress bills and legislation via Congress.gov API
Federal Register: Search daily federal government publications
SEC Filings: Access corporate financial filings via SEC EDGAR
Open States: Search legislation across all 50 US states
UK Legislation: Search United Kingdom Acts and Statutory Instruments
Canadian Law: Search Canadian case law via CanLII
FDA Data: Search drug/device adverse events and food enforcement reports
Data.gov: Discover US government open datasets
Prerequisites
Node.js (v16 or higher) - Download here
npm (comes with Node.js)
API Keys (see detailed setup instructions below)
Installation
Step 1: Clone the Repository
Step 2: Install Dependencies
This will install all required packages including:
@modelcontextprotocol/sdk- MCP SDKaxios- HTTP clientcheerio- HTML parsingplaywright- Web scrapingpdf-parse- PDF parsingAnd other dependencies
Step 3: Build the Project
This compiles TypeScript to JavaScript in the dist/ directory.
API Key Setup
The following API keys are required or optional depending on which features you want to use:
Required API Keys
1. GovInfo API Key (REQUIRED)
Why: Required for US Code and CFR searches. The server will not start without this key.
Steps to obtain:
Visit https://api.govinfo.gov/
Click "Sign Up" or "Get API Key"
Fill out the registration form (free registration)
Verify your email address
Log in and navigate to your API key dashboard
Copy your API key
Registration Link: https://api.govinfo.gov/
Optional API Keys
2. CourtListener API Key (Optional)
Why: Enables US case law searches. Without this key, case law features will be unavailable.
Steps to obtain:
Click "Register for an API Key" or "Sign Up"
Create a free account (Free Law Project)
After registration, go to your account settings
Navigate to "API" section
Generate or copy your API token
Registration Link: https://www.courtlistener.com/api/
3. Congress.gov API Key (Optional)
Why: Enables searching US Congress bills and legislation.
Steps to obtain:
Click "Get API Key" or "Sign Up"
Fill out the registration form
Verify your email
Log in and access your API key from the dashboard
Registration Link: https://api.congress.gov/
4. Open States API Key (Optional)
Why: Enables searching legislation across all 50 US states.
Steps to obtain:
Visit https://openstates.org/
Click "Get API Key" or navigate to API documentation
Sign up for a free account
Access your API key from your account dashboard
Registration Link: https://openstates.org/
5. CanLII API Key (Optional)
Why: Enables searching Canadian case law.
Steps to obtain:
Review the API documentation
Register for API access (if required)
Obtain your API key from your account
Registration Link: https://www.canlii.org/en/api/
Note: Some services like EUR-Lex, SEC EDGAR, and UK Legislation do not require API keys and work without registration.
Configuration
Option 1: Environment Variables (Recommended)
Create a .env file in the project root directory:
Add your API keys to the .env file:
Important: The .env file is already in .gitignore and will not be committed to version control.
Option 2: MCP Client Configuration (Cursor IDE / Claude Desktop)
If you're using this as an MCP server with a client like Cursor IDE or Claude Desktop, you need to configure your MCP client to point to this server.
š See the complete MCP setup guide: MCP_SETUP.md
Quick Start for Cursor IDE:
Find your absolute path:
cd /path/to/open-legal-compliance-mcp pwdEdit
~/.cursor/mcp.jsonand add:{ "mcpServers": { "open-legal-compliance-mcp": { "command": "node", "args": [ "/absolute/path/from/step1/dist/index.js" ], "env": { "GOVINFO_API_KEY": "your_actual_key_here", "COURTLISTENER_API_KEY": "your_actual_key_here", "CONGRESS_GOV_API_KEY": "your_actual_key_here", "OPEN_STATES_API_KEY": "your_actual_key_here", "CANLII_API_KEY": "your_actual_key_here" } } } }Restart Cursor IDE
For Claude Desktop and detailed troubleshooting, see MCP_SETUP.md.
Running the Server
Development Mode
For development with auto-rebuild on file changes:
Production Mode
Build the project (if not already built):
npm run buildStart the server:
npm start
The server will start and listen for MCP protocol messages via stdio.
Usage
As an MCP Server
This server is designed to work with MCP-compatible clients such as:
Claude Desktop
Cursor IDE
Other MCP-compatible applications
Configure your MCP client to use this server by pointing to the compiled dist/index.js file and providing the necessary environment variables or configuration.
Available Tools
Once connected, the following tools are available:
Federal Law
search_us_code: Search US Code by query and optional titlesearch_cfr: Search Code of Federal Regulationssearch_federal_register: Search Federal Register documentssearch_congress_bills: Search US Congress bills
Case Law
search_case_law: Search US case law via CourtListenersearch_canlii_cases: Search Canadian case law via CanLII
State Law
search_state_law: Scrape specific state codes (CA, NY, IL)search_open_states: Search legislation across all 50 states
International Law
search_eu_regulations: Search EU regulations (EUR-Lex)search_uk_legislation: Search UK legislation
Regulatory & Corporate
get_sec_filings: Get SEC filings for a companysearch_fda_events: Search FDA adverse events and enforcement reportssearch_data_gov: Search Data.gov catalog
Project Structure
Troubleshooting
Server won't start
Error: "GOVINFO_API_KEY environment variable is required"
Solution: Ensure you've set
GOVINFO_API_KEYin your.envfile or MCP config
API requests failing
Check: Verify your API keys are correct and not expired
Check: Some APIs have rate limits - wait a moment and try again
Check: Ensure you have internet connectivity
Build errors
Error: TypeScript compilation errors
Solution: Run
npm installto ensure all dependencies are installedSolution: Check that you're using Node.js v16 or higher
MCP client connection issues
Check: Verify the path to
dist/index.jsin your MCP config is correctCheck: Ensure the project has been built (
npm run build)Check: Verify all required environment variables are set in your MCP config
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
Author
TCoder920
Support
For issues, questions, or contributions, please open an issue on the GitHub repository.