• AI Street
  • Posts
  • How to Hook AI to Real-Time Fed Data

How to Hook AI to Real-Time Fed Data

Hey, it’s Matt. This week on AI Street Markets:

⚙️ Connecting AI to Fed Data with MCP

Forwarded this? Subscribe here. Join readers from Bloomberg, JPMorgan, BlackRock & more.

DATA

Financial data is scattered.

You go to the SEC for company info, the Federal Reserve for macro data, or a county website for real estate transactions.

A new standard is starting to make data gathering a bit easier.

We talked about MCP a couple of weeks ago—Model Context Protocol—which connects to all these different portals. It’s been described as the USB-C of data access.

We used it to access stock data from Yahoo Finance.

This week, we’re using it to analyze Federal Reserve data with AI.

You can ask broad questions—about CPI, mortgage rates, or unemployment—and get linked results. It’s far easier than navigating the Fed’s site. What I like is you can stay high level and still get something useful. It’s a great brainstorming tool.

You can build a macro dashboard or recession indicators, like the one below. Click to view the full AI output.

SET UP

Here’s how to set up the MCP server. You’ll need to run a few terminal commands and have Node.js installed — no custom coding required, and the whole thing takes just a few minutes.

1. 📥 Clone the GitHub repository

Open a terminal and run:

git clone https://github.com/stefanoamorelli/fred-mcp-server.git
cd fred-mcp-server

You’re now inside the project folder. 

2. Install dependencies

This project uses pnpm (a fast package manager). If you don’t have it:

npm install -g pnpm

Then, inside the project folder:

pnpm install

This installs all required packages.

3. Build the TypeScript code

The source is in TypeScript, so compile it to JavaScript with:

pnpm build

This outputs the compiled files into a build/ folder. 

4. Get a FRED API key

5. Run the server manually (development)

Use the command:

FRED_API_KEY=your_key_here pnpm start

This sets the environment variable and starts the MCP server. Note: pnpm start runs the compiled build/index.js. 

6. Integrate with an MCP client (e.g., Claude Desktop)

To let an LLM-host like Claude Desktop use this server, add it to your MCP configuration file:

Edit claude_desktop_config.json (or your client’s file) and add:

"mcpServers": {
  "FRED MCP Server": {
    "command": "node",
    "args": [
      "/full/path/to/fred-mcp-server/build/index.js"
    ],
    "env": {
      "FRED_API_KEY": "your_key_here"
    }
  }
}

Replace /full/path/... and "your_key_here" accordingly. 

After this, reload or restart your client so it detects the server.

7. Verify it’s working

Once started, the client should list tools like:

  • RRPONTSYD

  • CPIAUCSL

  • MORTGAGE30US

  • T10Y2Y

These correspond to different FRED economic data series. You can run simple queries, for example:

CPIAUCSL {
  "start_date": "2020-01-01",
  "end_date": "2025-06-14",
  "limit": 10,
  "sort_order": "desc"
}

And you should get JSON with CPI data.

🧩 Quick Troubleshooting

Step

Checkpoint

What to do if it fails

pnpm install

Shows no errors

Re-run with --force; check Node.js version ≥16

pnpm build

Creates build/ folder

Look at TypeScript errors in the terminal

Starting server

Listens without crashing

Ensure FRED_API_KEY is set and correct

Client setup

Tools appear in client’s UI

Double-check path in config; restart the client app

Summary

  1. Clone the repo.

  2. pnpm install then pnpm build.

  3. Set your FRED API key (ENV).

  4. Run via pnpm start.

  5. Register with your MCP client (update config).

  6. Restart client and test fetching data.

PROMPTS

By connecting directly to Fed Data, it’s less likely that AI will hallucinate, but it still can make mistakes. The more precise the prompt, the more likely you’ll get accurate results. I often ask Claude to write a detailed prompt first, before answering the actual question.

Here’s the kind of prompt I use to push Claude to give structured, verifiable output — and reduce hallucinations:

Using fred_mcp-server, analyze U.S. economic stress indicators by pulling unemployment rates (UNRATE), credit card delinquency rates (DRCCLACBS), and high-yield bond spreads (BAMLH0A0HYM2) from January 2020 to present. Calculate the correlation coefficients between these three metrics and identify: (1) How current levels compare to pre-pandemic baselines (2019 averages), (2) Whether any metric is approaching recession-warning thresholds (unemployment >6%, credit card delinquencies >4%, high-yield spreads >500 basis points), and (3) The lead-lag relationships - which indicator typically moves first during economic stress. Present findings with specific data points and FRED source links. After doing the analysis, verify that the numbers are indeed accurate.

Here’s the result:

U.S. Economic Stress Indicators Analysis

Federal Reserve Economic Data (FRED) Analysis - June 2025

Executive Summary

Bottom Line: All three economic stress indicators remain below recession-warning thresholds, but credit card delinquencies and unemployment have risen moderately above pre-pandemic baselines while high-yield bond spreads remain compressed, suggesting selective economic stress rather than broad-based deterioration.

Current Levels vs. Warning Thresholds

Indicator

Current Level

Warning Threshold

Status

Unemployment Rate

4.2% (May 2025)

>6.0%

 SAFE

Credit Card Delinquency

3.05% (Q1 2025)

>4.0%

 SAFE

High Yield Bond Spread

3.17% (June 12, 2025)

>5.0%

 SAFE

Source: Bureau of Labor Statistics, Federal Reserve Board, ICE BofA

Comparison to Pre-Pandemic Baseline (2019 Averages)

2019 Baseline Averages

  • Unemployment Rate: 3.68%

  • Credit Card Delinquency: 2.58%

  • High Yield Bond Spread: 3.56%

Current vs. 2019 Baseline

  • Unemployment: +0.52 percentage points above baseline (14% higher)

  • Credit Card Delinquency: +0.46 percentage points above baseline (18% higher)

  • High Yield Spread: -0.39 percentage points below baseline (11% lower)

Correlation Analysis (2020-2025)

Key Correlation Coefficients:

  • Unemployment vs Credit Card Delinquency: -0.207 (weak negative)

  • Unemployment vs High Yield Spread: +0.652 (strong positive)

  • Credit Card Delinquency vs High Yield Spread: +0.035 (virtually no correlation)

Interpretation: High yield spreads show the strongest correlation with unemployment, making them the most reliable leading indicator during crisis periods. Credit card delinquencies operate independently and are heavily influenced by policy interventions.

Lead-Lag Relationships & Crisis Timing

2020 COVID Crisis Timeline:

  1. High Yield Spreads moved first (March 2020: spiked to ~10.87%)

  2. Unemployment followed (~1 month lag, April 2020: peaked at 14.8%)

  3. Credit Card Delinquencies were counterintuitive (decreased due to stimulus payments)

Ranking by Leading Indicator Strength:

  1. High Yield Bond Spreads - Lead during acute stress periods

  2. Unemployment Rate - Follows with 1-2 month lag during crises

  3. Credit Card Delinquencies - Most lagged, heavily influenced by policy

Recent Trend Analysis (2023-2025)

Pattern Observations:

  • Unemployment: Gradual increase from 3.5% to 4.2% (+0.7pp over 2 years)

  • Credit Card Delinquency: Steady rise from 2.47% to 3.05% (+0.58pp)

  • High Yield Spread: Significant compression from 4.42% to 2.73% (-1.69pp)

Current Economic Environment:

The divergence between rising unemployment/credit stress and tightening credit spreads suggests:

  • Financial markets remain optimistic about corporate credit quality

  • Consumer-level stress is emerging but not translating to corporate distress

  • Policy normalization effects are visible in labor markets

Key Data Verification

All figures verified against primary sources:

Historical Context & Risk Assessment

Stress Level Benchmarks:

  • Low Stress: Unemployment <4%, Credit Card Delinq <3%, HY Spread <4%

  • Moderate Stress: Unemployment 4-6%, Credit Card Delinq 3-4%, HY Spread 4-5%

  • High Stress: Unemployment >6%, Credit Card Delinq >4%, HY Spread >5%

Current Assessment: MODERATE STRESS in labor markets and consumer credit, LOW STRESS in corporate credit markets.

Notable Historical Episodes:

  • 2008 Financial Crisis: HY spreads peaked at 21.82%, unemployment reached 10.0%

  • 2020 COVID Crisis: Unemployment spiked to 14.8%, HY spreads hit 10.87%

  • Current Period: All indicators well below crisis levels

Investment & Policy Implications

For Monetary Policy:

  • Current levels provide no compelling case for emergency intervention

  • Gradual normalization appears appropriate given mixed signals

  • Labor market softening may warrant monitoring but not immediate action

For Credit Markets:

  • High yield spreads at historic lows suggest continued investor confidence

  • Credit card stress concentrated in consumer segment, not systemic

  • Corporate credit conditions remain favorable

Risk Monitoring Priorities:

  1. Watch for unemployment acceleration above 5% (would signal broader stress)

  2. Monitor credit card delinquency velocity - rapid increases more concerning than levels

  3. High yield spread expansion above 4% would signal shifting risk appetite

Methodology Notes

Data Sources:

  • Unemployment Rate (UNRATE): Monthly, seasonally adjusted

  • Credit Card Delinquency (DRCCLACBS): Quarterly, seasonally adjusted, 30+ days past due

  • High Yield Spread (BAMLH0A0HYM2): Daily, option-adjusted spread over Treasuries

Analysis Period: January 2020 - June 2025 Baseline Period: Calendar year 2019 averages Correlation Analysis: Quarterly data, Pearson correlation coefficients

Report compiled using Federal Reserve Economic Data (FRED) via MCP server Last Updated: June 15, 2025

TAKEAWAY

This setup isn’t perfect, but it’s a solid start if you want to run real macro questions through an AI. If you try it out (or break it), reach out: [email protected]

PROGRAMMING

AI Street Markets is published on the first and third Sundays of the month. The next edition will be out on July 6.

How did you like today's newsletter?

Login or Subscribe to participate in polls.

Reply

or to participate.