fred mcp server

Local 2025-09-01 00:50:29 0

A Model Context Protocol server that provides tools to search and retrieve economic data series from the Federal Reserve Economic Data (FRED) API.


Here's the README formatted in proper markdown:

A Model Context Protocol (MCP) server implementation for accessing the Federal Reserve Economic Data (FRED) API. This server provides tools to search and retrieve economic data series from FRED.

Prerequisites

  • Node.js (v16 or higher)
  • FRED API Key (obtain from FRED API)

Installation

  1. Clone the repository:

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

  2. Install dependencies:

    npm install

  3. Copy the .env.example file to .env and add your FRED API key:

    FRED_API_KEY=your_api_key_here

Usage

Development

Run the server in development mode:

npm run dev

Production

  1. Build the project:

    npm run build

  2. Start the server:

    npm start

Available Tools

The server provides the following FRED API tools:

Search for economic data series using various parameters.

Series Observations

Retrieve observations for a specific economic data series with options for: - Date range filtering - Frequency adjustment - Aggregation methods - Sorting and pagination

Development

Project Structure

fred-mcp-server/
├── src/
│   ├── index.ts      # Server entry point
│   ├── tools.ts      # Tool implementations
│   └── types.ts      # TypeScript interfaces
├── package.json
├── tsconfig.json
└── .env

Testing

Run the test suite:

npm test

License

[Your chosen license]

Contributing

[Your contribution guidelines]

Acknowledgments

[
  {
    "description": "Search for FRED data series with advanced filtering options",
    "inputSchema": {
      "properties": {
        "excludeTagNames": {
          "description": "Series tags to exclude",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "filterValue": {
          "description": "Value of filter variable",
          "type": "string"
        },
        "filterVariable": {
          "description": "Variable to filter results by",
          "type": "string"
        },
        "limit": {
          "description": "Maximum number of results to return (default: 1000)",
          "type": "number"
        },
        "orderBy": {
          "description": "Order results by this property",
          "enum": [
            "searchrank",
            "series_id",
            "title",
            "units",
            "frequency",
            "seasonal_adjustment",
            "realtime_start",
            "realtime_end",
            "last_updated",
            "observation_start",
            "observation_end",
            "popularity"
          ],
          "type": "string"
        },
        "searchText": {
          "description": "Search text for FRED series",
          "type": "string"
        },
        "sortOrder": {
          "description": "Sort order (default: asc)",
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        },
        "tagNames": {
          "description": "Series tags to include",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "searchText"
      ],
      "type": "object"
    },
    "name": "search"
  },
  {
    "description": "Get observations for a specific FRED data series with advanced options",
    "inputSchema": {
      "properties": {
        "aggregationMethod": {
          "description": "Aggregation method for frequency conversion (avg=average, sum=sum, eop=end of period)",
          "enum": [
            "avg",
            "sum",
            "eop"
          ],
          "type": "string"
        },
        "endDate": {
          "description": "End date in YYYY-MM-DD format",
          "type": "string"
        },
        "frequency": {
          "description": "Frequency of observations (d=daily, w=weekly, bw=biweekly, m=monthly, q=quarterly, sa=semiannual, a=annual)",
          "enum": [
            "d",
            "w",
            "bw",
            "m",
            "q",
            "sa",
            "a"
          ],
          "type": "string"
        },
        "limit": {
          "description": "Maximum number of results to return",
          "type": "number"
        },
        "offset": {
          "description": "Number of results to skip",
          "type": "number"
        },
        "outputType": {
          "description": "1=observations by real-time period, 2=observations by vintage date, 3=vintage dates, 4=initial release plus current value",
          "enum": [
            1,
            2,
            3,
            4
          ],
          "type": "number"
        },
        "seriesId": {
          "description": "FRED series ID",
          "type": "string"
        },
        "sortOrder": {
          "description": "Sort order (default: asc)",
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        },
        "startDate": {
          "description": "Start date in YYYY-MM-DD format",
          "type": "string"
        },
        "vintageDates": {
          "description": "Vintage dates in YYYY-MM-DD format",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "seriesId"
      ],
      "type": "object"
    },
    "name": "series"
  }
]