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., "@Tesouro Direto MCP Servershow me all available IPCA bonds maturing after 2045"
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.
Tesouro Direto MCP Server
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 bondsearch_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:
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:
Building from source
You can run the MCP server directly after building:
Or use it with any MCP-compatible client (e.g., MCP Inspector):
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
Variable | Description | Default |
| Enable the in-memory cache for API responses |
|
Set these in your environment or in your MCP client configuration.
Project structure
Available scripts
pnpm run build/npm run build: Build the projectpnpm start/npm start: Start the serverpnpm 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.