@cyanheads/treasury-fiscaldata-mcp-server
Provides SQL analytics over DuckDB-backed DataCanvas dataframes materialized from Treasury Fiscal Data queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@cyanheads/treasury-fiscaldata-mcp-serverWhat is the current national debt?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Public Hosted Server: https://treasury-fiscaldata.caseyjhand.com/mcp
Tools
Five tools for querying the US Treasury Fiscal Data API, plus two for SQL analytics over DuckDB-backed DataCanvas dataframes:
Tool | Description |
| Browse the curated catalog of 17 Treasury Fiscal Data endpoints with field names, descriptions, and update cadence |
| Query any Treasury Fiscal Data endpoint by path, field list, filters, sort, and page — with optional DataCanvas spill |
| Fetch national debt (Debt to the Penny) — latest record, specific date, or date-range series with optional DataCanvas spill |
| Average interest rates Treasury pays on outstanding securities by type (Bills, Notes, Bonds, TIPS, FRN) |
| Official Treasury statutory exchange rates for ~130 countries, published quarterly |
| List DataCanvas dataframes materialized by the treasury_* tools with schema, row count, and TTL |
| Run a single-statement SELECT against DataCanvas dataframes using standard DuckDB SQL |
treasury_list_datasets
Browse the embedded catalog of available Treasury Fiscal Data endpoints. No network calls — serves from a static catalog bundled with the server.
Filter by category:
debt,interest_rates,exchange_rates,revenue_spending,savings_bonds,securities,otherKeyword search against dataset name and description (case-insensitive substring)
Returns endpoint paths, field names, types, and update cadence
Use this first to get the exact endpoint path and field names before calling
treasury_query_dataset
treasury_query_dataset
Generic parameterized query against any Treasury Fiscal Data endpoint.
Filter syntax:
{ field, operator, value }where operator iseq,gt,gte,lt,lte,inMultiple filters ANDed together
Pagination via
page_size(1–10000) andpage_numberSort by any field, descending with
-prefix (e.g.-record_date)All response values are strings per the API contract — including numeric and date fields;
"null"means no valuePass
canvas_idto register results into a named DataCanvas dataframe for SQL viatreasury_dataframe_query(requiresCANVAS_PROVIDER_TYPE=duckdb)
treasury_get_debt
Convenience tool for national debt (Debt to the Penny) — total public debt outstanding broken into publicly-held debt and intragovernmental holdings.
mode=latest— most recent business-day recordmode=date— specific business day (YYYY-MM-DD; API only records debt on market-open days)mode=series— date range, sorted newest-first; auto-spills to DataCanvas when the series exceeds 500 rowsRecords go back to 1993-01-04
treasury_get_interest_rates
Average interest rates the Treasury pays on outstanding securities. Updated monthly (end-of-month records).
Covers Bills, Notes, Bonds, TIPS, Floating Rate Notes (FRN), and aggregate marketable/non-marketable totals
mode=latest— most recent month's rates for all or one security typemode=series— time-range history; auto-spills to DataCanvas when results exceed 200 rows
treasury_get_exchange_rates
Official Treasury statutory reporting exchange rates for ~130 countries, published quarterly (March 31, June 30, Sep 30, Dec 31).
Rate expressed as foreign currency units per 1 USD (e.g. Japan-Yen 159.41 means 1 USD = 159.41 JPY)
These are not market exchange rates — required by US federal agencies for foreign-currency-to-USD conversions in official reporting
Filter to one or more countries by exact name; omit for all ~130 countries in a quarter
mode=seriesauto-spills to DataCanvas when results exceed 500 rows (~18,800 rows full history)
treasury_dataframe_describe / treasury_dataframe_query
In-conversation SQL analytics over the dataframes that treasury_query_dataset, treasury_get_debt, treasury_get_interest_rates, and treasury_get_exchange_rates materialize on a shared DuckDB-backed DataCanvas. Each data-returning call with canvas_id adds a df_XXXXX_XXXXX handle; pass that handle to treasury_dataframe_query for joins, aggregates, window functions, and CTEs — standard DuckDB SQL.
Read-only. Writes, DDL, DROP, COPY, PRAGMA, ATTACH, and external-file table functions are rejected by the SQL gate. System catalogs (
information_schema,pg_catalog,sqlite_master,duckdb_*) are denied at the bridge layer.All Treasury columns are VARCHAR. CAST to
DECIMALorDATEfor arithmetic and date comparisons.register_aschaining.treasury_dataframe_querycan persist its result as a new dataframe with a fresh TTL for multi-step analysis.Per-table TTL. Dataframes age on their own clock (default 24h, override with
CANVAS_TTL_MS).Requires
CANVAS_PROVIDER_TYPE=duckdb.
Related MCP server: treasury-fiscaldata-mcp
Features
Built on @cyanheads/mcp-ts-core:
Declarative tool definitions — single file per tool, framework handles registration and validation
Structured output schemas with automatic formatting for human-readable display
Unified error handling — handlers throw, framework catches, classifies, and formats
Pluggable auth:
none,jwt,oauthStructured logging with request-scoped context
STDIO and Streamable HTTP transports
Treasury-specific:
Curated catalog of 17 Treasury Fiscal Data endpoints with field metadata — no discovery round-trip required. Pass any endpoint path directly to
treasury_query_datasetto access datasets not in the catalog.Convenience tools for the three most-queried datasets (national debt, interest rates, exchange rates)
Full generic access to any Fiscal Data endpoint via
treasury_query_datasetDataCanvas integration: large time-series pulls register as
df_<id>dataframes queryable via DuckDB SQLNo API keys required — the US Treasury Fiscal Data API is free and public
Agent-friendly output:
Filter expression echo (
applied_filters) so agents can verify what was sent to the APIField-label maps on query results (
field_labels) map raw field names to human-readable labelsEnrichment notices on empty results and partial-country mismatches guide the next tool call
Canvas provenance: source tool, original query parameters, row count, and column schema surfaced by
treasury_dataframe_describe
Getting started
Public Hosted Instance
A public instance is available at https://treasury-fiscaldata.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"treasury-fiscaldata-mcp-server": {
"type": "streamable-http",
"url": "https://treasury-fiscaldata.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"treasury-fiscaldata-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/treasury-fiscaldata-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"treasury-fiscaldata-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/treasury-fiscaldata-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"treasury-fiscaldata-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/treasury-fiscaldata-mcp-server:latest"
]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpDataCanvas SQL workflow
For large time-series pulls or multi-dataset analysis, use the DataCanvas SQL workflow:
Set
CANVAS_PROVIDER_TYPE=duckdbin your server environment.Call a data tool with a
canvas_id— e.g.,treasury_get_debtwithmode=seriesand acanvas_idvalue, ortreasury_query_datasetwithcanvas_id. The tool registers the results as adf_XXXXX_XXXXXdataframe and returns the table name.Inspect the schema with
treasury_dataframe_describe— lists column names, types (all VARCHAR for Treasury data), row count, and TTL.Query with SQL via
treasury_dataframe_query— standard DuckDB SELECT with joins, aggregates, window functions, and CTEs. CAST VARCHAR columns to DECIMAL or DATE for arithmetic.
-- Example: debt trend over the last year, month-end records only
SELECT
record_date,
CAST(tot_pub_debt_out_amt AS DECIMAL) / 1e12 AS total_debt_trillions
FROM df_xxxxx
WHERE CAST(record_date AS DATE) >= CURRENT_DATE - INTERVAL 1 YEAR
ORDER BY record_date DESCPrerequisites
Bun v1.3.0 or higher (or Node.js v24+).
No API key required — the US Treasury Fiscal Data API is free and public.
For DataCanvas SQL:
CANVAS_PROVIDER_TYPE=duckdb(DuckDB is bundled as@duckdb/node-api).
Installation
Clone the repository:
git clone https://github.com/cyanheads/treasury-fiscaldata-mcp-server.gitNavigate into the directory:
cd treasury-fiscaldata-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# edit .env as needed — no required vars; CANVAS_PROVIDER_TYPE=duckdb to enable SQLConfiguration
Variable | Description | Default |
| Canvas engine. Set to |
|
| Per-table TTL for DataCanvas dataframes in milliseconds. |
|
| Transport: |
|
| Port for HTTP server. |
|
| Auth mode: |
|
| Log level ( |
|
| Directory for log files (Node.js/Bun only). |
|
| Enable OpenTelemetry spans and metrics. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
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
Docker
docker build -t treasury-fiscaldata-mcp-server .
docker run --rm -e CANVAS_PROVIDER_TYPE=duckdb -p 3010:3010 treasury-fiscaldata-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/treasury-fiscaldata-mcp-server. DuckDB native modules are pre-built in the build stage and copied to the production stage — no extra build tools required at runtime. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| Treasury Fiscal Data API client, embedded endpoint catalog, and types. |
| Adapter over the framework DataCanvas: |
| Unit and integration tests mirroring |
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 logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageAll 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 and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityAmaintenanceAccess FEC campaign finance data through MCP. Query data about candidates, money trails, and election filings. STDIO & Streamable HTTP.Last updated1,0492Apache 2.0
- Alicense-qualityCmaintenanceEnables querying U.S. Treasury fiscal data including debt, interest rates, auctions, and more via natural language, with no API key required.Last updatedMIT
- Alicense-qualityCmaintenanceEnables querying US Treasury Fiscal Data through the Treasury Fiscal Data API, providing access to financial data such as debt, spending, and revenue.Last updated15MIT
- Alicense-qualityAmaintenanceBrowse and query the U.S. Energy Information Administration API v2 — electricity, petroleum, natural gas, coal, forecasts, and more via MCP. STDIO or Streamable HTTP.Last updated481Apache 2.0
Related MCP Connectors
Query SEC EDGAR filings, XBRL financials, and company data through MCP. STDIO & Streamable HTTP.
Treasury MCP — US Treasury Fiscal Data public API (free, no auth)
Treasury Fiscal MCP — US Treasury Fiscal Data API
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/treasury-fiscaldata-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server