dlp-invest-mcp
MCP (Model Context Protocol) server exposing your DLPInvest portfolio as tools for AI clients - Claude Desktop, Cursor, Claude Code, and any MCP-compatible client.
What is this?
MCP is an open protocol that lets AI models call external tools. This package is a stdio MCP server that talks to the DLPInvest REST API on your behalf. Once configured, an AI assistant can query your positions, trades, dividends, and more - without you writing a single line of code.
Features:
- 11 ready-to-use tools covering operations, portfolio, positions, returns, statement, dividends, assets, brokerages, strategies, and sub-strategies.
- Runs over stdio (JSON-RPC), the most portable MCP transport.
- Installable via
uvx,pip, oruv- no Python knowledge required on the client side.
Quick install
Option 1 (recommended): uvx + client config
Install uv once, then paste the JSON block for your client below.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %AppData%/Claude/claude_desktop_config.json (Windows):
{
"mcpServers": {
"dlp-invest": {
"command": "uvx",
"args": ["dlp-invest-mcp"],
"env": {
"DLP_INVEST_API_TOKEN": "DLP-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}
Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"dlp-invest": {
"command": "uvx",
"args": ["dlp-invest-mcp"],
"env": {
"DLP_INVEST_API_TOKEN": "DLP-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}
Claude Code
claude mcp add dlp-invest --scope user --env DLP_INVEST_API_TOKEN=DLP-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -- uvx dlp-invest-mcp
Option 2: pip + manual run
pip install dlp-invest-mcp
dlp-invest-mcp
Then configure your client to run dlp-invest-mcp as the command.
Available tools
| Tool | Description | Key parameters |
|---|---|---|
obter_operacoes |
List operations/trades | carteira, status, data_inicial, data_final, limite, offset |
obter_carteira |
Portfolio metadata | - |
obter_posicao |
Current holdings | carteira |
obter_rentabilidade |
Returns over a period | carteira, data_inicial, data_final |
obter_extrato |
Financial statement | carteira, data_inicial, data_final, limite, offset |
obter_proventos |
Dividends & income | carteira, data_inicial, data_final |
obter_ativos |
List all assets | - |
obter_ativos_detalhes |
Asset details by ticker | ticker (required) |
obter_corretoras |
List brokerages | - |
obter_estrategias |
List strategies | - |
obter_subestrategias |
List sub-strategies | - |
Example
What's my current position?
The AI calls obter_posicao and returns your holdings in real time.
Environment variables
| Variable | Default | Required | Description |
|---|---|---|---|
DLP_INVEST_API_TOKEN |
(empty) | No | DLPInvest API token (Bearer). Leave empty to disable requests; tools will return a clear error. |
DLP_INVEST_API_BASE_URL |
https://users.dlpinvest.com.br |
No | Base URL of the DLPInvest REST API. |
DLP_INVEST_REQUEST_TIMEOUT_SECONDS |
30 |
No | HTTP request timeout in seconds. |
Settings can also be placed in a .env file in the working directory.
Development
# Clone
git clone https://github.com/marlo/dlp-invest-mcp
cd dlp-invest-mcp
# Install uv (https://github.com/astral-sh/uv)
# Then:
uv sync # install dependencies + dev tools
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy src # type check
uv run pytest -q # tests
uv run dlp-invest-mcp # run server locally
Build a local wheel
uv build
Artifacts land in dist/. Test install:
uv pip install dist/dlp_invest_mcp-0.1.0-py3-none-any.whl
Dry-run publish
uv publish --dry-run
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
uvx: command not found |
uv not installed |
Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh |
| Tools return "Token de API nao configurado" | DLP_INVEST_API_TOKEN missing |
Add the env var in your client config or a .env file |
| No tools appear in client | Wrong command in client config | Use uvx dlp-invest-mcp (not python ...) |
| JSON-RPC errors on stdout | Logging writes to stdout | This package logs to stderr only - ensure you did not redirect stderr |
| Timeout / connection errors | Network or wrong base URL | Check DLP_INVEST_API_BASE_URL and network access |
Contributing
- Fork the repo and create a branch.
- Run
uv syncto install dev dependencies. - Add tests for any new tool.
- Ensure
ruff,mypy, andpytestpass. - Open a PR describing the change.
License
MIT - see LICENSE.
Metadata
Release files for dlp-invest-mcp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dlp_invest_mcp-0.1.2.tar.gz | 118.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dlp_invest_mcp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 133.3 kB
Release files / dlp_invest_mcp-0.1.2.tar.gz
| Download URL | dlp_invest_mcp-0.1.2.tar.gz |
|---|---|
| Size | 118.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14c00bb4518cace7817413495f80d27e87a4e4c6746cce6225233e547c8ed6d8
|
|
BLAKE2b-256 checksum How to use checksums |
b7a670f47998d00bdaa9b7280b959a699b043651b224c0f9fa02532a07adef96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dlp_invest_mcp-0.1.2-py3-none-any.whl
| Download URL | dlp_invest_mcp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8877363a678487515b61cc88fb4c3715b4d906fb6223d85efc54900057b60ae
|
|
BLAKE2b-256 checksum How to use checksums |
feecc09a5127c31dae79a5be85f93ea4d1bd61ed0263629ff0e6c3bf9818d728
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|