# OSHA Safety & Compliance Search (MCP-Ready) (`ferraz_michel/osha-safety-compliance-mcp`) Actor

Search official US DOL OSHA workplace inspections, citations, violations, and penalty totals via API with compact MCP summary output for AI agents.

- **URL**: https://apify.com/ferraz_michel/osha-safety-compliance-mcp.md
- **Developed by:** [Michel Ferraz](https://apify.com/ferraz_michel) (community)
- **Categories:** AI, Agents, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 80.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 inspection records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OSHA Safety & Compliance Search (MCP-Ready)

Query official **US Department of Labor (DOL) OSHA** workplace safety inspections, citations, violations, and penalty amounts through an **API-first, token-efficient Apify Actor** built for **B2B due diligence, insurance underwriting, legal research, and AI agents (MCP)**.

***

### Why Use This Actor Instead of Manual Portals or Fragile Scrapers?

- **Official US Government Open Data API:** Queries the DOL Open Data API directly over HTTPS — zero headless browser overhead, zero proxy blocks, and clean structured fields.
- **Automatic Pagination Past the 200-Row Limit:** The native DOL endpoint caps responses at 200 records per request. This Actor automatically paginates up to your configured `maxRecords`.
- **Automatic Inspection + Violation Join:** Optionally fetches linked violations by `activity_nr` and calculates `violation_count`, `total_initial_penalty`, and `total_current_penalty` per establishment.
- **Built for AI Agents (MCP Summary Mode):** Select `outputMode: "mcp_summary"` to get a compact JSON digest in `OUTPUT` summarizing total penalties, violation severity breakdown (`Serious`, `Willful`, `Repeat`), and top cited OSHA standards without overflowing your LLM context window.

***

### Common Use Cases

1. **Vendor & Contractor Risk Vetting (AI Agents):** Let an AI compliance agent check a supplier's last 5 years of OSHA safety citations before onboarding.
2. **Insurance & Legal Due Diligence:** Pull inspection histories and penalty trends across a company name or NAICS industry code in a specific US state.
3. **B2B Safety & Compliance Sales:** Identify high-hazard facilities or industries (`naicsCode` + `state`) with recent citations for safety training, PPE, or EHS software outreach.

***

### Input Example

```json
{
  "establishmentName": "Amazon",
  "state": "TX",
  "includeViolations": true,
  "maxRecords": 50,
  "outputMode": "mcp_summary"
}
```

#### Input Parameters

| Field | Type | Description |
| :--- | :--- | :--- |
| `establishmentName` | `string` | Company or establishment name filter (partial match) |
| `state` | `string` | Two-letter US state code (e.g., `TX`, `CA`, `OH`) |
| `naicsCode` | `string` | 2- to 6-digit NAICS industry code prefix |
| `openDateFrom` / `openDateTo` | `string` | Inspection open date bounds (`YYYY-MM-DD`) |
| `includeViolations` | `boolean` | Fetch and sum linked OSHA violations & penalties (default `true`) |
| `maxRecords` | `integer` | Maximum inspections to return (`1` to `1000`, default `50`) |
| `outputMode` | `string` | `detailed` (full dataset rows) or `mcp_summary` (adds compact risk digest to `OUTPUT`) |
| `dolApiKey` | `string` | Optional DOL Open Data API key override |

***

### Output Example (`OUTPUT` in `mcp_summary` Mode)

```json
{
  "query": {
    "establishmentName": "Amazon",
    "state": "TX",
    "naicsCode": null,
    "openDateFrom": null,
    "openDateTo": null,
    "includeViolations": true
  },
  "metrics": {
    "inspections_returned": 12,
    "total_violations": 19,
    "total_initial_penalty_usd": 148250.0,
    "total_current_penalty_usd": 94100.0,
    "violation_types": {
      "S": 14,
      "O": 5
    },
    "top_cited_standards": [
      { "standard": "19100178", "count": 4 },
      { "standard": "19100022", "count": 3 }
    ],
    "states_breakdown": {
      "TX": 12
    }
  },
  "inspections_digest": [
    {
      "activity_nr": "1701234",
      "estab_name": "Amazon.com Services LLC",
      "city_state": "Houston, TX",
      "open_date": "2025-08-14",
      "insp_type": "C",
      "naics_code": "493110",
      "violation_count": 2,
      "current_penalty_usd": 16131.0
    }
  ]
}
```

***

### Using with AI Agents via Apify MCP

Connect this Actor directly to **Claude Desktop, Cursor, LangGraph, or CrewAI** via Apify's official MCP server (`https://mcp.apify.com`) using OAuth or your Apify token. Always prefer `outputMode: "mcp_summary"` inside interactive chat sessions for fast responses and minimal token usage.

# Actor input Schema

## `establishmentName` (type: `string`):

Company or establishment name to search in OSHA inspection records (e.g. 'Amazon', 'Tesla', 'Acme Construction').

## `state` (type: `string`):

Optional two-letter US state abbreviation (e.g. TX, CA, NY, OH).

## `naicsCode` (type: `string`):

Optional 2- to 6-digit NAICS industry code filter (e.g. '236220' or '493110').

## `openDateFrom` (type: `string`):

Optional earliest inspection open date in YYYY-MM-DD format.

## `openDateTo` (type: `string`):

Optional latest inspection open date in YYYY-MM-DD format.

## `includeViolations` (type: `boolean`):

Fetch linked OSHA citations/violations and penalty amounts for each inspection by activity_nr.

## `maxRecords` (type: `integer`):

Maximum number of inspections to retrieve across paginated DOL API calls.

## `outputMode` (type: `string`):

Choose 'detailed' for full inspection rows or 'mcp_summary' for a token-efficient aggregate JSON summary ideal for AI agents.

## `dolApiKey` (type: `string`):

Optional US Department of Labor Open Data API Key. Leave blank to use the Actor's configured DOL_API_KEY.

## Actor input object example

```json
{
  "establishmentName": "Amazon",
  "state": "TX",
  "includeViolations": true,
  "maxRecords": 10,
  "outputMode": "detailed"
}
```

# Actor output Schema

## `inspections` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "establishmentName": "Amazon",
    "state": "TX",
    "maxRecords": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("ferraz_michel/osha-safety-compliance-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "establishmentName": "Amazon",
    "state": "TX",
    "maxRecords": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("ferraz_michel/osha-safety-compliance-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "establishmentName": "Amazon",
  "state": "TX",
  "maxRecords": 10
}' |
apify call ferraz_michel/osha-safety-compliance-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ferraz_michel/osha-safety-compliance-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/YcWPKUwd0iaiv2dpb/builds/uukSmHUYtmgf6QzaC/openapi.json
