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.

See AGENTS.md for agent-oriented instructions.

License

MIT - see LICENSE.

Metadata

Release files for dlp-invest-mcp 0.1.0

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.0
File Size Uploaded
dlp_invest_mcp-0.1.0.tar.gz 118.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlp-invest-mcp 0.1.0
File Interpreter ABI Platform
dlp_invest_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 133.3 kB

Release files / dlp_invest_mcp-0.1.0.tar.gz

Download URL dlp_invest_mcp-0.1.0.tar.gz
Size 118.5 kB
Tags Source
SHA-256 checksum
How to use checksums
036a7132576e7afc834014c91a92c7dcb21bf98089b2763191206d6b5317915a
BLAKE2b-256 checksum
How to use checksums
853ef6c1b28e7f4153a2fc636f3f2da49fe8f4d28baa098223ba1b85fe2ea51e
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.0-py3-none-any.whl

Download URL dlp_invest_mcp-0.1.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cf4d6459b32f703482219eb29c8d44d8150511947c9c58b23249183aaba7360
BLAKE2b-256 checksum
How to use checksums
fd1f1888321e15acc9defbe44471b0820b484bf2030b9c2e57c22cb319b041b8
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

0.1.2

2 release files

This release

0.1.0 This release

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