Skip to content

beshkenadze/us-legal-tools

Repository files navigation

Federal Legal APIs Monorepo

A comprehensive TypeScript monorepo containing SDKs and Model Context Protocol (MCP) servers for major U.S. federal legal and regulatory APIs.

CI Release License: MIT

πŸ“¦ Packages

This monorepo contains five powerful SDKs for accessing federal legal and government information:

npm version

Electronic Code of Federal Regulations (eCFR) SDK

Access the complete, continuously updated digital version of the Code of Federal Regulations (CFR).

  • πŸ“– API Coverage: Full text of all 50 CFR titles
  • πŸ” Search: Advanced search across all federal regulations
  • πŸ“… Versioning: Access historical versions and track changes
  • πŸ—οΈ Structure: Navigate hierarchical regulation structure
  • πŸ€– MCP Server: eCFRSDKServer for AI integration

npm version

Federal Register SDK

Access the daily journal of the United States government, including all proposed and final rules, notices, and presidential documents.

  • πŸ“„ Documents: Search all documents published since 1994
  • πŸ›οΈ Agencies: Comprehensive agency information
  • πŸ“‹ Public Inspection: Access documents before publication
  • πŸ–ΌοΈ Images: Document images and metadata
  • πŸ€– MCP Server: FederalRegisterServer for AI integration

npm version

CourtListener SDK

Access the largest free legal database, containing millions of legal opinions, oral arguments, judges, and more.

  • βš–οΈ Case Law: Millions of legal opinions from federal and state courts
  • πŸ‘¨β€βš–οΈ Judges: Comprehensive judge profiles and biographical data
  • πŸŽ™οΈ Oral Arguments: Audio recordings and metadata
  • πŸ“š Citations: Advanced citation lookup and normalization
  • πŸ’Ό PACER Integration: Access federal court dockets
  • πŸ”” Alerts: Track changes to cases and dockets
  • πŸ€– MCP Server: CourtListenerRESTAPIServer for AI integration

npm version

GovInfo SDK

Access the U.S. Government Publishing Office's official repository for federal government information.

  • πŸ“š Collections: Access to all Congressional, judicial, and executive branch publications
  • πŸ” Search: Full-text search across all government documents
  • πŸ“„ Download: Multiple format options (PDF, XML, HTML, etc.)
  • πŸ›οΈ Coverage: Bills, laws, regulations, court opinions, and more
  • πŸ€– MCP Server: GovInfoServer for AI integration

npm version

Department of Labor (DOL) SDK

Access comprehensive labor statistics and datasets from the U.S. Department of Labor.

  • πŸ“Š Statistics: Employment, wages, inflation, and productivity data
  • πŸ“ˆ Time Series: Historical labor market data
  • 🏭 Industries: Detailed industry-specific statistics
  • πŸ—ΊοΈ Geography: State and metropolitan area data
  • πŸ€– MCP Server: DOLDataServer for AI integration

πŸš€ Installation

Each SDK can be installed independently from npm:

# eCFR SDK
npm install @beshkenadze/ecfr-sdk

# Federal Register SDK  
npm install @beshkenadze/federal-register-sdk

# CourtListener SDK
npm install @beshkenadze/courtlistener-sdk

# GovInfo SDK
npm install @beshkenadze/govinfo-sdk

# DOL SDK
npm install @us-legal-tools/dol-sdk

Or using other package managers:

# Using Bun
bun add @beshkenadze/ecfr-sdk

# Using Yarn
yarn add @beshkenadze/federal-register-sdk

# Using PNPM
pnpm add @beshkenadze/courtlistener-sdk

πŸ“– Quick Start

eCFR SDK

import { getApiSearchV1Results } from '@beshkenadze/ecfr-sdk';

// Search for regulations about "clean air"
const results = await getApiSearchV1Results({
  q: 'clean air',
  per_page: 10,
  page: 1
});

console.log(`Found ${results.count} regulations`);
results.results.forEach(result => {
  console.log(`- ${result.title}: ${result.label_string}`);
});

Federal Register SDK

import { getDocumentsFormat } from '@beshkenadze/federal-register-sdk';

// Search for recent EPA rules
const documents = await getDocumentsFormat({
  format: 'json',
  conditions: {
    agencies: ['environmental-protection-agency'],
    type: ['RULE'],
    publication_date: {
      gte: '2024-01-01'
    }
  }
});

console.log(`Found ${documents.count} EPA rules in 2024`);

CourtListener SDK

import { getSearch } from '@beshkenadze/courtlistener-sdk';

// Search for Supreme Court cases about free speech
const cases = await getSearch({
  type: 'o', // opinions
  q: 'free speech',
  court: 'scotus',
  order_by: 'score desc'
});

console.log(`Found ${cases.count} Supreme Court cases`);
cases.results.forEach(case => {
  console.log(`- ${case.caseName} (${case.dateFiled})`);
});

GovInfo SDK

import { createApiClient } from '@beshkenadze/govinfo-sdk';

const client = createApiClient({
  headers: {
    'X-Api-Key': process.env.GOV_INFO_API_KEY
  }
});

// Search for recent legislation
const results = await client.searchPublished({
  query: 'infrastructure',
  pageSize: 10,
  offsetMark: '*',
  collection: 'BILLS'
});

console.log(`Found ${results.data.count} bills about infrastructure`);

DOL SDK

import { createApiClient } from '@us-legal-tools/dol-sdk';

const client = createApiClient({
  headers: {
    'X-API-KEY': process.env.DOL_API_KEY
  }
});

// Get available datasets
const datasets = await client.getDatasets();

console.log(`Available DOL datasets: ${datasets.data.datasets.length}`);
datasets.data.datasets.forEach(dataset => {
  console.log(`- ${dataset.dataset_title}`);
});

πŸ€– MCP (Model Context Protocol) Servers

Each SDK includes an MCP server that enables AI assistants to interact with these APIs. MCP servers provide a standardized way for AI tools to access external data sources.

Running MCP Servers

# Run eCFR MCP Server
cd packages/ecfr-sdk
bun run mcp:server

# Run Federal Register MCP Server
cd packages/federal-register-sdk
bun run mcp:server

# Run CourtListener MCP Server (requires API token)
cd packages/courtlistener-sdk
COURTLISTENER_API_TOKEN=your-token bun run mcp:server

# Run GovInfo MCP Server (requires API key)
cd packages/govinfo-sdk
GOV_INFO_API_KEY=your-key bun run mcp:server

# Run DOL MCP Server (requires API key)
cd packages/dol-sdk
DOL_API_KEY=your-key bun run mcp:server

MCP Integration Example

Configure your AI assistant (like Claude) to use these MCP servers:

{
  "mcpServers": {
    "ecfr": {
      "command": "bunx",
      "args": ["@beshkenadze/ecfr-sdk/mcp"]
    },
    "federal-register": {
      "command": "bunx", 
      "args": ["@beshkenadze/federal-register-sdk/mcp"]
    },
    "courtlistener": {
      "command": "bunx",
      "args": ["@beshkenadze/courtlistener-sdk/mcp"],
      "env": {
        "COURTLISTENER_API_TOKEN": "your-token"
      }
    },
    "govinfo": {
      "command": "bunx",
      "args": ["@beshkenadze/govinfo-sdk/mcp"],
      "env": {
        "GOV_INFO_API_KEY": "your-key"
      }
    },
    "dol": {
      "command": "bunx",
      "args": ["@us-legal-tools/dol-sdk/mcp"],
      "env": {
        "DOL_API_KEY": "your-key"
      }
    }
  }
}

πŸ”‘ Authentication

CourtListener API

Requires an API token from CourtListener. Set via:

  • Environment variable: COURTLISTENER_API_TOKEN
  • Or pass directly in API calls

GovInfo API

Requires an API key from GovInfo. Set via:

  • Environment variable: GOV_INFO_API_KEY
  • Or pass in request headers

DOL API

Requires an API key from DOL Developer. Set via:

  • Environment variable: DOL_API_KEY
  • Or pass in request headers

eCFR & Federal Register APIs

No authentication required - these are public APIs.

πŸ› οΈ Development

This is a Turborepo monorepo using Bun for package management.

Setup

# Clone the repository
git clone https://github.com/beshkenadze/ecfr-sdk.git
cd ecfr-sdk

# Install dependencies
bun install

# Generate all SDKs
turbo generate

# Build all packages
turbo build

# Run tests
turbo test

Project Structure

ecfr-sdk/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ ecfr-sdk/              # eCFR SDK package
β”‚   β”œβ”€β”€ federal-register-sdk/  # Federal Register SDK package
β”‚   β”œβ”€β”€ courtlistener-sdk/     # CourtListener SDK package
β”‚   β”œβ”€β”€ govinfo-sdk/           # GovInfo SDK package
β”‚   └── dol-sdk/               # Department of Labor SDK package
β”œβ”€β”€ turbo.json                 # Turborepo configuration
β”œβ”€β”€ package.json               # Root package.json
└── README.md                  # This file

Adding a New SDK

  1. Create a new package directory: packages/your-sdk
  2. Add orval configuration for OpenAPI code generation
  3. Configure TypeScript and build scripts
  4. Add to root tsconfig.json references
  5. Update this README

πŸ“‹ API Coverage

eCFR API Features

  • βœ… Full regulation text retrieval
  • βœ… Advanced search with faceting
  • βœ… Historical version access
  • βœ… Hierarchical navigation
  • βœ… Citation lookup
  • βœ… Recent changes tracking

Federal Register API Features

  • βœ… Document search and retrieval
  • βœ… Agency information
  • βœ… Public inspection documents
  • βœ… Presidential documents
  • βœ… Document images
  • βœ… Suggested searches

CourtListener API Features

  • βœ… Opinion full-text search
  • βœ… Case metadata and citations
  • βœ… Judge biographical data
  • βœ… Oral argument audio
  • βœ… PACER document access
  • βœ… Financial disclosures
  • βœ… Docket alerts
  • βœ… Citation normalization

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

MIT License - see LICENSE for details.

πŸ”— Resources

πŸ‘€ Author

Akira Beshkenadze

πŸ™ Acknowledgments

  • Free Law Project for CourtListener
  • U.S. Government Publishing Office for eCFR and Federal Register APIs
  • Anthropic for Model Context Protocol

Built with ❀️ using Turborepo, Bun, and Orval

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •