Chat-based .NET solution for answering questions about U.S. public debt using only the U.S. Treasury Debt to the Penny dataset.
- Dataset page: https://fiscaldata.treasury.gov/datasets/debt-to-the-penny/debt-to-the-penny
- API endpoint: https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny
Provide concise, factual answers about U.S. debt in a console chat experience, with short-term in-memory conversation context, and strict data/tool boundaries.
The design target is:
- Exactly 2 MCP tools available to the LLM:
get_current_dateget_us_debt
get_us_debtis the only allowed data retrieval mechanism for debt values.- No external datasets or APIs beyond Treasury Debt to the Penny.
- Out-of-scope questions should return a clear boundary response (for example: "I don’t have expertise in that area.").
- Missing/unsupported periods must be handled explicitly (for example: "I don’t have data for that period.").
Screen.Recording.2026-03-02.103716.mp4
Debt.ConsoleClient/— Console chat application (LLM interaction and session flow).Debt.MCPServer/— MCP server exposing debt/date tools and integrating with Treasury API.Debt.Aspire/— .NET Aspire app host for local orchestration.Debt.Universal/— Shared/public API, service defaults, and reusable modules.Tests/— Unit and integration tests.
Main solution file: snowcoreUSDebt.slnx
Current MCP tools exposed by Debt.MCPServer:
-
get_current_date- Returns current UTC date formatted as
yyyy-MM-dd.
- Returns current UTC date formatted as
-
get_us_debt- Purpose: fetch debt rows from Treasury Debt to the Penny API.
- Parameters:
filter(string, optional) — API filter expression, e.g.record_date:gte:2026-01-01sort(string, optional) — sort expression, e.g.-record_datepage_size(int, optional) — page sizepage_number(int, optional) — page number
- Windows, macOS, or Linux with terminal access
- .NET SDK 10 (projects target
net10.0) - Docker or Podman (required for container-based Aspire dependencies)
- GitHub Copilot CLI installed and authenticated
- GitHub Copilot Pro subscription if usage limits are hit (sufficient for
gpt-5-miniwith active subscription) - .NET Aspire workload/tools for AppHost workflows (there's an option to launch projects individually, which doesn't require .NET Aspire-related setup)
- Internet access to call Treasury Fiscal Data API
Use these commands if you plan to run the AppHost (Debt.Aspire) locally.
- Check installed SDKs:
dotnet --list-sdks- Install Aspire workload:
dotnet workload install aspire- Verify installed workloads:
dotnet workload list- (Optional) update workloads:
dotnet workload updateNotes:
- If you only run projects individually (
Debt.MCPServer,Debt.ConsoleClient), Aspire workload is not required. - If HTTPS development certificates are missing/untrusted, run:
dotnet dev-certs https --trustThe repository was established on the following environment:
- OS:
Windows 11 24H2, Build 26100.7840 - Runtime target:
net10.0 - IDE: Visual Studio Code
1.109.5 - Container runtime used during development: Podman
1.23.1
If you test on another environment, please update this section with your validated setup.
From repository root:
- Restore:
dotnet restore snowcoreUSDebt.slnx- Build:
dotnet build snowcoreUSDebt.slnxOpen the solution in your IDE, right-click the Debt.Aspire project, then choose Debug -> Start New Instance.
This starts the MCP server and console client together under the AppHost orchestration.
Start MCP server:
dotnet run --project Debt.MCPServerThen start console client in a second terminal:
dotnet run --project Debt.ConsoleClientInternal service-to-service communication uses Aspire service discovery instead of hardcoded host/port URLs.
Debt.ConsoleClientreferences the MCP server by service name (debt-mcp-server), not by direct localhost URL.Debt.Aspireorchestrates resources and service references, and runtime endpoints are resolved automatically.- Actual network addresses are environment/runtime-resolved and can change between runs/environments without code changes.
Note: direct external endpoint configuration is still used for third-party APIs (for example, Treasury Debt to the Penny) inside the MCP server.
dotnet test snowcoreUSDebt.slnxAI analysis and behavior assets are documented in:
.ai/README.md.ai/spec.md.ai/prompts/system.md.ai/tools/mcp-tools.md.ai/evals/test-cases.md
Debt.ConsoleClient uses an LLM through an abstraction layer so the provider can be replaced without changing chat screen logic.
- LLM abstraction contracts:
ILlmClient(client lifecycle + session creation)ILlmSession(send prompt + receive session events)
- Current implementation:
CopilotLlmClient(GitHub Copilot SDK)- Model currently configured:
gpt-5-mini
- Tool usage:
- MCP tools discovered from
Debt.MCPServerare attached to the LLM session and used for debt/date retrieval.
- MCP tools discovered from
- Auth/config:
- GitHub token is read from environment variable
GH_TOKEN. - GitHub Copilot CLI must be available and signed in.
- If account usage limits are reached, use a GitHub Copilot Pro subscription; for this project,
gpt-5-miniis expected to work with an active subscription without consuming usage limits.
- GitHub token is read from environment variable
This design keeps the app flexible for future model/provider changes while preserving the same chat workflow.
Expected chat behaviors for this project:
- Supports debt lookups for specific periods when available in Treasury data.
- Supports analytical comparisons derived from dataset values (differences/growth/trends).
- Maintains memory only for the current process/session (RAM only; no persistence).
- Returns explicit messages when data is unavailable or outside supported period.
- Avoids speculation and filler; answers should remain concise and factual.
Dependency license/copyright information is documented in:
THIRD-PARTY-NOTICES.md
Use these prompts in Debt.ConsoleClient to validate expected behavior.
- What was the U.S. debt in 2008?
- How much did the debt increase in 2024?
- What is the current U.S. debt?
- Compare U.S. debt between 2019 and 2020. Give absolute increase and percentage change.
- What was the month-over-month debt change from 2024-01-31 to 2024-02-29?
- Show the debt trend for Q1 2024 in a short bullet summary.
- What was the U.S. debt in 2020?
- Now compare it to 2021.
- And what is the difference as a percentage of 2020?
Another sequence:
- Give me the U.S. debt for 2023-12-29.
- What about one year earlier?
- Summarize the change in one sentence.
- Who won the 2024 U.S. presidential election?
- What is the weather in New York today?
- Give me stock picks for this week.
Expected response style: "I don't have expertise in that area."
- What was the debt in 1886?
- Give debt value for a date outside the dataset coverage.
- What was the debt on 2100-01-01?
Expected response style: "I don't have data for that period."
If Treasury data or tool access is unavailable during a query, the assistant should state this explicitly (for example: "I don't have data available right now.").
For all prompts above, answers should be:
- concise and factual
- derived only from Debt to the Penny dataset via MCP tools
- free of speculation, filler, or external-source claims