Open Legal Compliance MCP Server
Enables AI assistants to search and analyze legal documents from multiple jurisdictions including US federal and state law, case law, EU regulations, UK legislation, Canadian law, Congress bills, SEC filings, and FDA data through free government APIs.
README
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
git clone https://github.com/TCoder920x/open-legal-compliance-mcp.git
cd open-legal-compliance-mcp
Step 2: Install Dependencies
npm install
This will install all required packages including:
@modelcontextprotocol/sdk- MCP SDKaxios- HTTP clientcheerio- HTML parsingplaywright- Web scrapingpdf-parse- PDF parsing- And other dependencies
Step 3: Build the Project
npm run build
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:
- Visit https://www.courtlistener.com/api/
- 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:
- Visit https://api.congress.gov/
- 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:
- Visit https://www.canlii.org/en/api/
- 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:
touch .env
Add your API keys to the .env file:
GOVINFO_API_KEY=your_govinfo_key_here
COURTLISTENER_API_KEY=your_courtlistener_key_here
CONGRESS_GOV_API_KEY=your_congress_key_here
OPEN_STATES_API_KEY=your_openstates_key_here
CANLII_API_KEY=your_canlii_key_here
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 pwd -
Edit
~/.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:
npm run dev
Production Mode
-
Build the project (if not already built):
npm run build -
Start 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
legal-compliance-mcp/
āāā src/
ā āāā index.ts # Main MCP server entry point
ā āāā services/ # Service classes for each data source
ā ā āāā GovInfoService.ts
ā ā āāā CourtListenerService.ts
ā ā āāā EURexService.ts
ā ā āāā ...
ā āāā utils/
ā āāā httpClient.ts # Centralized HTTP client
āāā dist/ # Compiled JavaScript (generated)
āāā mcp/
ā āāā antigravity_config.json.example # Example MCP config
āāā .env # Your API keys (not in git)
āāā package.json
āāā tsconfig.json
āāā README.md
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
- Solution: Ensure you've set
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 installed - Solution: Check that you're using Node.js v16 or higher
- Solution: Run
MCP client connection issues
- Check: Verify the path to
dist/index.jsin your MCP config is correct - Check: 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.