This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Turborepo monorepo containing TypeScript SDKs and MCP (Model Context Protocol) servers for major U.S. federal legal and regulatory APIs. The project uses Bun as the primary runtime and package manager.
# Install dependencies
bun install
# Generate all SDKs from OpenAPI specs
turbo generate
# Build all packages
turbo build
# Run tests
turbo test
# Run integration tests
turbo test:integration
# Run e2e tests
turbo test:e2e
# Format and lint code
turbo format
turbo lint
turbo check# Work on a specific package
cd packages/[package-name]
# Run MCP server
bun run mcp:server
# Run development server
bun run dev
# Run tests for specific package
bun test
bun test:watch# Run a specific test file
bun test src/api/client.test.ts
# Run tests matching a pattern
bun test --filter="search"
# Run with specific environment
SKIP_INTEGRATION_TESTS=false bun test src- Root: Turborepo configuration with shared dependencies
- packages/: Individual SDK packages
ecfr-sdk: Electronic Code of Federal Regulationsfederal-register-sdk: Federal Register documentscourtlistener-sdk: Court cases and legal datagovinfo-sdk: Government Publishing Office datadol-sdk: Department of Labor statisticsscalar-ui: API documentation UI
Each SDK package follows a consistent structure:
- API Client (
src/api/): Generated TypeScript client from OpenAPI spec - MCP Server (
src/mcp/): Model Context Protocol implementation for AI integration - Build System: Uses Orval for code generation from OpenAPI specs
- Testing: Unit, integration, and e2e test suites
- OpenAPI specs are downloaded/maintained in each package
- Orval generates TypeScript clients and types
- MCP handlers are manually maintained to wrap the generated API clients
- Build process creates both CommonJS and ESM outputs
import { getApiSearchV1Results } from '@beshkenadze/us-legal-tools';
// Direct function calls with typed parameters
const results = await getApiSearchV1Results({
q: 'search term',
per_page: 10
});- Each SDK includes an MCP server for AI assistant integration
- Servers expose API functionality as structured tools
- Authentication handled via environment variables when required
- Unit tests: Test individual functions and components
- Integration tests: Test API client with real endpoints (controlled by SKIP_INTEGRATION_TESTS)
- E2E tests: Full workflow testing including MCP servers (controlled by SKIP_E2E_TESTS)
-
CI: Runs on all PRs and main branch pushes
- Generates SDKs
- Runs format and lint checks
- Builds all packages
- Runs all test suites
- Verifies MCP servers work
-
Release: Triggered by version tags (v*)
- Downloads latest OpenAPI specs
- Generates fresh SDK code
- Publishes to npm and GitHub Packages
# Update version
bun version patch/minor/major
# This automatically:
# - Updates package.json version
# - Creates git commit and tag
# - Pushes to trigger release workflow- Biome for formatting and linting
- TypeScript with strict mode
- Import/export type annotations required
- Generated code is excluded from linting
GOV_INFO_API_KEY: Required for GovInfo SDKDOL_API_KEY: Required for DOL SDKCOURTLISTENER_API_TOKEN: Required for CourtListener SDK- No auth required for eCFR and Federal Register APIs
- Never manually edit files in
generated/directories - Never edit MCP handler files marked with "Generated by" headers
- To modify SDK behavior, update Orval configs or create wrapper functions