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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。