BLS MCP Server
This BLS MCP Server provides programmatic access to Bureau of Labor Statistics economic data through standardized MCP tools for AI-powered analysis and visualization.
Core Capabilities:
Fetch time series data - Retrieve specific BLS data series using
get_serieswith requiredseries_idand optional date filtering (start_year/end_year)Browse available datasets - List BLS series with
list_series, supporting category filtering (CPI, Employment, etc.) and pagination limitsGet series metadata - Access detailed information using
get_series_info, including titles, descriptions, categories, and data availabilityVisualization preparation - Use
plot_seriesto obtain structured, plot-ready data with statistical summaries (min, max, average, count) and chart configuration recommendations for client-side rendering
Data Coverage:
Consumer Price Index (CPI) across multiple categories (All Items, Food, Energy, Housing, etc.)
Monthly granularity spanning 2020-2024
Currently uses realistic mock data for development and testing, with a migration path to real BLS API
Integration:
Compatible with multiple LLM clients (Claude, GPT-4, etc.) via the official MCP SDK
Supports both local (
stdio) and remote (SSEvia ngrok) transports
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@BLS MCP Serverget the latest CPI data for the last 5 years"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
BLS MCP Server
A standalone MCP (Model Context Protocol) server for Bureau of Labor Statistics (BLS) data, designed to work with multiple LLM clients through both local and remote connections.
Features
Official MCP SDK: Built with the official
mcpPython SDK for full protocol controlMock Data First: Uses realistic mock BLS data for rapid development and testing
Multiple Transports: Supports both stdio (local) and SSE (remote via ngrok)
Multi-LLM Compatible: Test with Claude, GPT-4, and other MCP-compatible clients
Modular Design: Clean separation between tools, resources, and data providers
Related MCP server: BLS (Bureau of Labor Statistics) MCP Server
Quick Start
Installation
Option 1: Using UV (Recommended - 10x faster!)
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Navigate to project
cd bls_mcp
# Sync dependencies (creates .venv automatically)
uv sync
# Run the server
./scripts/uv_start_server.sh
# Test the server
./scripts/uv_test_client.shSee UV_USAGE.md for comprehensive UV documentation.
Option 2: Using pip (Traditional)
# Clone the repository
cd bls_mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
# Or install with dev dependencies
pip install -e ".[dev]"Running the Server (Local)
# With UV (recommended)
./scripts/uv_start_server.sh
# Or with traditional Python
python scripts/start_server.pyTesting with MCP Inspector
# Install MCP inspector (if not already installed)
npm install -g @modelcontextprotocol/inspector
# Run inspector
mcp-inspector python scripts/start_server.pyProject Status
Current Phase: Phase 2 - Enhanced Tools (Starting Visualization)
Phase 1 - Foundation ✅ COMPLETE
Project structure created
Configuration files set up
Mock data system implemented (8 CPI series, 114 data points)
Core MCP server implemented with stdio transport
Basic tools implemented (get_series, list_series, get_series_info)
17 unit tests written (all passing)
UV package manager integration
SSE transport + ngrok support (bonus!)
Claude Desktop integration guide
Phase 2 - Enhanced Tools (In Progress)
Simple visualization tool (static plots) -
plot_seriestoolAdvanced analysis tools
Data comparison tools
Available Tools
Phase 1 Tools - Data Access
get_series
Fetch BLS data series by ID with optional date range filtering.
Parameters:
series_id(string, required): BLS series ID (e.g., "CUUR0000SA0")start_year(integer, optional): Start year for data rangeend_year(integer, optional): End year for data range
Example:
{
"name": "get_series",
"arguments": {
"series_id": "CUUR0000SA0",
"start_year": 2020,
"end_year": 2024
}
}list_series
List available BLS series with optional filtering.
Parameters:
category(string, optional): Filter by category (e.g., "CPI", "Employment")limit(integer, optional): Maximum number of results (default: 50)
get_series_info
Get detailed metadata about a specific BLS series.
Parameters:
series_id(string, required): BLS series ID
Phase 2 Tools - Data Formatting for Visualization
plot_series
Get CPI All Items (CUUR0000SA0) data formatted for client-side plotting.
Features:
Returns structured time series data ready for plotting
No parameters needed - hardcoded to CPI All Items
Includes statistics (min, max, average)
Chronologically sorted data
Plot instructions for client-side rendering
Parameters:
None required
Returns:
data: Array of {date, value, year, month, period} objectsstatistics: {count, min, max, average}date_range: {start, end}plot_instructions: Suggested chart settingsseries_title: Full series name
Example:
{
"name": "plot_series",
"arguments": {}
}Example Response:
{
"status": "success",
"series_id": "CUUR0000SA0",
"series_title": "Consumer Price Index for All Urban Consumers: All Items",
"data": [
{"date": "2020-01", "value": 257.971, "year": "2020", "month": "01", "period": "M01"},
...
],
"statistics": {
"count": 60,
"min": 257.971,
"max": 314.540,
"average": 285.234
},
"date_range": {
"start": "2020-01",
"end": "2024-12"
},
"plot_instructions": {
"chart_type": "line",
"x_axis": "date",
"y_axis": "value",
"title": "Consumer Price Index for All Urban Consumers: All Items",
"x_label": "Date",
"y_label": "Index Value"
}
}Note: This tool returns data for client-side plotting, not pre-rendered images. The client (ChatGPT, Claude, etc.) can use this data to create charts in their own environment.
Architecture
Directory Structure
bls_mcp/
├── src/bls_mcp/
│ ├── server.py # Main MCP server
│ ├── transports/
│ │ ├── stdio.py # stdio transport (local)
│ │ └── sse.py # SSE transport (remote - Phase 2)
│ ├── tools/
│ │ ├── base.py # Base tool class
│ │ ├── get_series.py # Get series tool
│ │ ├── list_series.py # List series tool
│ │ └── get_series_info.py # Get series info tool
│ ├── data/
│ │ ├── mock_data.py # Mock data provider
│ │ └── fixtures/ # JSON data fixtures
│ └── utils/
│ ├── logger.py # Logging configuration
│ └── validators.py # Input validation
├── tests/ # Test suite
├── scripts/ # Utility scripts
└── docs/ # DocumentationData Flow
Client Request → MCP protocol (JSON-RPC)
Transport Layer → stdio or SSE
Server Router → Route to appropriate tool
Tool Execution → Fetch data from provider
Data Provider → Mock or real data source
Response → JSON formatted response
Mock Data
The server uses realistic mock BLS data that follows the actual BLS API structure:
CPI Series: Consumer Price Index data for various categories
Time Range: 2020-2024 with monthly data points
Coverage: Multiple categories (All Items, Food, Energy, Housing, etc.)
Realistic Values: Based on actual BLS data patterns
Development
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=bls_mcp
# Run specific test file
pytest tests/test_tools.pyCode Quality
# Format code
black src/ tests/
# Lint code
ruff check src/ tests/
# Type checking
mypy src/Adding New Tools
Create tool file in
src/bls_mcp/tools/Implement tool class following the base pattern
Register tool in
server.pyAdd tests in
tests/test_tools.pyUpdate documentation
Roadmap
Phase 1: Foundation ✅ COMPLETE
Project setup and configuration
Mock data system
Core MCP server with stdio transport
Basic tools (get_series, list_series, get_series_info)
Unit tests (17 tests, all passing)
UV package manager integration
SSE transport implementation (bonus!)
ngrok integration (bonus!)
Claude Desktop integration guide
Phase 2: Enhanced Tools (In Progress)
Visualization tools (simple static plots)
Data comparison and analysis tools
Multi-LLM client testing
Enhanced error handling and validation
Phase 3: Advanced Features
MCP resources (catalogs, documentation)
Pre-built prompts for analysis
Advanced visualization (interactive charts)
Migration path to real BLS data
Configuration
Create a .env file (copy from .env.example):
MCP_SERVER_PORT=3000
MCP_SERVER_HOST=localhost
LOG_LEVEL=INFO
DATA_PROVIDER=mockContributing
This is a personal project, but suggestions and feedback are welcome!
License
MIT License - see LICENSE file for details
Related Projects
bls_data - Comprehensive BLS data toolkit (parent project)
Model Context Protocol - MCP specification and documentation
Support
For issues or questions, please refer to the documentation in the docs/ directory or check the PLAN.md file for development details.
Available Tools
4 toolsget_seriesB
Fetch BLS data series by ID with optional date range filtering. Returns time series data points with values, periods, and metadata.
| Name | Required | Description | Default |
|---|---|---|---|
| series_id | Yes | BLS series ID (e.g., 'CUUR0000SA0' for CPI All Items) | |
| start_year | No | Start year for data range (optional) | |
| end_year | No | End year for data range (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool 'returns time series data points with values, periods, and metadata', which gives some insight into output behavior. However, it lacks critical details such as rate limits, authentication requirements, error handling, or data freshness (e.g., update frequency). For a data-fetching tool with no annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded and efficiently structured in two sentences: the first states the core action and parameters, and the second describes the return value. Every sentence earns its place by providing essential information without redundancy, making it appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and output structure but lacks details on behavioral aspects like error cases, rate limits, or data sources. Without an output schema, the description should ideally explain return values more thoroughly, though it does mention 'time series data points with values, periods, and metadata'. This leaves gaps for an agent to operate effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with clear descriptions for all parameters (series_id, start_year, end_year). The description adds minimal value beyond the schema by mentioning 'optional date range filtering', which aligns with the optional start_year and end_year parameters but doesn't provide additional semantics like format examples beyond 'CUUR0000SA0' or constraints. Baseline 3 is appropriate since the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('fetch') and resources ('BLS data series by ID'), and mentions optional date range filtering. It distinguishes itself from siblings like 'get_series_info' (likely metadata) and 'list_series' (likely listing multiple series) by focusing on fetching time series data points. However, it doesn't explicitly differentiate from 'plot_series', which might involve visualization of the same data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by mentioning 'optional date range filtering', suggesting it's for retrieving specific series data. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_series_info' for metadata or 'plot_series' for visualization. No exclusions or prerequisites are stated, leaving the agent to infer context from sibling tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_series_infoB
Get detailed metadata information about a specific BLS series. Returns series title, description, category, and data availability.
| Name | Required | Description | Default |
|---|---|---|---|
| series_id | Yes | BLS series ID (e.g., 'CUUR0000SA0') |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions the return values but doesn't disclose behavioral traits such as error handling, rate limits, authentication needs, or whether it's a read-only operation. The description is minimal beyond stating the purpose.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the purpose and return values. There is no wasted text, making it appropriately sized and structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (single parameter, no output schema, no annotations), the description is adequate but has gaps. It covers the purpose and return values, but lacks behavioral context and usage guidelines, which are important for completeness in this context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the parameter 'series_id' well-documented in the schema (including an example). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Get' and resource 'detailed metadata information about a specific BLS series', specifying what it returns (title, description, category, data availability). However, it doesn't explicitly differentiate from sibling tools like 'get_series' or 'list_series', which likely have overlapping purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'get_series', 'list_series', or 'plot_series'. The description implies usage for retrieving metadata, but lacks explicit context or exclusions for sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_seriesA
List available BLS data series with optional category filtering. Returns series metadata including titles, IDs, and categories.
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter by category (e.g., 'CPI', 'Employment'). Optional. | |
| limit | No | Maximum number of results to return (default: 50) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool returns 'series metadata including titles, IDs, and categories,' which adds behavioral context beyond the input schema. However, it doesn't mention other traits like rate limits, authentication needs, pagination behavior, or potential errors, leaving gaps for a mutation-free but data-heavy tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the core purpose and followed by return details. Every sentence earns its place: the first defines the action and optional filtering, the second specifies the output. There is no wasted verbiage, making it highly efficient and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the purpose and output type but lacks details on behavioral aspects like response format, error handling, or usage constraints. Without annotations or output schema, more context would improve completeness for effective agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with both parameters ('category' and 'limit') well-documented in the schema. The description adds minimal value beyond the schema by mentioning 'optional category filtering' and 'Returns series metadata,' but doesn't provide additional semantics like format examples or usage nuances. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'List available BLS data series with optional category filtering.' It specifies the verb ('List'), resource ('BLS data series'), and scope ('with optional category filtering'), and distinguishes it from siblings like 'get_series' or 'plot_series' by focusing on listing metadata rather than retrieving or visualizing data. However, it doesn't explicitly differentiate from 'get_series_info', which might also involve metadata, keeping it from a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by mentioning 'optional category filtering,' suggesting it's for browsing series with potential filtering. It doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_series' or 'plot_series,' nor does it state any prerequisites or exclusions. The context is clear but lacks detailed alternatives or when-not-to-use advice.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_seriesA
Get CPI All Items (CUUR0000SA0) data formatted for plotting. Returns time series data with dates and values that can be used to create charts on the client side. No parameters needed.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool returns time series data formatted for plotting and requires no parameters, which is useful. However, it doesn't mention potential behavioral aspects like rate limits, authentication requirements, data freshness, or error conditions. The description adds some value but lacks comprehensive behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise and well-structured in three sentences. The first sentence states the purpose, the second explains the return format and usage, and the third clarifies the parameter situation. Every sentence earns its place with no wasted words, and the information is front-loaded appropriately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is reasonably complete for basic understanding. However, for a data retrieval tool with no annotations, it could benefit from mentioning response format details, potential limitations, or error handling. The description covers the essentials but leaves some contextual gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters with 100% schema description coverage. The description explicitly states 'No parameters needed,' which aligns perfectly with the schema. This provides clear semantic understanding beyond the schema's structural definition. A baseline of 4 is appropriate for zero-parameter tools where the description confirms the absence of inputs.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Get CPI All Items (CUUR0000SA0) data formatted for plotting.' It specifies the exact resource (CPI All Items with specific identifier) and verb (get), and distinguishes it from sibling tools like get_series, get_series_info, and list_series by emphasizing the 'formatted for plotting' aspect and 'no parameters needed' constraint.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use this tool: 'Returns time series data with dates and values that can be used to create charts on the client side.' It also specifies 'No parameters needed,' which differentiates it from parameter-requiring siblings. While it doesn't explicitly name alternatives, the context of sibling tools and the specific 'plotting' focus provides clear usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v1.0.0- Changed
get_series2 fields changed- added
Input schema / descriptionAdded value: +"Input schema for get_series tool." - added
Input schema / titleAdded value: +"GetSeriesInput"
- Changed
get_series_info2 fields changed- added
Input schema / descriptionAdded value: +"Input schema for get_series_info tool." - added
Input schema / titleAdded value: +"GetSeriesInfoInput"
- Changed
list_series2 fields changed- added
Input schema / descriptionAdded value: +"Input schema for list_series tool." - added
Input schema / titleAdded value: +"ListSeriesInput"
- Added
plot_series
3 tool updates
- First observed
get_series - First observed
get_series_info - First observed
list_series
TDQS
Scored across 4 tools
The tools are mostly distinct, with get_series, get_series_info, and list_series clearly targeting different operations (data retrieval, metadata, and listing). However, plot_series overlaps slightly with get_series, as both return time series data, which could cause confusion about which to use for charting purposes.
All tool names follow a consistent verb_noun pattern (get_series, get_series_info, list_series, plot_series), using snake_case uniformly. This predictability makes it easy for agents to understand and select tools based on their naming conventions.
With 4 tools, this server is well-scoped for its purpose of accessing BLS data. Each tool serves a distinct function (data fetching, metadata retrieval, listing, and plotting), and there are no unnecessary or redundant tools, making the count appropriate for the domain.
The server covers core operations like fetching, listing, and metadata retrieval, but has notable gaps. For example, there are no tools for updating or deleting data (though this may be intentional for a read-only API), and plot_series is limited to a specific CPI series, lacking flexibility for other series. This could lead to agent workarounds or failures in broader use cases.
Maintenance
Related MCP Connectors
Fetch US Bureau of Labor Statistics data — CPI, unemployment, wages, JOLTS, and more via MCP.
Macro data for AI agents: GDP, inflation, unemployment and more (World Bank, US BLS). No keys.
Macro data for AI agents: GDP, inflation, unemployment and more (World Bank, US BLS). No keys.
Econdata MCP — wraps BLS (Bureau of Labor Statistics) public API v2
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides access to comprehensive U.S. economic data including GDP, personal income, and regional statistics via the Bureau of Economic Analysis API. It enables users to query datasets and retrieve specific economic indicators for states, counties, and industries through natural language.2-
- FlicenseNot gradedqualityDmaintenanceProvides access to U.S. labor market data including employment statistics, Consumer Price Index inflation rates, and wage information. Users can query specific time series data or use shortcuts for common economic indicators like unemployment and industry-specific employment.3-
- AlicenseAqualityCmaintenanceEnables users to query U.S. labor statistics, including employment, CPI, and wages, directly from the Bureau of Labor Statistics Public Data API. It provides tools to retrieve real-time economic time series data, browse popular series, and access survey metadata through natural language.61MIT
- AlicenseNot gradedqualityCmaintenanceWraps the Bureau of Labor Statistics public API v2 to provide economic data through natural language queries or direct tool calls.6MIT