MCP-FREDAPI provides access to economic data from the Federal Reserve Bank of St. Louis (FRED) through the Model Context Protocol. This integration enables AI assistants like Claude to retrieve economic time series data directly when used with Cursor or other MCP-compatible environments.
There are two ways to install and set up the MCP-FREDAPI server:
pip install "mcp[cli]" httpx python-dotenv
git clone https://github.com/Jaldekoa/mcp-fredapi.git
cd mcp-fredapi
pip install uv
git clone https://github.com/Jaldekoa/mcp-fredapi.git
cd mcp-fredapi
uv run --with mcp --with httpx mcp run server.py
.env
file in the project root:FRED_API_KEY=your_api_key_here
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.
This tool retrieves economic time series observations from FRED. When using Claude in Cursor, access this tool directly with:
@mcp-fredapi:get_fred_series_observations
The get_fred_series_observations
tool accepts the following parameters:
Parameter | Type | Description | Allowed Values | Default Value | Status |
---|---|---|---|---|---|
series_id | str | The ID of the economic series | - | (Required) | ✅ Works |
sort_order | str | Sort order of observations | 'asc', 'desc' | 'asc' | ✅ Works |
units | str | Data value transformation | 'lin', 'chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log' | 'lin' | ✅ Works |
frequency | str | Frequency of observations | 'd', 'w', 'bw', 'm', 'q', 'sa', 'a', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem' | None | ✅ Works |
aggregation_method | str | Aggregation method for frequency | 'avg', 'sum', 'eop' | 'avg' | ✅ Works |
output_type | int | Output type of observations | 1, 2, 3, 4 | 1 | ✅ Works |
Currently, only the parameters marked with ✅ are working properly. Other parameters (realtime_start, realtime_end, limit, offset, observation_start, observation_end, and vintage_dates) are not working.
@mcp-fredapi:get_fred_series_observations
{
"series_id": "GDP"
}
@mcp-fredapi:get_fred_series_observations
{
"series_id": "GDP",
"sort_order": "desc"
}
@mcp-fredapi:get_fred_series_observations
{
"series_id": "GDP",
"frequency": "a"
}
@mcp-fredapi:get_fred_series_observations
{
"series_id": "CPIAUCSL",
"units": "pch",
"frequency": "m"
}
@mcp-fredapi:get_fred_series_observations
{
"series_id": "GDP",
"output_type": 2
}
Here are some commonly used FRED economic data series:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.