comdirect-mcp 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. comdirect_mcp-0.4.0/LICENSE +21 -0
  2. comdirect_mcp-0.4.0/PKG-INFO +238 -0
  3. comdirect_mcp-0.4.0/README.md +201 -0
  4. comdirect_mcp-0.4.0/pyproject.toml +98 -0
  5. comdirect_mcp-0.4.0/pyproject.toml.orig +87 -0
  6. comdirect_mcp-0.4.0/src/comdirect_mcp/__init__.py +23 -0
  7. comdirect_mcp-0.4.0/src/comdirect_mcp/__main__.py +6 -0
  8. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/__init__.py +177 -0
  9. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/__init__.py +8 -0
  10. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/banking_api.py +893 -0
  11. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/brokerage_api.py +5551 -0
  12. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/messages_api.py +784 -0
  13. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/reports_api.py +371 -0
  14. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api/session_api.py +791 -0
  15. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api_client.py +702 -0
  16. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/api_response.py +20 -0
  17. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/configuration.py +589 -0
  18. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/exceptions.py +219 -0
  19. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/__init__.py +71 -0
  20. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/account.py +134 -0
  21. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/account_balance.py +134 -0
  22. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/account_information.py +100 -0
  23. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/account_transaction.py +216 -0
  24. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/amount_value.py +94 -0
  25. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/balance.py +137 -0
  26. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/business_message.py +115 -0
  27. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/card.py +179 -0
  28. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/card_balance.py +113 -0
  29. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/cost_entry.py +127 -0
  30. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/cost_group.py +138 -0
  31. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/cost_indication_ex_ante.py +271 -0
  32. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/depot.py +130 -0
  33. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/depot_aggregation.py +175 -0
  34. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/depot_position.py +217 -0
  35. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/depot_transaction.py +227 -0
  36. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/derivative_data.py +247 -0
  37. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/dimensions.py +93 -0
  38. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/document.py +141 -0
  39. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/document_metadata.py +108 -0
  40. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/enum_text.py +96 -0
  41. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/execution.py +126 -0
  42. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/fixed_term_savings.py +174 -0
  43. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/fund_distribution.py +183 -0
  44. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/fx_rate_eur.py +96 -0
  45. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/inducement.py +98 -0
  46. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/installment_loan.py +166 -0
  47. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/installment_loan_balance.py +110 -0
  48. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/instrument.py +166 -0
  49. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_account_balance.py +107 -0
  50. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_account_transaction.py +107 -0
  51. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_cost_indication_ex_ante.py +107 -0
  52. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_depot.py +105 -0
  53. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_depot_position.py +107 -0
  54. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_depot_transaction.py +107 -0
  55. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_dimensions.py +105 -0
  56. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_document.py +105 -0
  57. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_instrument.py +105 -0
  58. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_order.py +105 -0
  59. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/list_resource_product_balance.py +107 -0
  60. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/order.py +411 -0
  61. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/order_type.py +97 -0
  62. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/paging_info.py +84 -0
  63. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/price.py +110 -0
  64. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/product_balance.py +142 -0
  65. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/quote.py +122 -0
  66. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/rating.py +91 -0
  67. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/session.py +101 -0
  68. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/standard_error_response.py +101 -0
  69. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/static_data.py +176 -0
  70. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/total_cost_block.py +117 -0
  71. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/total_cost_entry.py +116 -0
  72. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/total_holding_cost_block.py +101 -0
  73. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/total_holding_cost_entry.py +114 -0
  74. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/venue.py +122 -0
  75. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/models/visa_card_image.py +108 -0
  76. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/py.typed +0 -0
  77. comdirect_mcp-0.4.0/src/comdirect_mcp/_openapi/rest.py +215 -0
  78. comdirect_mcp-0.4.0/src/comdirect_mcp/auth.py +334 -0
  79. comdirect_mcp-0.4.0/src/comdirect_mcp/cli.py +77 -0
  80. comdirect_mcp-0.4.0/src/comdirect_mcp/client.py +365 -0
  81. comdirect_mcp-0.4.0/src/comdirect_mcp/credentials.py +62 -0
  82. comdirect_mcp-0.4.0/src/comdirect_mcp/domain/__init__.py +0 -0
  83. comdirect_mcp-0.4.0/src/comdirect_mcp/domain/mappers.py +138 -0
  84. comdirect_mcp-0.4.0/src/comdirect_mcp/domain/models.py +98 -0
  85. comdirect_mcp-0.4.0/src/comdirect_mcp/exceptions.py +10 -0
  86. comdirect_mcp-0.4.0/src/comdirect_mcp/py.typed +0 -0
  87. comdirect_mcp-0.4.0/src/comdirect_mcp/server.py +432 -0
  88. comdirect_mcp-0.4.0/src/comdirect_mcp/utils.py +48 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael Adams (mad4ms)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: comdirect-mcp
3
+ Version: 0.4.0
4
+ Summary: MCP server and typed Python client for the comdirect banking REST API
5
+ Keywords: comdirect,banking,mcp,model-context-protocol,mcp-server,llm,ai-agents
6
+ Author: Michael Adams
7
+ Author-email: Michael Adams <m@ad4ms.de>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Office/Business :: Financial
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: mcp>=2.3.0,<3
22
+ Requires-Dist: keyring>=25.7.0
23
+ Requires-Dist: python-dotenv>=1.2.4
24
+ Requires-Dist: requests>=2.34.2
25
+ Requires-Dist: urllib3>=2.8.0,<3
26
+ Requires-Dist: python-dateutil>=2.9.0.post0
27
+ Requires-Dist: pydantic>=2.14.0,<3
28
+ Requires-Dist: typing-extensions>=4.16.0
29
+ Requires-Dist: pillow>=12.3.0 ; extra == 'phototan'
30
+ Requires-Python: >=3.12
31
+ Project-URL: Homepage, https://github.com/mad4ms/comdirect-mcp
32
+ Project-URL: Documentation, https://github.com/mad4ms/comdirect-mcp/tree/main/docs
33
+ Project-URL: Issues, https://github.com/mad4ms/comdirect-mcp/issues
34
+ Project-URL: Changelog, https://github.com/mad4ms/comdirect-mcp/blob/main/CHANGELOG.md
35
+ Provides-Extra: phototan
36
+ Description-Content-Type: text/markdown
37
+
38
+ # comdirect-mcp
39
+
40
+ <!-- mcp-name: io.github.mad4ms/comdirect-mcp -->
41
+
42
+ [![PyPI](https://img.shields.io/pypi/v/comdirect-mcp.svg)](https://pypi.org/project/comdirect-mcp/)
43
+ [![Python](https://img.shields.io/pypi/pyversions/comdirect-mcp.svg)](https://pypi.org/project/comdirect-mcp/)
44
+ [![Tests](https://github.com/mad4ms/comdirect-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/mad4ms/comdirect-mcp/actions/workflows/tests.yml)
45
+ [![MCP](https://img.shields.io/badge/MCP-2026--07--28-blue)](https://modelcontextprotocol.io/specification/2026-07-28)
46
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
47
+
48
+ **Read-only [Model Context Protocol](https://modelcontextprotocol.io) server and typed Python client for the
49
+ [comdirect REST API](https://www.comdirect.de/cms/kontakt-zugaenge-api.html).**
50
+
51
+ Let Claude, GitHub Copilot or any other MCP client look at your accounts, transactions, securities depot and
52
+ postbox documents. The login is confirmed with your photoTAN app, and there is no tool that can move money.
53
+
54
+ > [!WARNING]
55
+ > This is an unofficial project, not affiliated with comdirect. It handles your banking credentials and sends
56
+ > your financial data to the AI model you connect it to. Read the warning below and [SECURITY.md](SECURITY.md).
57
+
58
+ ## Warnung (in Deutsch weil Comdirect)
59
+
60
+ Leute es geht hier um euer Geld. Nutzt diese Bibliothek nur, wenn ihr den Code versteht und euch den Risiken bewusst seid.
61
+
62
+ Ich bin auch nicht perfekt, aber übernehme keine Haftung für Schäden, die durch die Nutzung dieser Software entstehen. Falls Euch was auffällt, gern PRs oder Issues.
63
+
64
+ Die API und damit das Repo hier nutzen aktuell nur lesende Endpunkte, aber Fehler können immer passieren. Comdirect kann die API ändern, Dependencies können im Zweifel auch Mist bauen ([Supply-Chain Attacks](https://docs.github.com/de/code-security/concepts/supply-chain-security/about-supply-chain-security)) und 2FA hilft zwar, ist aber kein Freifahrtschein.
65
+
66
+ Bitte:
67
+ - Nutzt das nur lokal auf eurem eigenen Rechner.
68
+ - Teilt eure Zugangsdaten mit niemandem.
69
+ - Packt Secrets in `.env` und committet die Datei nie.
70
+ - Nutzt die [Pre-Commit Hooks](docs/how-to/develop.md#pre-commit-hooks) um Secrets zu scannen. Gute Zeit bissel Devops-Kram zu lernen.
71
+ - Spielt Updates nicht blind ein (Lockfile/Pinning hilft) und schaut bei Änderungen kurz drüber.
72
+
73
+ **MCP-Server**: Wenn ihr den Server an einen nicht-lokalen AI-Client hängt, **gehen deine Daten raus**. Je nach Client/Setup können Kontodaten/Transaktionen in Logs/Telemetry landen oder durch Prompt-Injection aus Dokumenten/Verwendungszwecken in komische Richtungen gehen ([MCP Horror Stories: The GitHub Prompt Injection Data Heist](https://www.docker.com/blog/mcp-horror-stories-github-prompt-injection/)). Nutzt MCP nur, wenn ihr der Umgebung wirklich vertraut, und gebt nur die Daten frei, die ihr dafür braucht.
74
+
75
+ Da der gemeine r/finanzen User eh schon seine Kontoauszüge in ChatGPT kopiert, könnt ihr damit machen, was ihr wollt, **auf eure eigene Verantwortung**!
76
+
77
+ Idealerweise ohne unnötige personenbezogene Daten. (Hauptsache, ihr lasst 'nen Stern da.)
78
+
79
+ ## Privacy: prefer a local model
80
+
81
+ The server runs on your machine, but **every tool result is sent to the language model behind your MCP client**.
82
+ With cloud assistants (Claude, GitHub Copilot, ChatGPT, ...) your balances, transactions and documents leave your
83
+ computer and are processed under that provider's data policy.
84
+
85
+ - **Most private:** use an MCP client with a **local model**, e.g. [LM Studio](https://lmstudio.ai) (supports MCP
86
+ servers directly) or another client running a model via Ollama or llama.cpp. Then nothing leaves your machine
87
+ except the requests to comdirect. Pick a model with good tool-calling support.
88
+ - **With a cloud assistant:** check its data retention and training settings, use an account where your data is
89
+ not used for training, and ask only what you need.
90
+
91
+ Details: [Privacy and security](docs/explanation/privacy-and-security.md) ·
92
+ [Use a local model](docs/how-to/use-a-local-model.md)
93
+
94
+ ## Features
95
+
96
+ - **MCP specification 2026-07-28** on the official MCP Python SDK v2, with fallback for older clients
97
+ - **Push TAN login via elicitation**: your client asks you to approve the login in the photoTAN app; the TAN never reaches the model
98
+ - **Credentials in the OS keychain**: `comdirect-mcp configure` stores them once, client configs contain no secrets
99
+ - **No tool can move money**: only read endpoints, truthful tool annotations, structured output with JSON schemas
100
+ - **Protects your access**: stops logging in before comdirect's lock after five unconfirmed TAN challenges, and
101
+ revokes the session at comdirect on logout and shutdown so it cannot be extended
102
+ - **Privacy defaults**: counterparty IBANs masked, documents size-limited, untrusted-content hint for the model
103
+ - **Automatic token refresh** and explicit session handling
104
+ - **Typed Python client** (`py.typed`) for scripts and notebooks, independent of MCP
105
+ - Listed in the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.mad4ms/comdirect-mcp`
106
+
107
+ ### Tools
108
+
109
+ | Tool | Description |
110
+ | --- | --- |
111
+ | `login` | Starts a session; asks you to approve the push TAN |
112
+ | `logout` | Ends the session and revokes it at comdirect (no further refresh) |
113
+ | `list_accounts` | Accounts with balances |
114
+ | `list_transactions` | Transactions of an account, filter by date, direction and state |
115
+ | `list_depots` | Securities accounts |
116
+ | `get_depot_positions` | Positions (name, ISIN, WKN, values, P&L) and depot balance |
117
+ | `list_documents` | Postbox documents (statements, order confirmations, tax documents) |
118
+ | `download_document` | A document as embedded resource (comdirect marks it as read) |
119
+
120
+ Arguments and results: [Tools reference](docs/reference/tools.md).
121
+
122
+ ## Quickstart
123
+
124
+ New to this? Follow the [Getting started tutorial](docs/tutorials/getting-started.md).
125
+
126
+ ### 1. Prerequisites
127
+
128
+ - [uv](https://docs.astral.sh/uv/) (provides `uvx`)
129
+ - comdirect API access: in the online banking under **Verwaltung → Entwicklerzugang** you get a Client ID and
130
+ Client Secret ([step by step](docs/how-to/get-comdirect-api-access.md))
131
+ - **photoTAN Push** as your default TAN method
132
+
133
+ ### 2. Store your credentials in the OS keychain
134
+
135
+ ```bash
136
+ uvx comdirect-mcp@0.4.0 configure
137
+ ```
138
+
139
+ Prompts for Client ID, Client Secret, Zugangsnummer and PIN and stores them in the macOS Keychain, Windows
140
+ Credential Manager or Linux Secret Service. Other options (VS Code inputs, environment, `.env`):
141
+ [Manage credentials](docs/how-to/manage-credentials.md).
142
+
143
+ ### 3. Add the server to your MCP client
144
+
145
+ **Claude Desktop** (*Settings → Developer → Edit Config*) and **LM Studio** (*Program → Install → Edit mcp.json*):
146
+
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "comdirect": {
151
+ "command": "uvx",
152
+ "args": ["comdirect-mcp@0.4.0"]
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ **Claude Code**
159
+
160
+ ```bash
161
+ claude mcp add --transport stdio --scope user comdirect -- uvx comdirect-mcp@0.4.0
162
+ ```
163
+
164
+ **VS Code** (*MCP: Open User Configuration*)
165
+
166
+ ```json
167
+ {
168
+ "servers": {
169
+ "comdirect": {
170
+ "type": "stdio",
171
+ "command": "uvx",
172
+ "args": ["comdirect-mcp@0.4.0"]
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ Pinning the version (`@0.4.0`) means updates only happen when you decide. More clients:
179
+ [Configure MCP clients](docs/how-to/configure-mcp-clients.md).
180
+
181
+ ### 4. Ask
182
+
183
+ > Wie haben sich meine Ausgaben im letzten Monat entwickelt, und welche Depotposition läuft am schlechtesten?
184
+
185
+ The assistant calls `login`, your phone receives the push TAN, you approve it and confirm the dialog in
186
+ your client. Then the assistant can use the other tools. Problems: [Troubleshoot](docs/how-to/troubleshoot.md).
187
+
188
+ ## Python library
189
+
190
+ The same client is available for your own scripts:
191
+
192
+ ```python
193
+ from comdirect_mcp import ComdirectClient
194
+ from comdirect_mcp.utils import default_push_tan_callback
195
+
196
+ client = ComdirectClient(
197
+ {"client_id": "...", "client_secret": "...", "username": "...", "password": "..."},
198
+ {"push_tan_cb": default_push_tan_callback},
199
+ )
200
+ client.login() # approve the push TAN, then press Enter
201
+
202
+ for account in client.list_accounts():
203
+ print(account.id, account.balance, account.currency)
204
+ ```
205
+
206
+ See [Use the Python library](docs/how-to/use-the-python-library.md), the [Python API reference](docs/reference/python-api.md)
207
+ and the [examples](examples/).
208
+
209
+ ## Documentation
210
+
211
+ The [documentation](docs/README.md) is organized as tutorial, how-to guides, reference and explanation:
212
+
213
+ | | |
214
+ | --- | --- |
215
+ | **Tutorial** | [Getting started](docs/tutorials/getting-started.md) |
216
+ | **How-to** | [API access](docs/how-to/get-comdirect-api-access.md) · [Credentials](docs/how-to/manage-credentials.md) · [MCP clients](docs/how-to/configure-mcp-clients.md) · [Local model](docs/how-to/use-a-local-model.md) · [Troubleshoot](docs/how-to/troubleshoot.md) · [Python library](docs/how-to/use-the-python-library.md) · [Develop](docs/how-to/develop.md) |
217
+ | **Reference** | [Tools](docs/reference/tools.md) · [Configuration](docs/reference/configuration.md) · [Python API](docs/reference/python-api.md) |
218
+ | **Explanation** | [Login and sessions](docs/explanation/login-and-sessions.md) · [Privacy and security](docs/explanation/privacy-and-security.md) · [Design](docs/explanation/design.md) |
219
+
220
+ [SECURITY.md](SECURITY.md) describes the threat model and how to report vulnerabilities, [CHANGELOG.md](CHANGELOG.md)
221
+ lists the changes per release.
222
+
223
+ ## Contributing
224
+
225
+ Issues and pull requests are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md) and the
226
+ [Code of Conduct](CODE_OF_CONDUCT.md). AI coding agents find their instructions in [AGENTS.md](AGENTS.md).
227
+
228
+ ## Disclaimer
229
+
230
+ This project is not affiliated with, maintained, or endorsed by comdirect bank AG. Use it at your own risk.
231
+ There is no warranty and no liability for any financial losses or damages resulting from its use.
232
+
233
+ The software runs locally and does not send your credentials anywhere except to comdirect. Your MCP client
234
+ and its model provider receive the data the tools return.
235
+
236
+ ## License
237
+
238
+ [MIT](LICENSE)
@@ -0,0 +1,201 @@
1
+ # comdirect-mcp
2
+
3
+ <!-- mcp-name: io.github.mad4ms/comdirect-mcp -->
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/comdirect-mcp.svg)](https://pypi.org/project/comdirect-mcp/)
6
+ [![Python](https://img.shields.io/pypi/pyversions/comdirect-mcp.svg)](https://pypi.org/project/comdirect-mcp/)
7
+ [![Tests](https://github.com/mad4ms/comdirect-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/mad4ms/comdirect-mcp/actions/workflows/tests.yml)
8
+ [![MCP](https://img.shields.io/badge/MCP-2026--07--28-blue)](https://modelcontextprotocol.io/specification/2026-07-28)
9
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
10
+
11
+ **Read-only [Model Context Protocol](https://modelcontextprotocol.io) server and typed Python client for the
12
+ [comdirect REST API](https://www.comdirect.de/cms/kontakt-zugaenge-api.html).**
13
+
14
+ Let Claude, GitHub Copilot or any other MCP client look at your accounts, transactions, securities depot and
15
+ postbox documents. The login is confirmed with your photoTAN app, and there is no tool that can move money.
16
+
17
+ > [!WARNING]
18
+ > This is an unofficial project, not affiliated with comdirect. It handles your banking credentials and sends
19
+ > your financial data to the AI model you connect it to. Read the warning below and [SECURITY.md](SECURITY.md).
20
+
21
+ ## Warnung (in Deutsch weil Comdirect)
22
+
23
+ Leute es geht hier um euer Geld. Nutzt diese Bibliothek nur, wenn ihr den Code versteht und euch den Risiken bewusst seid.
24
+
25
+ Ich bin auch nicht perfekt, aber übernehme keine Haftung für Schäden, die durch die Nutzung dieser Software entstehen. Falls Euch was auffällt, gern PRs oder Issues.
26
+
27
+ Die API und damit das Repo hier nutzen aktuell nur lesende Endpunkte, aber Fehler können immer passieren. Comdirect kann die API ändern, Dependencies können im Zweifel auch Mist bauen ([Supply-Chain Attacks](https://docs.github.com/de/code-security/concepts/supply-chain-security/about-supply-chain-security)) und 2FA hilft zwar, ist aber kein Freifahrtschein.
28
+
29
+ Bitte:
30
+ - Nutzt das nur lokal auf eurem eigenen Rechner.
31
+ - Teilt eure Zugangsdaten mit niemandem.
32
+ - Packt Secrets in `.env` und committet die Datei nie.
33
+ - Nutzt die [Pre-Commit Hooks](docs/how-to/develop.md#pre-commit-hooks) um Secrets zu scannen. Gute Zeit bissel Devops-Kram zu lernen.
34
+ - Spielt Updates nicht blind ein (Lockfile/Pinning hilft) und schaut bei Änderungen kurz drüber.
35
+
36
+ **MCP-Server**: Wenn ihr den Server an einen nicht-lokalen AI-Client hängt, **gehen deine Daten raus**. Je nach Client/Setup können Kontodaten/Transaktionen in Logs/Telemetry landen oder durch Prompt-Injection aus Dokumenten/Verwendungszwecken in komische Richtungen gehen ([MCP Horror Stories: The GitHub Prompt Injection Data Heist](https://www.docker.com/blog/mcp-horror-stories-github-prompt-injection/)). Nutzt MCP nur, wenn ihr der Umgebung wirklich vertraut, und gebt nur die Daten frei, die ihr dafür braucht.
37
+
38
+ Da der gemeine r/finanzen User eh schon seine Kontoauszüge in ChatGPT kopiert, könnt ihr damit machen, was ihr wollt, **auf eure eigene Verantwortung**!
39
+
40
+ Idealerweise ohne unnötige personenbezogene Daten. (Hauptsache, ihr lasst 'nen Stern da.)
41
+
42
+ ## Privacy: prefer a local model
43
+
44
+ The server runs on your machine, but **every tool result is sent to the language model behind your MCP client**.
45
+ With cloud assistants (Claude, GitHub Copilot, ChatGPT, ...) your balances, transactions and documents leave your
46
+ computer and are processed under that provider's data policy.
47
+
48
+ - **Most private:** use an MCP client with a **local model**, e.g. [LM Studio](https://lmstudio.ai) (supports MCP
49
+ servers directly) or another client running a model via Ollama or llama.cpp. Then nothing leaves your machine
50
+ except the requests to comdirect. Pick a model with good tool-calling support.
51
+ - **With a cloud assistant:** check its data retention and training settings, use an account where your data is
52
+ not used for training, and ask only what you need.
53
+
54
+ Details: [Privacy and security](docs/explanation/privacy-and-security.md) ·
55
+ [Use a local model](docs/how-to/use-a-local-model.md)
56
+
57
+ ## Features
58
+
59
+ - **MCP specification 2026-07-28** on the official MCP Python SDK v2, with fallback for older clients
60
+ - **Push TAN login via elicitation**: your client asks you to approve the login in the photoTAN app; the TAN never reaches the model
61
+ - **Credentials in the OS keychain**: `comdirect-mcp configure` stores them once, client configs contain no secrets
62
+ - **No tool can move money**: only read endpoints, truthful tool annotations, structured output with JSON schemas
63
+ - **Protects your access**: stops logging in before comdirect's lock after five unconfirmed TAN challenges, and
64
+ revokes the session at comdirect on logout and shutdown so it cannot be extended
65
+ - **Privacy defaults**: counterparty IBANs masked, documents size-limited, untrusted-content hint for the model
66
+ - **Automatic token refresh** and explicit session handling
67
+ - **Typed Python client** (`py.typed`) for scripts and notebooks, independent of MCP
68
+ - Listed in the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.mad4ms/comdirect-mcp`
69
+
70
+ ### Tools
71
+
72
+ | Tool | Description |
73
+ | --- | --- |
74
+ | `login` | Starts a session; asks you to approve the push TAN |
75
+ | `logout` | Ends the session and revokes it at comdirect (no further refresh) |
76
+ | `list_accounts` | Accounts with balances |
77
+ | `list_transactions` | Transactions of an account, filter by date, direction and state |
78
+ | `list_depots` | Securities accounts |
79
+ | `get_depot_positions` | Positions (name, ISIN, WKN, values, P&L) and depot balance |
80
+ | `list_documents` | Postbox documents (statements, order confirmations, tax documents) |
81
+ | `download_document` | A document as embedded resource (comdirect marks it as read) |
82
+
83
+ Arguments and results: [Tools reference](docs/reference/tools.md).
84
+
85
+ ## Quickstart
86
+
87
+ New to this? Follow the [Getting started tutorial](docs/tutorials/getting-started.md).
88
+
89
+ ### 1. Prerequisites
90
+
91
+ - [uv](https://docs.astral.sh/uv/) (provides `uvx`)
92
+ - comdirect API access: in the online banking under **Verwaltung → Entwicklerzugang** you get a Client ID and
93
+ Client Secret ([step by step](docs/how-to/get-comdirect-api-access.md))
94
+ - **photoTAN Push** as your default TAN method
95
+
96
+ ### 2. Store your credentials in the OS keychain
97
+
98
+ ```bash
99
+ uvx comdirect-mcp@0.4.0 configure
100
+ ```
101
+
102
+ Prompts for Client ID, Client Secret, Zugangsnummer and PIN and stores them in the macOS Keychain, Windows
103
+ Credential Manager or Linux Secret Service. Other options (VS Code inputs, environment, `.env`):
104
+ [Manage credentials](docs/how-to/manage-credentials.md).
105
+
106
+ ### 3. Add the server to your MCP client
107
+
108
+ **Claude Desktop** (*Settings → Developer → Edit Config*) and **LM Studio** (*Program → Install → Edit mcp.json*):
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "comdirect": {
114
+ "command": "uvx",
115
+ "args": ["comdirect-mcp@0.4.0"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ **Claude Code**
122
+
123
+ ```bash
124
+ claude mcp add --transport stdio --scope user comdirect -- uvx comdirect-mcp@0.4.0
125
+ ```
126
+
127
+ **VS Code** (*MCP: Open User Configuration*)
128
+
129
+ ```json
130
+ {
131
+ "servers": {
132
+ "comdirect": {
133
+ "type": "stdio",
134
+ "command": "uvx",
135
+ "args": ["comdirect-mcp@0.4.0"]
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ Pinning the version (`@0.4.0`) means updates only happen when you decide. More clients:
142
+ [Configure MCP clients](docs/how-to/configure-mcp-clients.md).
143
+
144
+ ### 4. Ask
145
+
146
+ > Wie haben sich meine Ausgaben im letzten Monat entwickelt, und welche Depotposition läuft am schlechtesten?
147
+
148
+ The assistant calls `login`, your phone receives the push TAN, you approve it and confirm the dialog in
149
+ your client. Then the assistant can use the other tools. Problems: [Troubleshoot](docs/how-to/troubleshoot.md).
150
+
151
+ ## Python library
152
+
153
+ The same client is available for your own scripts:
154
+
155
+ ```python
156
+ from comdirect_mcp import ComdirectClient
157
+ from comdirect_mcp.utils import default_push_tan_callback
158
+
159
+ client = ComdirectClient(
160
+ {"client_id": "...", "client_secret": "...", "username": "...", "password": "..."},
161
+ {"push_tan_cb": default_push_tan_callback},
162
+ )
163
+ client.login() # approve the push TAN, then press Enter
164
+
165
+ for account in client.list_accounts():
166
+ print(account.id, account.balance, account.currency)
167
+ ```
168
+
169
+ See [Use the Python library](docs/how-to/use-the-python-library.md), the [Python API reference](docs/reference/python-api.md)
170
+ and the [examples](examples/).
171
+
172
+ ## Documentation
173
+
174
+ The [documentation](docs/README.md) is organized as tutorial, how-to guides, reference and explanation:
175
+
176
+ | | |
177
+ | --- | --- |
178
+ | **Tutorial** | [Getting started](docs/tutorials/getting-started.md) |
179
+ | **How-to** | [API access](docs/how-to/get-comdirect-api-access.md) · [Credentials](docs/how-to/manage-credentials.md) · [MCP clients](docs/how-to/configure-mcp-clients.md) · [Local model](docs/how-to/use-a-local-model.md) · [Troubleshoot](docs/how-to/troubleshoot.md) · [Python library](docs/how-to/use-the-python-library.md) · [Develop](docs/how-to/develop.md) |
180
+ | **Reference** | [Tools](docs/reference/tools.md) · [Configuration](docs/reference/configuration.md) · [Python API](docs/reference/python-api.md) |
181
+ | **Explanation** | [Login and sessions](docs/explanation/login-and-sessions.md) · [Privacy and security](docs/explanation/privacy-and-security.md) · [Design](docs/explanation/design.md) |
182
+
183
+ [SECURITY.md](SECURITY.md) describes the threat model and how to report vulnerabilities, [CHANGELOG.md](CHANGELOG.md)
184
+ lists the changes per release.
185
+
186
+ ## Contributing
187
+
188
+ Issues and pull requests are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md) and the
189
+ [Code of Conduct](CODE_OF_CONDUCT.md). AI coding agents find their instructions in [AGENTS.md](AGENTS.md).
190
+
191
+ ## Disclaimer
192
+
193
+ This project is not affiliated with, maintained, or endorsed by comdirect bank AG. Use it at your own risk.
194
+ There is no warranty and no liability for any financial losses or damages resulting from its use.
195
+
196
+ The software runs locally and does not send your credentials anywhere except to comdirect. Your MCP client
197
+ and its model provider receive the data the tools return.
198
+
199
+ ## License
200
+
201
+ [MIT](LICENSE)
@@ -0,0 +1,98 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.0,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "comdirect-mcp"
7
+ version = "0.4.0"
8
+ description = "MCP server and typed Python client for the comdirect banking REST API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: End Users/Desktop",
17
+ "Operating System :: OS Independent",
18
+ "Topic :: Office/Business :: Financial",
19
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Typing :: Typed",
25
+ ]
26
+ keywords = [
27
+ "comdirect",
28
+ "banking",
29
+ "mcp",
30
+ "model-context-protocol",
31
+ "mcp-server",
32
+ "llm",
33
+ "ai-agents",
34
+ ]
35
+ dependencies = [
36
+ "mcp>=2.3.0,<3",
37
+ "keyring>=25.7.0",
38
+ "python-dotenv>=1.2.4",
39
+ "requests>=2.34.2",
40
+ "urllib3>=2.8.0,<3",
41
+ "python-dateutil>=2.9.0.post0",
42
+ "pydantic>=2.14.0,<3",
43
+ "typing-extensions>=4.16.0",
44
+ ]
45
+
46
+ [[project.authors]]
47
+ name = "Michael Adams"
48
+ email = "m@ad4ms.de"
49
+
50
+ [project.optional-dependencies]
51
+ phototan = ["pillow>=12.3.0"]
52
+
53
+ [project.scripts]
54
+ comdirect-mcp = "comdirect_mcp.cli:main"
55
+
56
+ [project.urls]
57
+ Homepage = "https://github.com/mad4ms/comdirect-mcp"
58
+ Documentation = "https://github.com/mad4ms/comdirect-mcp/tree/main/docs"
59
+ Issues = "https://github.com/mad4ms/comdirect-mcp/issues"
60
+ Changelog = "https://github.com/mad4ms/comdirect-mcp/blob/main/CHANGELOG.md"
61
+
62
+ [dependency-groups]
63
+ dev = [
64
+ "comdirect-mcp[phototan]",
65
+ "ruff>=0.17.0",
66
+ "mypy>=2.4.0",
67
+ "pre-commit>=4.6.2",
68
+ "pytest>=9.1.1",
69
+ "openapi-generator-cli>=7.26.0",
70
+ ]
71
+
72
+ [tool.ruff]
73
+ line-length = 119
74
+ target-version = "py312"
75
+ extend-exclude = ["src/comdirect_mcp/_openapi"]
76
+
77
+ [tool.ruff.lint]
78
+ select = [
79
+ "E",
80
+ "F",
81
+ "W",
82
+ "I",
83
+ "UP",
84
+ "B",
85
+ ]
86
+
87
+ [tool.mypy]
88
+ files = ["src/comdirect_mcp"]
89
+ exclude = ["src/comdirect_mcp/_openapi/"]
90
+ check_untyped_defs = true
91
+ ignore_missing_imports = true
92
+
93
+ [[tool.mypy.overrides]]
94
+ module = "comdirect_mcp._openapi.*"
95
+ ignore_errors = true
96
+
97
+ [tool.pytest.ini_options]
98
+ testpaths = ["tests"]
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.0,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "comdirect-mcp"
7
+ version = "0.4.0"
8
+ description = "MCP server and typed Python client for the comdirect banking REST API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "Michael Adams", email = "m@ad4ms.de"}
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: End Users/Desktop",
20
+ "Operating System :: OS Independent",
21
+ "Topic :: Office/Business :: Financial",
22
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Typing :: Typed",
28
+ ]
29
+ keywords = ["comdirect", "banking", "mcp", "model-context-protocol", "mcp-server", "llm", "ai-agents"]
30
+ dependencies = [
31
+ "mcp>=2.3.0,<3",
32
+ "keyring>=25.7.0",
33
+ "python-dotenv>=1.2.4",
34
+ "requests>=2.34.2",
35
+ "urllib3>=2.8.0,<3",
36
+ "python-dateutil>=2.9.0.post0",
37
+ "pydantic>=2.14.0,<3",
38
+ "typing-extensions>=4.16.0",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ # Image display for the interactive PhotoTAN callback in comdirect_mcp.utils
43
+ phototan = [
44
+ "pillow>=12.3.0",
45
+ ]
46
+
47
+ [project.scripts]
48
+ comdirect-mcp = "comdirect_mcp.cli:main"
49
+
50
+ [project.urls]
51
+ Homepage = "https://github.com/mad4ms/comdirect-mcp"
52
+ Documentation = "https://github.com/mad4ms/comdirect-mcp/tree/main/docs"
53
+ Issues = "https://github.com/mad4ms/comdirect-mcp/issues"
54
+ Changelog = "https://github.com/mad4ms/comdirect-mcp/blob/main/CHANGELOG.md"
55
+
56
+ [dependency-groups]
57
+ dev = [
58
+ "comdirect-mcp[phototan]",
59
+ "ruff>=0.17.0",
60
+ "mypy>=2.4.0",
61
+ "pre-commit>=4.6.2",
62
+ "pytest>=9.1.1",
63
+ "openapi-generator-cli>=7.26.0",
64
+ ]
65
+
66
+ [tool.ruff]
67
+ line-length = 119
68
+ target-version = "py312"
69
+ # Generated vendor code, see docs/how-to/regenerate-openapi-client.md
70
+ extend-exclude = ["src/comdirect_mcp/_openapi"]
71
+
72
+ [tool.ruff.lint]
73
+ # pycodestyle, pyflakes, isort, pyupgrade, bugbear
74
+ select = ["E", "F", "W", "I", "UP", "B"]
75
+
76
+ [tool.mypy]
77
+ files = ["src/comdirect_mcp"]
78
+ exclude = ["src/comdirect_mcp/_openapi/"]
79
+ check_untyped_defs = true
80
+ ignore_missing_imports = true
81
+
82
+ [[tool.mypy.overrides]]
83
+ module = "comdirect_mcp._openapi.*"
84
+ ignore_errors = true
85
+
86
+ [tool.pytest.ini_options]
87
+ testpaths = ["tests"]
@@ -0,0 +1,23 @@
1
+ """comdirect REST API client and MCP server."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ from ._openapi.exceptions import ApiException
6
+ from .auth import TanChallenge
7
+ from .client import ComdirectClient
8
+ from .exceptions import AuthenticationError, ComdirectError, TanError
9
+
10
+ try:
11
+ __version__ = version("comdirect-mcp")
12
+ except PackageNotFoundError: # pragma: no cover - running from a source tree without installation
13
+ __version__ = "0.0.0"
14
+
15
+ __all__ = [
16
+ "ApiException",
17
+ "AuthenticationError",
18
+ "ComdirectClient",
19
+ "ComdirectError",
20
+ "TanChallenge",
21
+ "TanError",
22
+ "__version__",
23
+ ]
@@ -0,0 +1,6 @@
1
+ """Allows `python -m comdirect_mcp` to start the MCP server."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()