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
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
Quick Start
Installation
Option 1: Using UV (Recommended - 10x faster!)
See UV_USAGE.md for comprehensive UV documentation.
Option 2: Using pip (Traditional)
Running the Server (Local)
Testing with MCP Inspector
Project 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:
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:
Example Response:
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
Data 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
Code Quality
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):
Contributing
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.