# BLS Labor Market MCP — AI Agent Economic Data (`red.cars/bls-labor-market-mcp`) Actor

AI agent access to Bureau of Labor Statistics data: employment, unemployment, wages, CPI, and labor force participation. Powered by BLS Public Data API v1.

- **URL**: https://apify.com/red.cars/bls-labor-market-mcp.md
- **Developed by:** [AutomateLab](https://apify.com/red.cars) (community)
- **Categories:** MCP servers, AI
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## BLS Labor Market MCP

**Type**: Apify MCP Actor (TypeScript)  
**Purpose**: AI agent access to Bureau of Labor Statistics (BLS) employment, unemployment, wage, CPI, and labor force data via the BLS Public Data API v2  
**Stack**: Apify SDK, Node.js `>=20`, MCP protocol, standby mode, PPE billing

### Overview

The BLS Labor Market MCP provides AI agents with structured access to the U.S. Bureau of Labor Statistics' vast economic datasets. It wraps the free [BLS Public Data API v2](https://data.bls.gov/registrationEngine/) (registration required for higher rate limits) and exposes five operational tools via the MCP protocol.

> **API Key**: Set `BLS_API_KEY` in your Apify Actor environment variables for best performance. Without a key, the free tier is limited. Get your key free at [data.bls.gov/registrationEngine](https://data.bls.gov/registrationEngine/).

### Tools

| Tool | Description | PPE |
|------|-------------|-----|
| `getEmploymentData` | Nonfarm payrolls (NFP), employment level, labor force participation — national, state, or county | $0.03 |
| `getUnemploymentRate` | Official U-3 unemployment rate, or U-5/U-6 broader measures — national, state, metro | $0.02 |
| `getWageData` | Average Hourly Earnings (AHE), Employment Cost Index (ECI), weekly wages | $0.03 |
| `getCPI` | CPI-U all items, core, food, energy, shelter, transportation —NSA or SA | $0.03 |
| `getLaborForce` | Labor force participation rate, employment-population ratio, labor force levels | $0.03 |

### Quick Start

```bash
## Local development
cd ~/Projects/apify-actors/bls-labor-market-mcp
apify run

## Deploy to Apify
apify push
````

### Input Schema

Tools are called via MCP JSON-RPC over HTTP POST to `/mcp`. Example:

```json
{
  "method": "tools/call",
  "params": {
    "name": "getUnemploymentRate",
    "arguments": {
      "state": "CA",
      "startYear": 2022,
      "endYear": 2024
    }
  }
}
```

All tools accept optional `startYear` and `endYear` (default: 2020 → current year).

#### getEmploymentData

```json
{
  "seriesId": "LNS12000000",
  "startYear": 2022,
  "endYear": 2024,
  "state": "CA"
}
```

`seriesId` defaults to overall civilian employment level. Common series:

- `LNS12000000` — Employment level
- `LNS13000000` — Unemployed level
- `LNS12300000` — Employment-population ratio

#### getUnemploymentRate

```json
{
  "state": "NY",
  "startYear": 2022,
  "endYear": 2024,
  "measure": "U3"
}
```

`measure` options: `U3` (official, default), `U5`, `U6` (broadest). Omit `state` for national.

#### getWageData

```json
{
  "seriesId": "CES0500000013",
  "startYear": 2022,
  "endYear": 2024,
  "state": "TX",
  "measure": "hourly"
}
```

`seriesId` defaults to national average hourly earnings. Common series:

- `CES0500000013` — Total private AHE
- `CES3000000013` — Manufacturing AHE
- `CES6500000013` — Education & Health AHE

#### getCPI

```json
{
  "seriesId": "CUUR0000SA0",
  "startYear": 2022,
  "endYear": 2024,
  "seasonallyAdjusted": true
}
```

`seriesId` defaults to CPI-U all items. Common series:

- `CUUR0000SA0` — CPI-U all items (1982-84=100)
- `CUUR0000SAF1` — CPI-U food
- `CUUR0000SAE1` — CPI-U energy
- `CUUR0000SAH1` — CPI-U shelter

#### getLaborForce

```json
{
  "state": null,
  "demographic": "gender",
  "startYear": 2022,
  "endYear": 2024,
  "measure": "participation"
}
```

`measure`: `participation` (LFPR, default), `employment` (EMP-POP ratio), `labor_force` (LF level).\
`demographic`: `age`, `gender`, `race`, `education`, or `null` for total.

### Architecture

- **Standby MCP**: Server listens on `/mcp` (JSON-RPC over HTTP POST). Health probe at `/`.
- **BLS API v2**: REST POST to `https://api.bls.gov/publicAPI/v2/timeseries/data/`
- **Rate limiting**: 1.1s gap between requests (BLS recommends ≤1 req/sec)
- **ERROR\_RETRY**: Retries on HTTP 429, 500, 502, 503, 504 with exponential backoff (base 2s, max 3 retries)
- **PPE charging**: `Actor.charge()` called after each successful tool call
- **State FIPS mapping**: Accepts abbreviations (`CA`) or numeric FIPS (`06`)

### Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `BLS_API_KEY` | Recommended | BLS API v2 registration key (free). Without it, rate limits are lower. |
| `APIFY_META_ORIGIN` | System | Set to `STANDBY` by Apify when in standby mode |
| `APIFY_STANDBY_PORT` | Optional | Override the HTTP server port (default: 3000) |

### BLS Series Reference

#### Employment Situation (Current Population Survey — CPS)

| Series ID | Description |
|-----------|-------------|
| `LNS12000000` | Employment Level (thousands) |
| `LNS13000000` | Unemployed Level (thousands) |
| `LNS11000000` | Labor Force Level (thousands) |
| `LNS11300000` | Labor Force Participation Rate (%) |
| `LNS12300000` | Employment-Population Ratio (%) |
| `LNS14000000` | Unemployment Rate (%) |

#### Average Hourly Earnings (CES)

| Series ID | Description |
|-----------|-------------|
| `CES0500000013` | Total Private — Average Hourly Earnings ($) |
| `CES0600000013` | Goods-Producing — AHE ($) |
| `CES3000000013` | Manufacturing — AHE ($) |
| `CES4200000013` | Retail Trade — AHE ($) |
| `CES6500000013` | Education & Health — AHE ($) |
| `CES9100000013` | Government — AHE ($) |

#### CPI-U

| Series ID | Description |
|-----------|-------------|
| `CUUR0000SA0` | All Items (1982-84=100) |
| `CUUR0000SAF1` | Food |
| `CUUR0000SAE1` | Energy |
| `CUUR0000SAH1` | Shelter |
| `CUUR0000SAM1` | Medical Care |
| `CUUR0000SAT1` | Transportation |

#### Employment Cost Index

| Series ID | Description |
|-----------|-------------|
| `CIU2020000000000` | Employment Cost Index — Wages & Salaries |
| `CIU1010000000000` | Employment Cost Index — Total Benefits |

### License

MIT

# Actor input Schema

## Actor input object example

```json
{}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("red.cars/bls-labor-market-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("red.cars/bls-labor-market-mcp").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call red.cars/bls-labor-market-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=red.cars/bls-labor-market-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "BLS Labor Market MCP — AI Agent Economic Data",
        "description": "AI agent access to Bureau of Labor Statistics data: employment, unemployment, wages, CPI, and labor force participation. Powered by BLS Public Data API v1.",
        "version": "1.0",
        "x-build-id": "bgBssl39tJIEMmigc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/red.cars~bls-labor-market-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-red.cars-bls-labor-market-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/red.cars~bls-labor-market-mcp/runs": {
            "post": {
                "operationId": "runs-sync-red.cars-bls-labor-market-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/red.cars~bls-labor-market-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-red.cars-bls-labor-market-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {}
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
