MCP-FREDAPI

MCP-FREDAPI

By Jaldekoa GitHub

FRED (Federal Reserve Economic Data) API integration with Model Context Protocol (MCP)

finance mcp
Overview

What is MCP-FREDAPI?

MCP-FREDAPI is an integration of the Federal Reserve Economic Data (FRED) API with the Model Context Protocol (MCP), allowing AI assistants to access economic time series data seamlessly.

How to use MCP-FREDAPI?

To use MCP-FREDAPI, install the package via pip or uv, configure your FRED API key in a .env file, and set up your MCP server configuration. You can then access economic data using commands in compatible environments like Cursor.

Key features of MCP-FREDAPI?

  • Access to a wide range of economic data from the FRED API.
  • Integration with AI assistants for real-time data retrieval.
  • Support for various parameters to customize data queries.

Use cases of MCP-FREDAPI?

  1. Retrieving GDP data for economic analysis.
  2. Accessing inflation rates for financial forecasting.
  3. Integrating economic data into AI-driven applications for enhanced decision-making.

FAQ from MCP-FREDAPI?

  • How do I obtain a FRED API key?

You can obtain a FRED API key from the official FRED API website.

  • What programming language is MCP-FREDAPI written in?

MCP-FREDAPI is written in Python.

  • Is MCP-FREDAPI free to use?

Yes, MCP-FREDAPI is free to use, but you need a FRED API key for access.

Content

MCP-FREDAPI

FRED (Federal Reserve Economic Data) API integration with Model Context Protocol (MCP)

Table of Contents

Introduction

MCP-FREDAPI provides access to economic data from the Federal Reserve Bank of St. Louis (FRED) through the Model Context Protocol. This integration allows AI assistants like Claude to retrieve economic time series data directly when used with Cursor or other MCP-compatible environments.

This package integrates with the official FRED API, focusing specifically on the series_observations endpoint which provides time series data for economic indicators.

Installation

There are two installation methods:

Method 1: Using pip

Install the required dependencies:

pip install "mcp[cli]" httpx python-dotenv

Clone this repository:

git clone https://github.com/Jaldekoa/mcp-fredapi.git
cd mcp-fredapi

This method is recommended as it matches the configuration shown in mcp.json.

  1. First, install uv if you don't have it yet:
pip install uv
  1. Clone this repository:
git clone https://github.com/Jaldekoa/mcp-fredapi.git
cd mcp-fredapi
  1. Use uv to run the server (no need to install dependencies separately):
uv run --with mcp --with httpx mcp run server.py

Configuration

FRED API Key

You'll need a FRED API key, which you can obtain from FRED API.

Create a .env file in the project root:

FRED_API_KEY=your_api_key_here

Claude/Cursor Configuration

To configure Cursor to use this MCP server, add the following to your ~/.cursor/mcp.json file:

{
  "mcpServers": {
    "mcp-fredapi": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-fredapi", "run", "--with", "mcp", "--with", "httpx", "mcp", "run", "server.py"]
    }
  }
}

Replace /path/to/mcp-fredapi with the actual path to the repository on your system. For example:

{
  "mcpServers": {
    "mcp-fredapi": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-fredapi", "run", "--with", "mcp", "--with", "httpx", "mcp", "run", "server.py"]
    }
  }
}

Note: On Windows, you can use either forward slashes / or double backslashes \\ in the path.

Available Tools

get_fred_series_observations

Retrieves economic time series observations from FRED.

When using Claude in Cursor, you can access this tool directly with:

@mcp-fredapi:get_fred_series_observations

Parameters

The get_fred_series_observations tool accepts the following parameters. For complete technical details about each parameter, please refer to the official FRED API documentation.

ParameterTypeDescriptionAllowed ValuesDefault ValueStatus
series_idstrThe ID of the economic series-(Required)✅ Works
sort_orderstrSort order of observations'asc', 'desc''asc'✅ Works
unitsstrData value transformation'lin', 'chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log''lin'✅ Works
frequencystrFrequency of observations'd', 'w', 'bw', 'm', 'q', 'sa', 'a', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem'None✅ Works
aggregation_methodstrAggregation method for frequency'avg', 'sum', 'eop''avg'✅ Works
output_typeintOutput type of observations1, 2, 3, 41✅ Works
realtime_startstrStart of real-time period (YYYY-MM-DD)-None❌ Not working
realtime_endstrEnd of real-time period (YYYY-MM-DD)-None❌ Not working
limitint/strMaximum number of observations to returnBetween 1 and 10000010❌ Not working
offsetint/strNumber of observations to skip from the beginning-0❌ Not working
observation_startstrStart date of observations (YYYY-MM-DD)-None❌ Not working
observation_endstrEnd date of observations (YYYY-MM-DD)-None❌ Not working
vintage_datesstrComma-separated list of vintage dates-None❌ Not working

WARNING

Note on Parameter Compatibility

Due to current limitations with the MCP implementation, only certain parameters are working properly:

  • Working parameters: series_id, sort_order, units, frequency , aggregation_method, and output_type`.
  • Non-working parameters: realtime_start, realtime_end, limit, offset, observation_start, observation_end, and vintage_dates.

For best results, stick with the working parameters in your queries. Future updates may resolve these limitations.

Examples

Getting US GDP Data

When using Claude in Cursor, you can ask for GDP data like this:

Can you get the latest GDP data from FRED?

@mcp-fredapi:get_fred_series_observations
{
  "series_id": "GDP"
}

Getting GDP Data in Descending Order

Can you get the GDP data in descending order (newest first)?

@mcp-fredapi:get_fred_series_observations
{
  "series_id": "GDP",
  "sort_order": "desc"
}

Getting Annual GDP Data

Can you get annual GDP data?

@mcp-fredapi:get_fred_series_observations
{
  "series_id": "GDP",
  "frequency": "a"
}

Getting Inflation Rate

To get consumer price index data with percent change:

What's the recent inflation rate in the US?

@mcp-fredapi:get_fred_series_observations
{
  "series_id": "CPIAUCSL",
  "units": "pch",
  "frequency": "m"
}

Different Output Format

Show me GDP data in a different format.

@mcp-fredapi:get_fred_series_observations
{
  "series_id": "GDP",
  "output_type": 2
}

Contributing

Contributions are welcome. Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add an amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

References

No tools information available.
School MCP
School MCP by 54yyyu

A Model Context Protocol (MCP) server for academic tools, integrating with Canvas and Gradescope platforms.

canvas mcp
View Details
repo-template
repo-template by loonghao

A Model Context Protocol (MCP) server for Python package intelligence, providing structured queries for PyPI packages and GitHub repositories. Features include dependency analysis, version tracking, and package metadata retrieval for LLM interactions.

-

google-calendar mcp
View Details
strava-mcp
strava-mcp by jeremysilva1098

MCP server for strava

strava mcp
View Details

Model Context Protocol (MCP) server implementation for Rhinoceros/Grasshopper integration, enabling AI models to interact with parametric design tools

grasshopper mcp
View Details

MCP configuration to connect AI agent to a Linux machine.

security mcp
View Details

AI assistant built with Streamlit, NVIDIA NIM (LLaMa 3.3:70B) / Ollama, and Model Control Protocol (MCP).

python mcp
View Details