Tesouro Direto

Tesouro Direto

atilioa

Connects to Brazil's Treasury Direct API to retrieve real-time bond market data, bond details, and search Brazilian government bonds by various criteria.

Provides real-time access to Brazil's Treasury Direct bond market data, enabling users to retrieve market status, search bonds by type and maturity date, and access detailed information for investment analysis.

5324 views4Local (stdio)

What it does

  • Retrieve treasury bond market status and hours
  • Search bonds by type and maturity date
  • Get detailed bond information and yields
  • Filter IPCA and fixed-rate bonds
  • Access real-time Brazilian government bond data

Best for

Brazilian investors researching treasury bondsFinancial analysts tracking bond marketsInvestment advisors comparing bond options
Real-time data from official Tesouro Direto APISmart 10-minute caching systemNo API key required

About Tesouro Direto

Tesouro Direto is a community-built MCP server published by atilioa that provides AI assistants with tools and capabilities via the Model Context Protocol. Access real-time Tesouro Direto bond data, market status, and investment analysis tools for Brazil's Treasury Direct pla It is categorized under finance.

How to install

You can install Tesouro Direto in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

Tesouro Direto is released under the AGPL-3.0 license.

Tesouro Direto MCP Server

smithery badge npm version License: AGPL v3

A Model Context Protocol (MCP) server implementation for integrating with the Tesouro Direto API, enabling natural language access to Brazilian treasury bond data.


Features

Query market data, bond details, and search/filter bonds using everyday language through MCP-compatible clients.

  • MCP tools:
    • market_data: Retrieve general treasury bond market data (opening/closing times, status)
    • bond_data: Get detailed information about a specific bond
    • search_bonds: Search/filter bonds by type, maturity, and other criteria
  • Smart caching: 10-minute in-memory cache based on API update timestamps to reduce calls while ensuring data freshness.

Example usage

In a MCP-compatible client, you can use the following prompts:

  • "Show all available Tesouro Direto bonds"
  • "Get details for the bond IPCA+ 2029"
  • "Search for IPCA bonds maturing after 2045"
  • "What is the current treasury bond market status?"
  • "Provide a detailed analysis of the top three bonds with the highest yields for both IPCA and fixed-rate bonds."

Installation

Installing via Smithery

To install Tesouro Direto MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @AtilioA/tesouro-direto-mcp --client claude

Installing via npm

Example JSON for MCP client configuration (Cursor/Claude)

With npx, add this to your ~/.cursor/mcp.json, or claude_desktop_config.json if you are using its desktop app:

{
    "mcpServers": {
        "tesouro-direto": {
            "command": "npx",
            "args": [
                "-y",
                "tesouro-direto-mcp"
            ],
            "env": {
                "USE_MCP_CACHE": "true"
            }
        }
    }
}

Building from source

# Clone the repository
git clone https://github.com/AtilioA/tesouro-direto-mcp.git
cd tesouro-direto-mcp

# Install dependencies
pnpm install

# Build the project
pnpm run build

You can run the MCP server directly after building:

node dist/index.js

Or use it with any MCP-compatible client (e.g., MCP Inspector):

npx @modelcontextprotocol/inspector dist/index.js

Tools

market_data

Retrieve general market data, including opening/closing times and current status.

bond_data

Get detailed information for a specific bond by its code.

search_bonds

Search and filter bonds by type (SELIC, IPCA, PREFIXADO), maturity date, and more.


Environment variables

VariableDescriptionDefault
USE_MCP_CACHEEnable the in-memory cache for API responsestrue

Set these in your environment or in your MCP client configuration.


Project structure

src/
├── api/         # API client for Tesouro Direto
│   └── tesouroDireto.ts
├── cache/       # Caching implementation
│   └── apiCache.ts
├── resources/   # MCP resources implementation
│   └── index.ts
├── tools/       # MCP tools implementation
│   ├── bondData.ts
│   ├── marketData.ts
│   └── searchBonds.ts
├── types/       # Type definitions
│   └── index.ts
├── utils/       # Utility functions
│   ├── errorHandler.ts
│   └── logger.ts
├── client.ts    # Example MCP client
├── index.ts     # Entry point
└── server.ts    # MCP server implementation

Available scripts

  • pnpm run build / npm run build: Build the project
  • pnpm start / npm start: Start the server
  • pnpm run dev / npm run dev: Start the server in development mode with auto-reload

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.


License

This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.

Alternatives

Related Skills

Browse all skills
finance-skills

Production-ready financial analyst skill with ratio analysis, DCF valuation, budget variance analysis, and rolling forecast construction. 4 Python tools (all stdlib-only). Works with Claude Code, Codex CLI, and OpenClaw.

55
news-aggregator-skill

Comprehensive news aggregator that fetches, filters, and deeply analyzes real-time content from 8 major sources: Hacker News, GitHub Trending, Product Hunt, 36Kr, Tencent News, WallStreetCN, V2EX, and Weibo. Best for 'daily scans', 'tech news briefings', 'finance updates', and 'deep interpretations' of hot topics.

21
finance-manager

Comprehensive personal finance management system for analyzing transaction data, generating insights, creating visualizations, and providing actionable financial recommendations. Use when users need to analyze spending patterns, track budgets, visualize financial data, extract transactions from PDFs, calculate savings rates, identify spending trends, generate financial reports, or receive personalized budget recommendations. Triggers include requests like "analyze my finances", "track my spending", "create a financial report", "extract transactions from PDF", "visualize my budget", "where is my money going", "financial insights", "spending breakdown", or any finance-related analysis tasks.

10
personal-finance-beancount

Professional personal finance advisor specializing in plain-text accounting with Beancount and Fava. Use when users need help with: (1) Analyzing spending habits and financial patterns from Beancount files, (2) Creating or understanding Beancount transactions and syntax, (3) Financial planning, budgeting, and investment advice, (4) Interpreting Fava reports and creating custom queries, (5) Organizing chart of accounts, (6) Double-entry bookkeeping principles, (7) Personal finance optimization and wealth building strategies. Provides analysis, education, and personalized recommendations while maintaining professional standards.

7
stock-analysis

Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management (create, add, remove assets), crypto analysis (Top 20 by market cap), and periodic performance reports (daily/weekly/monthly/quarterly/yearly). 8 analysis dimensions for stocks, 3 for crypto. Use for stock analysis, portfolio tracking, earnings reactions, or crypto monitoring.

7
tavily-search-pro

Tavily AI search platform with 5 modes: Search (web/news/finance), Extract (URL content), Crawl (website crawling), Map (sitemap discovery), and Research (deep research with citations). Use for: web search with LLM answers, content extraction, site crawling, deep research.

5