Skip to main content

comdirect-mcp

PyPI Python Tests MCP License: MIT

Read-only Model Context Protocol server and typed Python client for the comdirect REST API.

Let Claude, GitHub Copilot or any other MCP client look at your accounts, transactions, securities depot and postbox documents. The login is confirmed with your photoTAN app, and there is no tool that can move money.

Warnung (auf Deutsch, weil comdirect)

Leute, hier geht es um euer Geld. Nutzt diese Bibliothek nur, wenn ihr den Code versteht und die Risiken kennt.

Die Software steht unter der MIT-Lizenz: Jeder darf damit machen, was er/sie will (auch ihr, comdirect 👀), aber ohne jede Gewährleistung. Ich übernehme keine Haftung für Schäden durch ihre Nutzung. Wenn euch etwas auffällt: PRs und Issues sind willkommen.

Transparenz: Ein Teil des Codes stammt von Opus 5.5 und gpt-6.1-sol, ich habe reviewed, getestet und weise genickt. Genau deshalb steht oben, dass ihr den Code verstehen solltet. Den MCP-Server selbst habe ich lokal mit einem Modell über Ollama getestet, ganz ohne Cloud.

Das Repo nutzt aktuell nur lesende Endpunkte der API, aber Fehler passieren trotzdem. comdirect kann die API jederzeit ändern, Dependencies können kompromittiert werden (Supply-Chain-Angriffe), und 2FA hilft zwar, ist aber nun wirklich kein Freifahrtschein.

Deshalb bitte:

  • Nutzt das Ganze nur lokal auf eurem eigenen Rechner.
  • Gebt eure Zugangsdaten niemandem weiter.
  • Legt eure Zugangsdaten im OS-Schlüsselbund ab (comdirect-mcp configure). Falls ihr doch eine .env nutzt: Dort steht das Passwort im Klartext, also committet sie niemals.
  • Nutzt bei Clones/Forks die Pre-Commit-Hooks, um nach Secrets zu scannen.
  • Spielt Updates nicht blind ein (Lockfile und Pinning helfen) und schaut euch Änderungen kurz an.

MCP-Server: Sobald ihr den Server an einen AI-Client hängt, der nicht lokal läuft, verlassen eure Daten euren Rechner. Je nach Client und Setup können Kontodaten und Umsätze in Logs/Telemetrie im Ausland landen. Außerdem können (wenn auch unwahrscheinlich) Dokumente oder Verwendungszwecke Prompt-Injections enthalten, die das Modell in komische Richtungen lenken (MCP Horror Stories: The GitHub Prompt Injection Data Heist). Nutzt deshalb den MCP nur in Umgebungen, denen ihr wirklich vertraut, und gebt nur die Daten frei, die ihr tatsächlich braucht.

Da der gemeine r/finanzen - User seine Kontoauszüge eh schon in ChatGPT kopiert: Macht damit, was ihr wollt, aber auf eigene Verantwortung! Aber endlich könnt ihr eurem Date per Claude erstelltes Chart vorrechnen, was der erste Beziehungsmonat gegenüber dem letzten Singlemonat gekostet hat (Kontext). (Hauptsache, ihr lasst 'nen Stern da.)

Privacy: prefer a local model

The server runs on your machine, but every tool result is sent to the language model behind your MCP client. With cloud assistants (Claude, GitHub Copilot, ChatGPT, ...) your balances, transactions and documents leave your computer and are processed under that provider's data policy.

  • Most private: use an MCP client with a local model, e.g. LM Studio (supports MCP servers directly) or Ollama with the ollmcp client. Then nothing leaves your machine except the requests to comdirect. Pick a model with good tool-calling support.
  • With a cloud assistant: check its data retention and training settings, use an account where your data is not used for training, and ask only what you need.

Details: Privacy and security · Use a local model

Features

  • MCP specification 2026-07-28 on the official MCP Python SDK v2, with fallback for older clients
  • Push TAN login via elicitation: your client asks you to approve the login in the photoTAN app; the TAN never reaches the model
  • Credentials in the OS keychain: comdirect-mcp configure stores them once, client configs contain no secrets
  • No tool can move money: only read endpoints, truthful tool annotations, structured output with JSON schemas
  • Protects your access: stops logging in before comdirect's lock after five unconfirmed TAN challenges, and revokes the session at comdirect on logout and shutdown so it cannot be extended
  • Built for agents: compact results without empty fields, one counterparty instead of SEPA roles, cleaned-up payment texts, server-side summaries for cash flow questions
  • Privacy defaults: IBANs and account numbers masked, optional name pseudonyms, documents size-limited, untrusted-content hint for the model
  • Automatic token refresh and explicit session handling
  • Typed Python client (py.typed) for scripts and notebooks, independent of MCP
  • Listed in the MCP Registry as io.github.mad4ms/comdirect-mcp

Tools

Tool Description
login Starts a session; asks you to approve the push TAN
logout Ends the session and revokes it at comdirect (no further refresh)
list_accounts Accounts with type (Girokonto, Tagesgeld, ...) and balances
list_transactions Transactions with date, amount, counterparty and cleaned-up purpose; the merchant instead of PayPal; transfers between your own accounts are marked
summarize_transactions Cash flow and spending per month, counterparty, type or your own categories, for one or all accounts, computed on the server; transfers between your own accounts are reported separately
find_recurring_payments Subscriptions, contracts and standing orders with rhythm, price changes and yearly cost (last 180 days, all the API returns)
list_cards Card balances (Visa); the API has no card transactions
get_wealth_overview All product balances with bank-supplied EUR totals, including loans and savings
list_depots Securities accounts
get_depot_positions Positions (name, ISIN, WKN, values, P&L) and depot balance, optionally for one security
list_depot_transactions Securities purchases, sales and transfers with filters and continuation
summarize_portfolio Largest positions and allocation percentages per currency
get_instrument Security metadata; optional fund fees/ratings, derivative details and trading venues
list_orders / get_order Read the order book and individual orders; never place or change orders
list_documents Postbox documents (statements, order confirmations, tax documents)
read_document A document as bounded text, its cover page, or a link to the PDF; comdirect marks it as read

Arguments and results: Tools reference.

Prompts

Ready-made analyses you start yourself, e.g. as slash command in Claude Code and VS Code:

Prompt Description
monthly_review Income and expenses of a month compared with the previous month
find_subscriptions Recurring payments with projected yearly costs and cancellation candidates
tax_documents Tax documents of a year in the postbox, listed before anything is opened

Categories for summarize_transactions come from a local rules file: Categorize transactions.

Quickstart

New to this? Follow the Getting started tutorial.

1. Prerequisites

  • uv (provides uvx)
  • comdirect API access: in the online banking under Verwaltung → Entwicklerzugang you get a Client ID and Client Secret (step by step)
  • photoTAN Push as your default TAN method

2. Store your credentials in the OS keychain

uvx comdirect-mcp@0.6.0 configure

Prompts for Client ID, Client Secret, Zugangsnummer and PIN and stores them in the macOS Keychain, Windows Credential Manager or Linux Secret Service. Other options (VS Code inputs, environment, .env): Manage credentials.

3. Add the server to your MCP client

Claude Desktop (Settings → Developer → Edit Config) and LM Studio (Program → Install → Edit mcp.json):

{
  "mcpServers": {
    "comdirect": {
      "command": "uvx",
      "args": ["comdirect-mcp@0.6.0"]
    }
  }
}

Claude Code

claude mcp add --transport stdio --scope user comdirect -- uvx comdirect-mcp@0.6.0

VS Code (MCP: Open User Configuration)

{
  "servers": {
    "comdirect": {
      "type": "stdio",
      "command": "uvx",
      "args": ["comdirect-mcp@0.6.0"]
    }
  }
}

Ollama (via ollmcp)

uvx ollmcp mcp add --scope user comdirect -- uvx comdirect-mcp@0.6.0
uvx ollmcp -m <model>

Pinning the version (@0.5.1) means updates only happen when you decide. More clients: Configure MCP clients.

4. Ask

Wie haben sich meine Ausgaben im letzten Monat entwickelt, und welche Depotposition läuft am schlechtesten?

The assistant calls login, your phone receives the push TAN, you approve it and confirm the dialog in your client. Then the assistant can use the other tools. Problems: Troubleshoot.

Python library

The same client is available for your own scripts:

from comdirect_mcp import ComdirectClient
from comdirect_mcp.utils import default_push_tan_callback

client = ComdirectClient(
    {"client_id": "...", "client_secret": "...", "username": "...", "password": "..."},
    {"push_tan_cb": default_push_tan_callback},
)
client.login()  # approve the push TAN, then press Enter

for account in client.list_accounts():
    print(account.id, account.balance, account.currency)

See Use the Python library, the Python API reference and the examples.

Documentation

The documentation is organized as tutorial, how-to guides, reference and explanation:

Tutorial Getting started
How-to API access · Credentials · MCP clients · Local model · Troubleshoot · Python library · Develop
Reference Tools · Configuration · Python API
Explanation Login and sessions · Privacy and security · Design

SECURITY.md describes the threat model and how to report vulnerabilities, CHANGELOG.md lists the changes per release.

Contributing

Issues and pull requests are welcome, see CONTRIBUTING.md and the Code of Conduct. AI coding agents find their instructions in AGENTS.md.

Disclaimer

This project is not affiliated with, maintained, or endorsed by comdirect bank AG. Use it at your own risk. There is no warranty and no liability for any financial losses or damages resulting from its use.

The software runs locally and does not send your credentials anywhere except to comdirect. Your MCP client and its model provider receive the data the tools return.

License

MIT

Metadata

Release files for comdirect-mcp 0.6.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 comdirect-mcp 0.6.0
File Size Uploaded Provenance Actions
comdirect_mcp-0.6.0.tar.gz 119.9 kB With provenance Details for comdirect_mcp-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for comdirect-mcp 0.6.0
File Interpreter ABI Platform Actions
comdirect_mcp-0.6.0-py3-none-any.whl Python 3 none any Details for comdirect_mcp-0.6.0-py3-none-any.whl

Total release size: 326.1 kB

Release files / comdirect_mcp-0.6.0.tar.gz

Download URL comdirect_mcp-0.6.0.tar.gz
Size 119.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7ff624172dd3d74d162b4bfadf04ca4cab78c875479297c57da2669bca2b818e
BLAKE2b-256 checksum
How to use checksums
83e2d996b6df897757ed6a5fadc87b953833725e43d58fad51cae5afdc73ef5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / comdirect_mcp-0.6.0-py3-none-any.whl

Download URL comdirect_mcp-0.6.0-py3-none-any.whl
Size 206.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fca697214a75cad6851cb8ab15fcd002a8f837ec8b61d2663ac50581bb03ea7
BLAKE2b-256 checksum
How to use checksums
2c7a8204ae5cb74dac89db6fd79eb7a7fbd6c9989fb58b3d0fa4de073f0200a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for comdirect-mcp 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for comdirect_mcp-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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