TypeScript SDKs and MCP servers for U.S. federal legal and regulatory APIs
- Quick Start
- Packages
- Key Features
- Usage Examples
- MCP Servers
- Authentication
- Development
- Contributing
- Resources
# Install any SDK
npm install @us-legal-tools/ecfr-sdk
npm install @us-legal-tools/federal-register-sdk
npm install @us-legal-tools/courtlistener-sdk
npm install @us-legal-tools/govinfo-sdk
npm install @us-legal-tools/dol-sdk
# Or clone and run locally
git clone https://github.com/beshkenadze/us-legal-tools.git
cd ecfr-sdk
bun install
turbo build| Package | Version | Description |
|---|---|---|
| @us-legal-tools/ecfr-sdk | Electronic Code of Federal Regulations API | |
| @us-legal-tools/federal-register-sdk | Federal Register documents and notices API | |
| @us-legal-tools/courtlistener-sdk | Legal opinions, PACER data, and judge info API | |
| @us-legal-tools/govinfo-sdk | Government Publishing Office documents API | |
| @us-legal-tools/dol-sdk | Department of Labor statistics and data API |
@us-legal-tools/ecfr-sdk - Electronic Code of Federal Regulations
- Full text of all 50 CFR titles with advanced search
- Historical versions and change tracking
- MCP Server:
eCFRSDKServer
@us-legal-tools/federal-register-sdk - Federal Register
- All documents published since 1994 with agency information
- Public inspection documents before publication
- MCP Server:
FederalRegisterServer
@us-legal-tools/courtlistener-sdk - CourtListener
- Millions of legal opinions from federal and state courts
- Judge profiles, oral arguments, PACER integration
- Citation lookup and docket alerts
- MCP Server:
CourtListenerRESTAPIServer
@us-legal-tools/govinfo-sdk - GovInfo
- Congressional, judicial, and executive branch publications
- Full-text search with multiple download formats
- MCP Server:
GovInfoServer
@us-legal-tools/dol-sdk - Department of Labor
- Employment, wages, inflation, and productivity statistics
- Industry-specific and geographic data
- MCP Server:
DOLDataServer
import { getApiSearchV1Results } from '@us-legal-tools/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}`);
});import { getDocumentsFormat } from '@us-legal-tools/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`);import { getSearch } from '@us-legal-tools/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})`);
});import { createApiClient } from '@us-legal-tools/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`);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}`);
});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.
# 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:serverConfigure your AI assistant (like Claude) to use these MCP servers:
{
"mcpServers": {
"ecfr": {
"command": "bunx",
"args": ["@us-legal-tools/ecfr-sdk/mcp"]
},
"federal-register": {
"command": "bunx",
"args": ["@us-legal-tools/federal-register-sdk/mcp"]
},
"courtlistener": {
"command": "bunx",
"args": ["@us-legal-tools/courtlistener-sdk/mcp"],
"env": {
"COURTLISTENER_API_TOKEN": "your-token"
}
},
"govinfo": {
"command": "bunx",
"args": ["@us-legal-tools/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"
}
}
}
}Requires an API token from CourtListener. Set via:
- Environment variable:
COURTLISTENER_API_TOKEN - Or pass directly in API calls
Requires an API key from GovInfo. Set via:
- Environment variable:
GOV_INFO_API_KEY - Or pass in request headers
Requires an API key from DOL Developer. Set via:
- Environment variable:
DOL_API_KEY - Or pass in request headers
No authentication required - these are public APIs.
This is a Turborepo monorepo using Bun for package management.
# Clone the repository
git clone https://github.com/beshkenadze/us-legal-tools.git
cd ecfr-sdk
# Install dependencies
bun install
# Generate all SDKs
turbo generate
# Build all packages
turbo build
# Run tests
turbo testecfr-sdk/
βββ packages/
β βββ ecfr-sdk/ # eCFR SDK
β βββ federal-register-sdk/ # Federal Register SDK
β βββ courtlistener-sdk/ # CourtListener SDK
β βββ govinfo-sdk/ # GovInfo SDK
β βββ dol-sdk/ # Department of Labor SDK
β βββ tsconfig/ # Shared TypeScript configs
βββ turbo.json # Turborepo configuration
βββ package.json # Root package.json
βββ biome.json # Code formatter/linter config
βββ tsconfig.json # Root TypeScript config
βββ README.md # This file
- Create a new package directory:
packages/your-sdk - Add orval configuration for OpenAPI code generation
- Configure TypeScript and build scripts
- Add to root
tsconfig.jsonreferences - Update this README
# Install dependencies
bun install
# Generate all SDKs from OpenAPI specs
turbo generate
# Build all packages
turbo build
# Run tests
turbo test
turbo test:integration
turbo test:e2e
# Format and lint
turbo format
turbo lint# Run a specific package's command
turbo run build --filter=@us-legal-tools/ecfr-sdk
# Work on a specific package
cd packages/ecfr-sdk
bun testContributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE for details.
- eCFR API Documentation
- Federal Register API Documentation
- CourtListener API Documentation
- GovInfo API Documentation
- DOL API Documentation
Aleksandr Beshkenadze beshkenadze@gmail.com
- GitHub: @beshkenadze