Skip to main content

dlp-invest-mcp

PyPI Python License CI

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, or uv - no Python knowledge required on the client side.

Quick install

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

  1. Fork the repo and create a branch.
  2. Run uv sync to install dev dependencies.
  3. Add tests for any new tool.
  4. Ensure ruff, mypy, and pytest pass.
  5. 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)

Source distribution for dlp-invest-mcp 0.1.2
File Size Uploaded
dlp_invest_mcp-0.1.2.tar.gz 118.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlp-invest-mcp 0.1.2
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page