Treasury Fiscaldata Mcp Server
БесплатноПоддерживаетсяMCP server for US Treasury Fiscal Data — national debt, interest rates, exchange rates, and federal revenue/spending.
Описание
MCP server for US Treasury Fiscal Data — national debt, interest rates, exchange rates, and federal revenue/spending.
README
@cyanheads/treasury-fiscaldata-mcp-server
Query US Treasury national debt, interest rates, exchange rates, and fiscal datasets via MCP.
Public Hosted Server: https://treasury-fiscaldata.caseyjhand.com/mcp
Overview
US Treasury Fiscal Data: the national debt, interest rates, exchange rates, and other federal fiscal datasets. Pull the headline numbers in one call, query any Fiscal Data endpoint directly, and run SQL over large pulls.
Tools
| Tool | Description |
|---|---|
treasury_list_datasets |
Browse the curated catalog of 17 Treasury Fiscal Data endpoints with field names, descriptions, and update cadence |
treasury_query_dataset |
Query any Treasury Fiscal Data endpoint by path, field list, filters, sort, and page — with optional DataCanvas spill |
treasury_get_debt |
Fetch national debt (Debt to the Penny) — latest record, specific date, or date-range series with optional DataCanvas spill |
treasury_get_interest_rates |
Average interest rates Treasury pays on outstanding securities by type — marketable issues, non-marketable series, and aggregate totals |
treasury_get_exchange_rates |
Official Treasury statutory exchange rates for ~165 countries, published quarterly |
treasury_dataframe_describe |
List DataCanvas dataframes materialized by the treasury_* tools with schema, row count, and TTL |
treasury_dataframe_query |
Run a single-statement SELECT against DataCanvas dataframes using standard DuckDB SQL |
treasury_dataframe_drop |
Delete a staged dataframe and its provenance (disabled unless TREASURY_DATAFRAME_DROP_ENABLED=true) |
Capability reference
treasury_list_datasets tool
- Filter by category (
debt,interest_rates,exchange_rates,revenue_spending,savings_bonds,securities,other) or keyword search. - Returns endpoint paths, fields, types, and update cadence from a bundled catalog, with no network call.
treasury_query_dataset tool
- Query an endpoint with
{ field, operator, value }filters (eq,gt,gte,lt,lte,in), sort, and pagination:page_size1–10000 (default 100),page_numberstarts at 1. - Returns rows, field labels,
total_count, andtotal_pages; afieldsselection returns distinct rows, and the counts count those. Error reasons areinvalid_endpoint,invalid_field,invalid_filter,sort_field_not_selected, andpage_out_of_range. - Pass
canvas_idto stage the page for SQL analysis; the returnedcanvas_idis the assigned table name.
treasury_get_debt tool
mode=latestreturns the newest business-day record;mode=dateaccepts a YYYY-MM-DD date;mode=seriesaccepts a date range. Coverage begins 1993-04-01.- Returns debt totals and a 20-row series preview; compare
retrieved_recordswithtotal_records. A missing date returnsno_data_for_date. - Series staging starts above 500 rows or on request via
canvas_id; paging stops at 50,000 rows.
treasury_get_interest_rates tool
mode=latestreturns the newest month's rates, optionally filtered bysecurity_type;mode=seriesaccepts a date range.- Rates are percentages, with available security types disclosed when a filter matches nothing; the series preview holds at most 20 rows.
- Series staging starts above 200 rows or on request via
canvas_id.
treasury_get_exchange_rates tool
- Quarterly official reporting rates in foreign currency units per 1 USD. Filter
countriesby exact name;mode=latestreturns one current row per currency andmode=seriesaccepts a date range. - Each row carries
record_dateandeffective_date;mixed_record_datesflags a result spanning quarters. Series previews hold 20 rows;retrieved_recordsdiscloses progress againsttotal_records. - Series staging starts above 500 rows or on request via
canvas_id; paging stops at 50,000 rows. country_not_founderror when a requested country has no records
treasury_dataframe_describe tool
- Omit
nameto list the tenant's active dataframes, or supply one exact table name. - Returns provenance, created/expiry timestamps, row count, and column schema;
truncated/max_rowsdisclose a capped source pull. - Table expiry defaults to 24h after staging, configurable with
CANVAS_TTL_MS. Queries do not extend it, and a server restart or the shared canvas reaching its maximum lifetime (CANVAS_ABSOLUTE_CAP_MS, default 7 days) can remove a table sooner; describe lists only tables still on the canvas.
treasury_dataframe_query tool
- Accepts one read-only SELECT;
row_limitdefaults to 1000 (max 10000) andpreviewmay not exceed it. System catalogs, external-file functions, and SQL mutations are denied. - Returns rows and
row_count_capped; errors distinguishcanvas_unavailable,system_catalog_access,invalid_sql,missing_table, andinvalid_query_bounds. register_asmaterializes the full result as a new dataframe with a fresh TTL. A name the system-catalog deny would refuse in SQL (duckdb_tables,pg_class, …) is refused withsystem_catalog_accessbefore anything is staged.
treasury_dataframe_drop tool
- Accepts the exact
namefromtreasury_dataframe_describe, a data tool'scanvas_id, or query'sregistered_as; deletes that table and its provenance for the tenant. - Returns
nameanddropped: true; an absent or expired table returnsmissing_tablewith guidance to list active tables. - Disabled by default. Set
TREASURY_DATAFRAME_DROP_ENABLED=trueandCANVAS_PROVIDER_TYPE=duckdbto make it callable; the HTTP landing page shows the disabled tool and enable hint otherwise.
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.
Fiscal Data-specific:
- All API values are strings;
"null"means no value. Columns staged from Treasury API rows are VARCHAR — CAST to DECIMAL or DATE for arithmetic and date comparisons; aregister_astable keeps the types its SELECT produced. DataCanvas requiresCANVAS_PROVIDER_TYPE=duckdb; configured canvas tools reportcanvas_unavailableotherwise. - A filter value cannot contain a comma — the API reads one as the start of another condition — so every tool refuses it as
invalid_filterbefore sending. The three convenience tools reportupstream_schema_changedwhen the API renames or drops a field they read. - Curated catalog of 17 endpoints with field metadata — no discovery round-trip required; pass any endpoint path directly to
treasury_query_datasetfor datasets outside the catalog - Convenience tools for the three most-queried datasets — national debt, interest rates, exchange rates
- DataCanvas integration: large pulls register as
df_<id>dataframes queryable via DuckDB SQL, with automatic staging thresholds per tool - No API key required — the US Treasury Fiscal Data API is free and public
Agent-friendly output:
- Provenance: filter-expression echo (
applied_filters) and field-label maps (field_labels) let agents verify what was sent and read raw field names - Enrichment notices: empty-result guidance, partial-country mismatches, canvas staging confirmations, and truncated-series warnings all name the next tool call
- Graceful truncation: series and query results carry
truncated/retrieved_records/row_count_cappedfields instead of silently dropping rows - Canvas provenance: source tool, original query parameters, row count, and column schema surfaced by
treasury_dataframe_describe
Getting started
Connect Claude Code to the public instance:
claude mcp add --transport http treasury-fiscaldata-mcp-server https://treasury-fiscaldata.caseyjhand.com/mcp
Or run it locally:
claude mcp add treasury-fiscaldata-mcp-server -- npx -y @cyanheads/treasury-fiscaldata-mcp-server
For other MCP clients:
{
"mcpServers": {
"treasury-fiscaldata-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/treasury-fiscaldata-mcp-server"]
}
}
}
No API key is required. DataCanvas is enabled by default in npm and Docker installs; CANVAS_PROVIDER_TYPE=none disables it. The portable Claude Desktop .mcpb bundle omits DuckDB native bindings and supports Treasury API queries with DataCanvas disabled. For Docker or a source build, see Running the server.
Configuration
| Variable | Description | Default |
|---|---|---|
CANVAS_PROVIDER_TYPE |
duckdb backs dataframe describe/query, and drop when enabled. With none, callable canvas tools return canvas_unavailable; drop stays off the tool list unless separately enabled. |
duckdb (none in the desktop bundle) |
CANVAS_TTL_MS |
Lifetime of each staged DataCanvas dataframe in milliseconds, fixed at staging. Also the shared canvas's idle TTL, so startup fails when it exceeds CANVAS_ABSOLUTE_CAP_MS (default 7 days). |
86400000 (24h) |
TREASURY_DATAFRAME_DROP_ENABLED |
Register treasury_dataframe_drop as callable. Also requires CANVAS_PROVIDER_TYPE=duckdb. |
false |
MCP_TRANSPORT_TYPE |
Transport: stdio or http. |
stdio |
MCP_HTTP_PORT |
Port for HTTP server. | 3010 |
MCP_SESSION_MODE |
HTTP session handling: auto, stateful, or stateless. Setting it overrides the server's own declaration; leaving it unset falls through to that declaration, not to the schema default. |
stateless (declared in src/index.ts) |
MCP_AUTH_MODE |
Auth mode: none, jwt, or oauth. |
none |
MCP_LOG_LEVEL |
Log level (debug, info, notice, warning, error). |
info |
LOGS_DIR |
Directory for log files (Node.js/Bun only). A relative path resolves against the server's own package directory. | <package-root>/logs |
LOG_TOOL_FAILURE_PAYLOADS |
Log failed-call arguments and results, redacted by key name. Secrets inside free-form values are not redacted. | false |
LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES |
Byte cap for each logged failed-call payload. | 16384 |
OTEL_ENABLED |
Enable OpenTelemetry spans and metrics. | false |
OTEL_EXPORTER_OTLP_ENDPOINT |
Base OTLP endpoint for traces and metrics. | Unset |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT |
Explicit OTLP log endpoint; the base endpoint does not enable log export. | Unset |
See .env.example for the full list of optional overrides.
Running the server
Local development
Requires Bun v1.4.4 or higher to build; the installed server also runs on Node.js v24+.
git clone https://github.com/cyanheads/treasury-fiscaldata-mcp-server.git
cd treasury-fiscaldata-mcp-server && bun install
cp .env.example .env
Build and run:
bun run rebuild bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec bun run lint:deps # Detect unused and missing dependencies with Knip bun run verify:catalog # Probe every catalog endpoint and field against the live APIverify:catalogmakes live Fiscal Data requests and runs separately fromdevcheckand the test suite. Run it after editingsrc/services/fiscal-data/datasets.tsand before a release.Builds type-check and emit declarations with TypeScript, then use Bun to bundle server code as Node-compatible ESM in
dist/index.js. Package dependencies remain external, including the framework and DuckDB native bindings. The installed server runs on Node or Bun; building from source requires Bun. Dependency checks useknip.jsoncto cover source, scripts, and tests.
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/treasury-fiscaldata-mcp-server:latest
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/treasury-fiscaldata-mcp-server. A native build-host dependency stage cross-installs DuckDB bindings for the target architecture, preserves the release-age and security checks, and removes unused musl bindings. OpenTelemetry peers are installed at the framework's declared ranges — build with --build-arg OTEL_ENABLED=false to omit them.
To build locally, run docker build -t treasury-fiscaldata-mcp-server .. For stdio, use docker run -i --rm -e MCP_TRANSPORT_TYPE=stdio ghcr.io/cyanheads/treasury-fiscaldata-mcp-server:latest as the MCP client's launch command.
DataCanvas SQL workflow
Use the hosted endpoint, npm, or Docker for dataframe staging and SQL. Pass canvas_id to a data tool to stage its results, then use the returned minted df_<id> table identifier with treasury_dataframe_describe and treasury_dataframe_query. Treasury columns are VARCHAR: cast numeric and date columns before arithmetic, comparisons, or date operations. The input canvas_id enables staging; it does not name the output table.
Project structure
| Directory | Purpose |
|---|---|
src/index.ts |
createApp() entry point — registers tools and inits services. |
src/config/ |
Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools/definitions/ |
Tool definitions (*.tool.ts) — 5 data tools + 3 DataCanvas tools, including opt-in drop. |
src/mcp-server/tools/markdown-encoding.ts |
Encoders that keep table cells, code spans, and notices intact through a Markdown parse. |
src/mcp-server/tools/endpoint-fetcher.ts |
The per-call request function the three convenience tools send every request through: one fetch budget, their own rejection reasons, and a check that each answer still lists the fields they read. |
src/services/fiscal-data/ |
Treasury Fiscal Data API client, embedded endpoint catalog, and types. |
src/services/canvas-bridge/ |
Adapter over the framework DataCanvas: one shared canvas per tenant, df_<id> minting, fixed per-table expiry, register_as catalog-name refusal. |
tests/ |
Unit and integration tests mirroring src/. |
Development guide
See CLAUDE.md and AGENTS.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storage - All Treasury API values are strings — validate and CAST in downstream SQL; never fabricate missing fields
- Register new tools via the arrays in
src/index.ts
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.
Установить Treasury Fiscaldata Mcp Server в Claude Desktop, Claude Code, Cursor
unyly install treasury-fiscaldata-mcp-serverСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add treasury-fiscaldata-mcp-server --env MCP_LOG_LEVEL="" --env MCP_TRANSPORT_TYPE="" -- npx -y @cyanheads/treasury-fiscaldata-mcp-serverПошаговые гайды: как установить Treasury Fiscaldata Mcp Server
FAQ
Treasury Fiscaldata Mcp Server MCP бесплатный?
Да, Treasury Fiscaldata Mcp Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Treasury Fiscaldata Mcp Server?
Да, требуются переменные окружения: MCP_LOG_LEVEL, MCP_TRANSPORT_TYPE. Unyly подставит их в конфиг при установке.
Treasury Fiscaldata Mcp Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Treasury Fiscaldata Mcp Server в Claude Desktop, Claude Code или Cursor?
Открой Treasury Fiscaldata Mcp Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Изменения
Версии и запрашиваемые доступы со временем.
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
- Новая версия опубликована
Похожие MCP
Opencode Omniroute Plugin
OpenCode plugin for the OmniRoute AI Gateway. Drives dynamic model discovery, /connect auth flow, and multi-instance OmniRoute providers via the official @openc
автор: GitHub ActionsRoblox Studio
Enables AI coding tools to control Roblox Studio for workspace exploration, instance manipulation, and script management. It provides tools for playtesting, sce
автор: paralovAntigravity Drawio
MCP server that enables AI assistants to create, parse, render, and validate Draw.io diagrams programmatically.
автор: S-SUJAN-SFetch
Web content fetching and conversion for efficient LLM usage.
Mcp
ModelContextProtocol server for enhancing JSON Resumes
автор: mcpflow.ioVault
Bitwarden/Vaultwarden MCP server — BYOK vault access with 6 tools, Send-based reveal, TOTP, and safe agent-write
автор: agbergsmannAWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
автор: lastmile-aiCompare Treasury Fiscaldata Mcp Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
