Fred Mcp Server

io.github.cyanheads由 GitHub 账号 cyanheads 发布v0.1.6更新于 Oct 24, 2026

Search and fetch ~800K Federal Reserve economic time-series from the FRED API via MCP.

已验证STDIO仅桌面金融数据与分析

概览

AI 生成的概览

让助手通过 FRED API 搜索并获取美联储经济时间序列,包括元数据、观测值、分类和发布信息。

可以做什么
通过 FRED API 提供八个工具:带筛选条件的序列全文搜索、最多 50 个 ID 的序列元数据查询、支持单位换算和频率降采样的日期区间观测值获取、分类树浏览,以及按 ID 或名称查找发布。多序列或较大的观测结果可写入 DataCanvas 表,用只读 DuckDB SQL 查询、查看来源与 TTL 信息,并可选删除。
适用场景
适合助手需要宏观经济数据进行分析、报告或研究的场景:利率、价格、就业、货币供应、住房、贸易和国际序列。当工作流需要可重复查询美联储官方数据而非临时网页检索时,值得添加。
运行要求
通过 npm 包在本地以 stdio 进程(或本地 Streamable HTTP 服务器)运行,需要 Bun v1.4.0+ 或 Node.js v24+,也可用 Docker。必须通过 FRED_API_KEY 提供免费的 FRED API 密钥,密钥限额为每分钟 120 次请求。DataCanvas SQL 查询需要设置 CANVAS_PROVIDER_TYPE=duckdb。需要访问 FRED API 的网络连接。
安装前请注意
FRED_API_KEY 是凭据,必须通过环境变量提供,不要写入共享配置。除非将 FRED_DATAFRAME_DROP_ENABLED 设为 true,否则删除数据框的工具处于禁用状态;启用后删除会提前清除暂存数据。可选的失败负载日志会记录工具参数和结果,且自由文本值中的机密不会被脱敏。序列查询会发送给第三方 FRED API。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Fred Mcp Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@cyanheads/federal-reserve-mcp-server

Search and fetch ~800K Federal Reserve economic time-series from the FRED API via MCP. STDIO or Streamable HTTP.

8 Tools


Overview

Economic data from FRED, the St. Louis Fed's database of ~800K time series on output, prices, employment, money, rates, housing, and trade. Search series, pull observations, browse categories and releases, and run SQL over large results.

Tools

ToolDescription
fedreserve_search_seriesFull-text search across FRED series titles, tags, and notes
fedreserve_get_seriesFetch metadata for one or more series — title, units, frequency, observation range
fedreserve_get_observationsFetch date+value observations for one or more series, with date-range and unit-transform filtering
fedreserve_browse_categoriesNavigate the FRED category tree
fedreserve_get_releaseLook up a FRED release by ID or name search, with its associated series
fedreserve_dataframe_describeList active DataCanvas dataframes with provenance, schema, and row count
fedreserve_dataframe_queryRun a SELECT against registered DataCanvas dataframes via DuckDB SQL
fedreserve_dataframe_dropDrop a DataCanvas dataframe by name (opt-in)

Capability reference

fedreserve_search_series tool

  • Full-text or series-ID search, with frequency, units, seasonal_adjustment, and tag_names filters; filter_variable and filter_value must be supplied together or the call returns invalid_filter
  • Pagination via limit (default and max 1000) and offset (max 4999; FRED caps searchable results at 5000)
  • Output includes active_filters and popularity (0–100) when available; empty results suggest a broader query or category browsing

fedreserve_get_series tool

  • Accepts one series ID or up to 50 per call
  • Returns title, units, frequency, seasonal adjustment, observation range, popularity, and notes per series
  • Failed IDs in a batch land in a failed array with error messages; a single unresolved ID throws series_not_found

fedreserve_get_observations tool

  • Accepts one series ID or up to 10, with observation_start / observation_end (YYYY-MM-DD), native unit transforms, and frequency downsampling via aggregation_method (avg, sum, eop)
  • Returns date/value observations (values are strings that keep trailing zeros) plus per-series failures
  • Multi-series or >500-row results go to a DataCanvas table with a 20-row preview; the notice names dataset.name and the fedreserve_dataframe_describe and fedreserve_dataframe_query calls to run next. Without canvas, you get a truncated inline preview

fedreserve_browse_categories tool

  • Omit category_id to start at the root (ID 0); returns the category and its children, or up to 10 sample series for a leaf
  • An unknown category_id throws category_not_found

fedreserve_get_release tool

  • Takes exactly one of release_id or release_search (case-insensitive name substring)
  • Returns release name, link, notes, the next five scheduled dates, and a paginated series list (series_limit max 1000, series_offset)
  • An ambiguous name returns up to 10 search_alternatives; retry with the exact release_id

fedreserve_dataframe_describe tool

  • Lists active DataCanvas dataframes, newest first, or one by name
  • Each entry carries source_tool, query_params, created_at, expires_at, row_count, truncated / max_rows, and column_schema

fedreserve_dataframe_query tool

  • Runs one read-only DuckDB SELECT against df_<id> tables (joins, aggregates, window functions, CTEs); external files, system catalogs, and engine-setting functions are blocked
  • row_limit caps returned rows (default 1000, max 10000) and preview sets the inline sample; BIGINT results serialize as strings
  • register_as saves the result as a new dataframe with its own TTL

fedreserve_dataframe_drop tool

  • Opt-in: enabled by FRED_DATAFRAME_DROP_ENABLED=true, otherwise registered as disabled
  • Drops the named dataframe early; returns dropped: false when it doesn't exist

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

FRED-specific:

  • Requires a FRED_API_KEY for the FRED API (up to 120 requests/minute)
  • Unit transforms and frequency downsampling run on FRED's side against the full series history
  • Large observation results spill to DataCanvas tables you can query with SQL
  • Dataframe tools require CANVAS_PROVIDER_TYPE=duckdb and report canvas_unavailable otherwise

Agent-friendly output:

  • Partial failures: fedreserve_get_series and fedreserve_get_observations return per-ID failed rows instead of failing the whole request
  • Ambiguous release names return search_alternatives instead of a guess
  • Every dataframe carries source_tool, query_params, and TTL fields
  • Without DataCanvas, fedreserve_get_observations returns a truncated inline preview with an explanatory message

Getting started

Add the following to your MCP client configuration file. Obtain a free FRED API key at research.stlouisfed.org/docs/api/api_key.html.

json
{  "mcpServers": {    "federal-reserve-mcp-server": {      "type": "stdio",      "command": "bunx",      "args": ["@cyanheads/federal-reserve-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "FRED_API_KEY": "your-api-key"      }    }  }}

Or with npx (no Bun required):

json
{  "mcpServers": {    "federal-reserve-mcp-server": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@cyanheads/federal-reserve-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "FRED_API_KEY": "your-api-key"      }    }  }}

Or with Docker:

json
{  "mcpServers": {    "federal-reserve-mcp-server": {      "type": "stdio",      "command": "docker",      "args": [        "run", "-i", "--rm",        "-e", "MCP_TRANSPORT_TYPE=stdio",        "-e", "FRED_API_KEY=your-api-key",        "ghcr.io/cyanheads/federal-reserve-mcp-server:latest"      ]    }  }}

For Streamable HTTP, set the transport and start the server:

sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 FRED_API_KEY=... bun run start:http# Server listens at http://localhost:3010/mcp

Prerequisites

Installation

  1. Clone the repository:
sh
git clone https://github.com/cyanheads/federal-reserve-mcp-server.git
  1. Navigate into the directory:
sh
cd federal-reserve-mcp-server
  1. Install dependencies:
sh
bun install
  1. Configure environment:
sh
cp .env.example .env# edit .env and set FRED_API_KEY

Configuration

All configuration is validated at startup via Zod schemas in src/config/server-config.ts.

VariableDescriptionDefault
FRED_API_KEYRequired. API key from stlouisfed.org.—
FRED_BASE_URLOverride the FRED API base URL.https://api.stlouisfed.org/fred
FRED_DATASET_TTL_SECONDSTTL for DataCanvas observation tables, in seconds.86400
FRED_DATAFRAME_DROP_ENABLEDSet true to enable fedreserve_dataframe_drop; otherwise registered as disabled.false
CANVAS_PROVIDER_TYPESet to duckdb to enable DataCanvas SQL querying for observation results.—
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_SESSION_MODEHTTP session mode: auto, stateful, or stateless.stateless
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424).info
LOGS_DIRDirectory for log files (Node.js only).<project-root>/logs
STORAGE_PROVIDER_TYPEStorage backend.in-memory
OTEL_ENABLEDEnable OpenTelemetry instrumentation.false
OTEL_EXPORTER_OTLP_ENDPOINTBase OTLP URL for traces (/v1/traces) and metrics (/v1/metrics).—
OTEL_EXPORTER_OTLP_LOGS_ENDPOINTOTLP log endpoint (logs are off unless set).—
LOG_TOOL_FAILURE_PAYLOADSLog failed tool arguments and results with key-name redaction; secrets in free-form values are not redacted.false
LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTESByte cap per logged payload.16384

See .env.example for the full list of optional overrides.

Set CANVAS_PROVIDER_TYPE=duckdb to enable SQL over observation tables. npm installs and Docker images include the DuckDB runtime. Portable Claude Desktop bundles omit native bindings; use the npm or Docker installation for canvas mode.

Running the server

Local development

  • Build and run:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:stdio# orbun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, securitybun run test       # Vitest test suitebun run lint:mcp   # Validate MCP definitions against spec

Docker

sh
docker build -t federal-reserve-mcp-server .docker run --rm -e FRED_API_KEY=your-key -e MCP_TRANSPORT_TYPE=http -p 3010:3010 federal-reserve-mcp-server

The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/federal-reserve-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools and inits services.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts). Eight tools across FRED domain and DataCanvas.
src/services/fredFRED API service — HTTP client, retry, 429 handling, key injection.
src/services/canvas-bridgeDataCanvas adapter — table naming, TTL/provenance tracking, SQL gate extras.
tests/Unit and integration tests mirroring src/.
docs/Design and planning documents.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools in src/mcp-server/tools/definitions/index.ts
  • Wrap FRED API calls: validate raw response → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

来源:README.md,提交 ae1a9b0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.6最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。