@ktmcp-cli/nordigen 1.0.0
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.
- package/.env.example +11 -0
- package/.eslintrc.json +17 -0
- package/AGENT.md +480 -0
- package/CHANGELOG.md +69 -0
- package/CONTRIBUTING.md +198 -0
- package/EXAMPLES.md +561 -0
- package/INDEX.md +193 -0
- package/LICENSE +21 -0
- package/OPENCLAW.md +468 -0
- package/PROJECT.md +366 -0
- package/QUICKREF.md +231 -0
- package/README.md +424 -0
- package/SETUP.md +259 -0
- package/SUMMARY.md +419 -0
- package/banner.png +0 -0
- package/bin/nordigen.js +84 -0
- package/logo.png +0 -0
- package/package.json +40 -0
- package/scripts/quickstart.sh +110 -0
- package/src/commands/accounts.js +205 -0
- package/src/commands/agreements.js +241 -0
- package/src/commands/auth.js +86 -0
- package/src/commands/config.js +173 -0
- package/src/commands/institutions.js +181 -0
- package/src/commands/payments.js +228 -0
- package/src/commands/requisitions.js +239 -0
- package/src/lib/api.js +491 -0
- package/src/lib/auth.js +113 -0
- package/src/lib/config.js +145 -0
- package/src/lib/output.js +255 -0
- package/test/api.test.js +88 -0
package/INDEX.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Nordigen CLI - Documentation Index
|
|
2
|
+
|
|
3
|
+
Quick navigation guide to all project documentation.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
**New to Nordigen CLI? Start here:**
|
|
8
|
+
|
|
9
|
+
1. [SETUP.md](./SETUP.md) - Installation and setup guide
|
|
10
|
+
2. [QUICKREF.md](./QUICKREF.md) - Quick reference card
|
|
11
|
+
3. [README.md](./README.md) - Complete user guide
|
|
12
|
+
|
|
13
|
+
## Documentation Files
|
|
14
|
+
|
|
15
|
+
### User Documentation
|
|
16
|
+
|
|
17
|
+
| File | Purpose | Lines |
|
|
18
|
+
|------|---------|-------|
|
|
19
|
+
| [README.md](./README.md) | Main documentation, usage guide | 380 |
|
|
20
|
+
| [QUICKREF.md](./QUICKREF.md) | Quick reference card | 150 |
|
|
21
|
+
| [SETUP.md](./SETUP.md) | Installation & setup | 180 |
|
|
22
|
+
| [EXAMPLES.md](./EXAMPLES.md) | Practical examples | 600 |
|
|
23
|
+
|
|
24
|
+
### Integration Guides
|
|
25
|
+
|
|
26
|
+
| File | Purpose | Lines |
|
|
27
|
+
|------|---------|-------|
|
|
28
|
+
| [AGENT.md](./AGENT.md) | AI agent integration patterns | 440 |
|
|
29
|
+
| [OPENCLAW.md](./OPENCLAW.md) | OpenClaw integration guide | 520 |
|
|
30
|
+
|
|
31
|
+
### Developer Documentation
|
|
32
|
+
|
|
33
|
+
| File | Purpose | Lines |
|
|
34
|
+
|------|---------|-------|
|
|
35
|
+
| [CONTRIBUTING.md](./CONTRIBUTING.md) | Development guidelines | 180 |
|
|
36
|
+
| [PROJECT.md](./PROJECT.md) | Project overview | 450 |
|
|
37
|
+
| [CHANGELOG.md](./CHANGELOG.md) | Version history | 70 |
|
|
38
|
+
| [SUMMARY.md](./SUMMARY.md) | Project completion summary | 350 |
|
|
39
|
+
|
|
40
|
+
## By Use Case
|
|
41
|
+
|
|
42
|
+
### I want to...
|
|
43
|
+
|
|
44
|
+
#### Install and configure
|
|
45
|
+
→ [SETUP.md](./SETUP.md)
|
|
46
|
+
|
|
47
|
+
#### Learn the basics
|
|
48
|
+
→ [QUICKREF.md](./QUICKREF.md)
|
|
49
|
+
→ [README.md](./README.md)
|
|
50
|
+
|
|
51
|
+
#### See examples
|
|
52
|
+
→ [EXAMPLES.md](./EXAMPLES.md)
|
|
53
|
+
|
|
54
|
+
#### Build with AI agents
|
|
55
|
+
→ [AGENT.md](./AGENT.md)
|
|
56
|
+
|
|
57
|
+
#### Integrate with OpenClaw
|
|
58
|
+
→ [OPENCLAW.md](./OPENCLAW.md)
|
|
59
|
+
|
|
60
|
+
#### Contribute to the project
|
|
61
|
+
→ [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
62
|
+
|
|
63
|
+
#### Understand the architecture
|
|
64
|
+
→ [PROJECT.md](./PROJECT.md)
|
|
65
|
+
|
|
66
|
+
#### Check what's new
|
|
67
|
+
→ [CHANGELOG.md](./CHANGELOG.md)
|
|
68
|
+
|
|
69
|
+
## Code Documentation
|
|
70
|
+
|
|
71
|
+
### Core Files
|
|
72
|
+
|
|
73
|
+
| File | Purpose | Lines |
|
|
74
|
+
|------|---------|-------|
|
|
75
|
+
| [bin/nordigen.js](./bin/nordigen.js) | CLI entry point | 94 |
|
|
76
|
+
| [src/lib/api.js](./src/lib/api.js) | API client | 418 |
|
|
77
|
+
| [src/lib/auth.js](./src/lib/auth.js) | Authentication | 108 |
|
|
78
|
+
| [src/lib/config.js](./src/lib/config.js) | Configuration | 108 |
|
|
79
|
+
| [src/lib/output.js](./src/lib/output.js) | Output formatting | 222 |
|
|
80
|
+
|
|
81
|
+
### Command Modules
|
|
82
|
+
|
|
83
|
+
| File | Purpose | Lines |
|
|
84
|
+
|------|---------|-------|
|
|
85
|
+
| [src/commands/auth.js](./src/commands/auth.js) | Auth commands | 76 |
|
|
86
|
+
| [src/commands/accounts.js](./src/commands/accounts.js) | Account commands | 164 |
|
|
87
|
+
| [src/commands/institutions.js](./src/commands/institutions.js) | Institution commands | 149 |
|
|
88
|
+
| [src/commands/agreements.js](./src/commands/agreements.js) | Agreement commands | 200 |
|
|
89
|
+
| [src/commands/requisitions.js](./src/commands/requisitions.js) | Requisition commands | 182 |
|
|
90
|
+
| [src/commands/payments.js](./src/commands/payments.js) | Payment commands | 152 |
|
|
91
|
+
| [src/commands/config.js](./src/commands/config.js) | Config commands | 127 |
|
|
92
|
+
|
|
93
|
+
## Quick Links
|
|
94
|
+
|
|
95
|
+
### Essential Commands
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Get help
|
|
99
|
+
nordigen --help
|
|
100
|
+
|
|
101
|
+
# Check version
|
|
102
|
+
nordigen --version
|
|
103
|
+
|
|
104
|
+
# Authentication
|
|
105
|
+
nordigen auth login --secret-id <ID> --secret-key <KEY>
|
|
106
|
+
nordigen auth status
|
|
107
|
+
|
|
108
|
+
# Quick test
|
|
109
|
+
nordigen institutions list --country GB
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Common Workflows
|
|
113
|
+
|
|
114
|
+
See [EXAMPLES.md](./EXAMPLES.md) for:
|
|
115
|
+
- Complete bank connection flow
|
|
116
|
+
- Daily balance checks
|
|
117
|
+
- Transaction analysis
|
|
118
|
+
- Scripting patterns
|
|
119
|
+
- Automation examples
|
|
120
|
+
|
|
121
|
+
### API Reference
|
|
122
|
+
|
|
123
|
+
Official Nordigen API documentation:
|
|
124
|
+
- https://nordigen.com/en/docs/
|
|
125
|
+
- https://ob.nordigen.com/api/swagger/
|
|
126
|
+
|
|
127
|
+
## File Organization
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
nordigen-cli/
|
|
131
|
+
├── Documentation (*.md)
|
|
132
|
+
│ ├── User guides → README, SETUP, QUICKREF, EXAMPLES
|
|
133
|
+
│ ├── Integration guides → AGENT, OPENCLAW
|
|
134
|
+
│ └── Developer docs → CONTRIBUTING, PROJECT, CHANGELOG
|
|
135
|
+
│
|
|
136
|
+
├── Source code (src/)
|
|
137
|
+
│ ├── commands/ → Command implementations
|
|
138
|
+
│ └── lib/ → Core libraries
|
|
139
|
+
│
|
|
140
|
+
├── Entry point (bin/)
|
|
141
|
+
│ └── nordigen.js → Main CLI
|
|
142
|
+
│
|
|
143
|
+
├── Tests (test/)
|
|
144
|
+
│ └── *.test.js → Unit tests
|
|
145
|
+
│
|
|
146
|
+
└── Configuration
|
|
147
|
+
├── package.json → NPM config
|
|
148
|
+
├── .eslintrc.json → Linting
|
|
149
|
+
└── .env.example → Environment template
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Support Resources
|
|
153
|
+
|
|
154
|
+
- **GitHub Issues**: https://github.com/ktmcp/nordigen-cli/issues
|
|
155
|
+
- **API Docs**: https://nordigen.com/en/docs/
|
|
156
|
+
- **Examples**: [EXAMPLES.md](./EXAMPLES.md)
|
|
157
|
+
- **Troubleshooting**: [SETUP.md](./SETUP.md#troubleshooting)
|
|
158
|
+
|
|
159
|
+
## Project Statistics
|
|
160
|
+
|
|
161
|
+
- **Total Files**: 27
|
|
162
|
+
- **Total Lines**: 5,321
|
|
163
|
+
- **Commands**: 40+ subcommands
|
|
164
|
+
- **API Endpoints**: 27 implemented
|
|
165
|
+
- **Documentation**: 3,200+ lines
|
|
166
|
+
|
|
167
|
+
## Version Information
|
|
168
|
+
|
|
169
|
+
- **Current Version**: 1.0.0
|
|
170
|
+
- **Release Date**: 2024-02-16
|
|
171
|
+
- **License**: MIT
|
|
172
|
+
- **Node.js**: 18+ required
|
|
173
|
+
|
|
174
|
+
## Learning Path
|
|
175
|
+
|
|
176
|
+
### Beginner
|
|
177
|
+
1. Install → [SETUP.md](./SETUP.md)
|
|
178
|
+
2. Learn basics → [QUICKREF.md](./QUICKREF.md)
|
|
179
|
+
3. Try examples → [EXAMPLES.md](./EXAMPLES.md)
|
|
180
|
+
|
|
181
|
+
### Intermediate
|
|
182
|
+
1. Read full guide → [README.md](./README.md)
|
|
183
|
+
2. Explore examples → [EXAMPLES.md](./EXAMPLES.md)
|
|
184
|
+
3. Learn scripting → [EXAMPLES.md](./EXAMPLES.md#scripting-and-automation)
|
|
185
|
+
|
|
186
|
+
### Advanced
|
|
187
|
+
1. Study architecture → [PROJECT.md](./PROJECT.md)
|
|
188
|
+
2. AI integration → [AGENT.md](./AGENT.md)
|
|
189
|
+
3. Contribute → [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
**Navigation tip**: Use your editor's file search (Ctrl+P / Cmd+P) to quickly jump to any documentation file.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 KTMCP
|
|
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.
|
package/OPENCLAW.md
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# Nordigen CLI - OpenClaw Integration Guide
|
|
2
|
+
|
|
3
|
+
Integration guide for using the Nordigen CLI with OpenClaw (the open-source MCP alternative for Claude).
|
|
4
|
+
|
|
5
|
+
## What is OpenClaw?
|
|
6
|
+
|
|
7
|
+
OpenClaw is a lightweight, open-source protocol for integrating tools with Claude and other AI assistants. Unlike MCP (Model Context Protocol), OpenClaw emphasizes:
|
|
8
|
+
|
|
9
|
+
- Simplicity over complexity
|
|
10
|
+
- CLI-first design
|
|
11
|
+
- Zero protocol overhead
|
|
12
|
+
- Direct tool invocation
|
|
13
|
+
|
|
14
|
+
## Why Nordigen CLI + OpenClaw?
|
|
15
|
+
|
|
16
|
+
The Nordigen CLI is designed to work seamlessly with OpenClaw because:
|
|
17
|
+
|
|
18
|
+
1. **Native CLI interface** - No protocol translation needed
|
|
19
|
+
2. **JSON output** - All commands support `--json` for structured data
|
|
20
|
+
3. **Consistent error handling** - Exit codes and stderr for errors
|
|
21
|
+
4. **Composable commands** - UNIX philosophy for piping and chaining
|
|
22
|
+
5. **Stateless by default** - Each command is independent
|
|
23
|
+
|
|
24
|
+
## OpenClaw Tool Definition
|
|
25
|
+
|
|
26
|
+
Create a tool definition for OpenClaw to expose Nordigen CLI capabilities:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
# openclaw-tools/nordigen.yaml
|
|
30
|
+
name: nordigen
|
|
31
|
+
description: Access open banking data via Nordigen API
|
|
32
|
+
version: 1.0.0
|
|
33
|
+
|
|
34
|
+
tools:
|
|
35
|
+
- name: list_institutions
|
|
36
|
+
description: List supported financial institutions
|
|
37
|
+
command: nordigen institutions list --country {country} --json
|
|
38
|
+
parameters:
|
|
39
|
+
- name: country
|
|
40
|
+
type: string
|
|
41
|
+
required: true
|
|
42
|
+
description: ISO 3166 country code (GB, DE, FR, etc.)
|
|
43
|
+
- name: payments
|
|
44
|
+
type: boolean
|
|
45
|
+
required: false
|
|
46
|
+
description: Filter institutions supporting payments
|
|
47
|
+
output: json
|
|
48
|
+
|
|
49
|
+
- name: search_institutions
|
|
50
|
+
description: Search for institutions by name
|
|
51
|
+
command: nordigen institutions search "{query}" --country {country} --json
|
|
52
|
+
parameters:
|
|
53
|
+
- name: query
|
|
54
|
+
type: string
|
|
55
|
+
required: true
|
|
56
|
+
description: Search query
|
|
57
|
+
- name: country
|
|
58
|
+
type: string
|
|
59
|
+
required: true
|
|
60
|
+
description: ISO 3166 country code
|
|
61
|
+
|
|
62
|
+
- name: get_account_balances
|
|
63
|
+
description: Get account balances
|
|
64
|
+
command: nordigen accounts balances {account_id} --json
|
|
65
|
+
parameters:
|
|
66
|
+
- name: account_id
|
|
67
|
+
type: string
|
|
68
|
+
required: true
|
|
69
|
+
description: Account UUID
|
|
70
|
+
|
|
71
|
+
- name: get_account_transactions
|
|
72
|
+
description: Get account transactions
|
|
73
|
+
command: nordigen accounts transactions {account_id} --from {date_from} --to {date_to} --json
|
|
74
|
+
parameters:
|
|
75
|
+
- name: account_id
|
|
76
|
+
type: string
|
|
77
|
+
required: true
|
|
78
|
+
description: Account UUID
|
|
79
|
+
- name: date_from
|
|
80
|
+
type: string
|
|
81
|
+
required: false
|
|
82
|
+
description: Start date (YYYY-MM-DD)
|
|
83
|
+
- name: date_to
|
|
84
|
+
type: string
|
|
85
|
+
required: false
|
|
86
|
+
description: End date (YYYY-MM-DD)
|
|
87
|
+
|
|
88
|
+
- name: create_requisition
|
|
89
|
+
description: Create bank account connection requisition
|
|
90
|
+
command: nordigen requisitions create --institution-id {institution_id} --redirect {redirect_url} --json
|
|
91
|
+
parameters:
|
|
92
|
+
- name: institution_id
|
|
93
|
+
type: string
|
|
94
|
+
required: true
|
|
95
|
+
description: Institution ID
|
|
96
|
+
- name: redirect_url
|
|
97
|
+
type: string
|
|
98
|
+
required: true
|
|
99
|
+
description: Redirect URL after authentication
|
|
100
|
+
|
|
101
|
+
- name: list_requisitions
|
|
102
|
+
description: List all requisitions
|
|
103
|
+
command: nordigen requisitions list --json
|
|
104
|
+
|
|
105
|
+
- name: get_requisition
|
|
106
|
+
description: Get requisition details
|
|
107
|
+
command: nordigen requisitions get {requisition_id} --json
|
|
108
|
+
parameters:
|
|
109
|
+
- name: requisition_id
|
|
110
|
+
type: string
|
|
111
|
+
required: true
|
|
112
|
+
description: Requisition UUID
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Usage with Claude
|
|
116
|
+
|
|
117
|
+
### Example 1: Finding a Bank
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
User: "Find banks in Germany that support payments"
|
|
121
|
+
|
|
122
|
+
Claude (using OpenClaw):
|
|
123
|
+
<tool_use>
|
|
124
|
+
<tool>nordigen.list_institutions</tool>
|
|
125
|
+
<parameters>
|
|
126
|
+
<country>DE</country>
|
|
127
|
+
<payments>true</payments>
|
|
128
|
+
</parameters>
|
|
129
|
+
</tool_use>
|
|
130
|
+
|
|
131
|
+
[Tool returns JSON list of German banks with payment support]
|
|
132
|
+
|
|
133
|
+
Claude response:
|
|
134
|
+
"I found 47 banks in Germany that support payments. The most popular ones include:
|
|
135
|
+
1. Deutsche Bank (DEUTSCHE_DEUTDEFF)
|
|
136
|
+
2. Commerzbank (COMMERZBANK_COBADEFF)
|
|
137
|
+
3. N26 (N26_NTSBDEB1)
|
|
138
|
+
..."
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Example 2: Analyzing Transactions
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
User: "Show me my spending on restaurants last month"
|
|
145
|
+
|
|
146
|
+
Claude (using OpenClaw):
|
|
147
|
+
<tool_use>
|
|
148
|
+
<tool>nordigen.get_account_transactions</tool>
|
|
149
|
+
<parameters>
|
|
150
|
+
<account_id>abc-123-def-456</account_id>
|
|
151
|
+
<date_from>2024-01-01</date_from>
|
|
152
|
+
<date_to>2024-01-31</date_to>
|
|
153
|
+
</parameters>
|
|
154
|
+
</tool_use>
|
|
155
|
+
|
|
156
|
+
[Tool returns transaction JSON]
|
|
157
|
+
|
|
158
|
+
Claude analyzes and responds:
|
|
159
|
+
"Based on your January transactions, you spent £287.50 at restaurants:
|
|
160
|
+
- Pizza Express: £42.50 (Jan 5)
|
|
161
|
+
- Nando's: £38.20 (Jan 12)
|
|
162
|
+
- Local Italian: £67.80 (Jan 18)
|
|
163
|
+
..."
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Advanced OpenClaw Patterns
|
|
167
|
+
|
|
168
|
+
### Pattern 1: Composite Tools
|
|
169
|
+
|
|
170
|
+
Create higher-level tools that combine multiple CLI commands:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# openclaw-tools/nordigen-advanced.yaml
|
|
174
|
+
tools:
|
|
175
|
+
- name: complete_bank_connection
|
|
176
|
+
description: Complete flow to connect a bank account
|
|
177
|
+
type: composite
|
|
178
|
+
steps:
|
|
179
|
+
- tool: nordigen.search_institutions
|
|
180
|
+
save_as: institutions
|
|
181
|
+
- tool: nordigen.create_agreement
|
|
182
|
+
params:
|
|
183
|
+
institution_id: "{institutions[0].id}"
|
|
184
|
+
save_as: agreement
|
|
185
|
+
- tool: nordigen.create_requisition
|
|
186
|
+
params:
|
|
187
|
+
institution_id: "{institutions[0].id}"
|
|
188
|
+
agreement: "{agreement.id}"
|
|
189
|
+
|
|
190
|
+
- name: financial_health_check
|
|
191
|
+
description: Complete financial health analysis
|
|
192
|
+
type: composite
|
|
193
|
+
steps:
|
|
194
|
+
- tool: nordigen.list_requisitions
|
|
195
|
+
save_as: reqs
|
|
196
|
+
- tool: nordigen.get_account_balances
|
|
197
|
+
for_each: "{reqs.results[].accounts[]}"
|
|
198
|
+
save_as: balances
|
|
199
|
+
- tool: nordigen.get_account_transactions
|
|
200
|
+
for_each: "{reqs.results[].accounts[]}"
|
|
201
|
+
params:
|
|
202
|
+
date_from: "-30d" # Special syntax for relative dates
|
|
203
|
+
save_as: transactions
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Pattern 2: Cached Responses
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
tools:
|
|
210
|
+
- name: list_institutions
|
|
211
|
+
command: nordigen institutions list --country {country} --json
|
|
212
|
+
cache:
|
|
213
|
+
ttl: 86400 # 24 hours
|
|
214
|
+
key: "institutions:{country}"
|
|
215
|
+
# Institution lists rarely change, safe to cache
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Pattern 3: Error Recovery
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
tools:
|
|
222
|
+
- name: get_account_balances
|
|
223
|
+
command: nordigen accounts balances {account_id} --json
|
|
224
|
+
error_handling:
|
|
225
|
+
- on: "Not authenticated"
|
|
226
|
+
retry_with: nordigen auth login --secret-id $NORDIGEN_SECRET_ID --secret-key $NORDIGEN_SECRET_KEY
|
|
227
|
+
- on: "Token is invalid or expired"
|
|
228
|
+
retry_with: nordigen auth status && nordigen accounts balances {account_id} --json
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## OpenClaw Server Setup
|
|
232
|
+
|
|
233
|
+
If you want to run Nordigen CLI as an OpenClaw server:
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
// openclaw-server.js
|
|
237
|
+
import { spawn } from 'child_process';
|
|
238
|
+
import express from 'express';
|
|
239
|
+
|
|
240
|
+
const app = express();
|
|
241
|
+
app.use(express.json());
|
|
242
|
+
|
|
243
|
+
app.post('/tools/nordigen/:command', async (req, res) => {
|
|
244
|
+
const { command } = req.params;
|
|
245
|
+
const { params } = req.body;
|
|
246
|
+
|
|
247
|
+
// Build CLI command
|
|
248
|
+
let cmd = `nordigen ${command}`;
|
|
249
|
+
|
|
250
|
+
// Add parameters
|
|
251
|
+
if (params) {
|
|
252
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
253
|
+
if (typeof value === 'boolean' && value) {
|
|
254
|
+
cmd += ` --${key}`;
|
|
255
|
+
} else if (value) {
|
|
256
|
+
cmd += ` --${key} ${JSON.stringify(value)}`;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
cmd += ' --json';
|
|
262
|
+
|
|
263
|
+
// Execute
|
|
264
|
+
const child = spawn('sh', ['-c', cmd]);
|
|
265
|
+
let stdout = '';
|
|
266
|
+
let stderr = '';
|
|
267
|
+
|
|
268
|
+
child.stdout.on('data', (data) => { stdout += data; });
|
|
269
|
+
child.stderr.on('data', (data) => { stderr += data; });
|
|
270
|
+
|
|
271
|
+
child.on('close', (code) => {
|
|
272
|
+
if (code === 0) {
|
|
273
|
+
res.json({ success: true, data: JSON.parse(stdout) });
|
|
274
|
+
} else {
|
|
275
|
+
res.status(500).json({ success: false, error: stderr });
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
app.listen(3000, () => {
|
|
281
|
+
console.log('OpenClaw Nordigen server running on port 3000');
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Run the server:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
node openclaw-server.js
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Now Claude can call:
|
|
292
|
+
|
|
293
|
+
```http
|
|
294
|
+
POST /tools/nordigen/institutions
|
|
295
|
+
{
|
|
296
|
+
"params": {
|
|
297
|
+
"command": "list",
|
|
298
|
+
"country": "GB"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Environment Configuration
|
|
304
|
+
|
|
305
|
+
OpenClaw can manage Nordigen CLI configuration via environment:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# .env
|
|
309
|
+
NORDIGEN_SECRET_ID=your_secret_id
|
|
310
|
+
NORDIGEN_SECRET_KEY=your_secret_key
|
|
311
|
+
NORDIGEN_DEFAULT_COUNTRY=GB
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Update tool definitions to use env vars:
|
|
315
|
+
|
|
316
|
+
```yaml
|
|
317
|
+
tools:
|
|
318
|
+
- name: auto_auth
|
|
319
|
+
description: Automatically authenticate if needed
|
|
320
|
+
command: |
|
|
321
|
+
if ! nordigen auth status 2>/dev/null; then
|
|
322
|
+
nordigen auth login \
|
|
323
|
+
--secret-id $NORDIGEN_SECRET_ID \
|
|
324
|
+
--secret-key $NORDIGEN_SECRET_KEY
|
|
325
|
+
fi
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Security Considerations
|
|
329
|
+
|
|
330
|
+
### 1. Credential Isolation
|
|
331
|
+
|
|
332
|
+
Use separate config profiles for different Claude contexts:
|
|
333
|
+
|
|
334
|
+
```yaml
|
|
335
|
+
tools:
|
|
336
|
+
- name: list_institutions_user
|
|
337
|
+
command: XDG_CONFIG_HOME=/home/user/.config-{user_id} nordigen institutions list --country {country} --json
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### 2. Rate Limiting
|
|
341
|
+
|
|
342
|
+
Implement rate limiting at the OpenClaw level:
|
|
343
|
+
|
|
344
|
+
```yaml
|
|
345
|
+
tools:
|
|
346
|
+
- name: get_account_transactions
|
|
347
|
+
command: nordigen accounts transactions {account_id} --json
|
|
348
|
+
rate_limit:
|
|
349
|
+
max_calls: 10
|
|
350
|
+
per_seconds: 60
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### 3. Access Control
|
|
354
|
+
|
|
355
|
+
Restrict which commands Claude can execute:
|
|
356
|
+
|
|
357
|
+
```yaml
|
|
358
|
+
# Only allow read operations
|
|
359
|
+
allowed_commands:
|
|
360
|
+
- nordigen institutions list
|
|
361
|
+
- nordigen institutions search
|
|
362
|
+
- nordigen institutions get
|
|
363
|
+
- nordigen accounts get
|
|
364
|
+
- nordigen accounts balances
|
|
365
|
+
- nordigen accounts transactions
|
|
366
|
+
- nordigen requisitions list
|
|
367
|
+
- nordigen requisitions get
|
|
368
|
+
|
|
369
|
+
# Deny destructive operations
|
|
370
|
+
denied_commands:
|
|
371
|
+
- nordigen requisitions delete
|
|
372
|
+
- nordigen agreements delete
|
|
373
|
+
- nordigen auth logout
|
|
374
|
+
- nordigen config clear
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## Monitoring and Logging
|
|
378
|
+
|
|
379
|
+
### Command Logging
|
|
380
|
+
|
|
381
|
+
```javascript
|
|
382
|
+
// Log all CLI commands executed by Claude
|
|
383
|
+
function logCommand(command, user, timestamp) {
|
|
384
|
+
const log = {
|
|
385
|
+
timestamp,
|
|
386
|
+
user,
|
|
387
|
+
command,
|
|
388
|
+
tool: 'nordigen'
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
fs.appendFileSync('openclaw-audit.log', JSON.stringify(log) + '\n');
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Performance Metrics
|
|
396
|
+
|
|
397
|
+
```javascript
|
|
398
|
+
// Track command execution time
|
|
399
|
+
async function executeWithMetrics(command) {
|
|
400
|
+
const start = Date.now();
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
const result = await exec(command);
|
|
404
|
+
const duration = Date.now() - start;
|
|
405
|
+
|
|
406
|
+
metrics.record('nordigen.command.success', duration);
|
|
407
|
+
return result;
|
|
408
|
+
} catch (error) {
|
|
409
|
+
const duration = Date.now() - start;
|
|
410
|
+
metrics.record('nordigen.command.error', duration);
|
|
411
|
+
throw error;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## Testing OpenClaw Integration
|
|
417
|
+
|
|
418
|
+
```javascript
|
|
419
|
+
// test-openclaw.js
|
|
420
|
+
import { execSync } from 'child_process';
|
|
421
|
+
|
|
422
|
+
function testTool(toolName, params) {
|
|
423
|
+
const command = buildCommand(toolName, params);
|
|
424
|
+
console.log(`Testing: ${command}`);
|
|
425
|
+
|
|
426
|
+
try {
|
|
427
|
+
const result = execSync(command, { encoding: 'utf-8' });
|
|
428
|
+
const data = JSON.parse(result);
|
|
429
|
+
console.log('✓ Success:', data);
|
|
430
|
+
return { success: true, data };
|
|
431
|
+
} catch (error) {
|
|
432
|
+
console.log('✗ Failed:', error.message);
|
|
433
|
+
return { success: false, error: error.message };
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Run tests
|
|
438
|
+
testTool('list_institutions', { country: 'GB' });
|
|
439
|
+
testTool('search_institutions', { query: 'Barclays', country: 'GB' });
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Best Practices
|
|
443
|
+
|
|
444
|
+
1. **Always use --json flag**: Ensures structured output for parsing
|
|
445
|
+
2. **Handle errors gracefully**: Check exit codes and parse stderr
|
|
446
|
+
3. **Cache institution lists**: They change infrequently
|
|
447
|
+
4. **Use environment variables**: For credentials and defaults
|
|
448
|
+
5. **Implement timeouts**: Prevent hanging on slow API calls
|
|
449
|
+
6. **Log all operations**: For audit and debugging
|
|
450
|
+
7. **Validate inputs**: Before passing to CLI commands
|
|
451
|
+
|
|
452
|
+
## Comparison: CLI + OpenClaw vs MCP
|
|
453
|
+
|
|
454
|
+
| Aspect | CLI + OpenClaw | MCP |
|
|
455
|
+
|--------|----------------|-----|
|
|
456
|
+
| Setup | Install CLI, define YAML | Implement MCP protocol |
|
|
457
|
+
| Latency | ~50ms | ~200ms (protocol overhead) |
|
|
458
|
+
| Debugging | Standard tools (strace, etc.) | MCP-specific tools |
|
|
459
|
+
| Language Support | Any (subprocess) | Limited to MCP clients |
|
|
460
|
+
| State Management | Stateless (file-based config) | Stateful server |
|
|
461
|
+
| Resource Usage | Minimal | Higher (persistent server) |
|
|
462
|
+
| Learning Curve | Low (standard CLI) | Higher (new protocol) |
|
|
463
|
+
|
|
464
|
+
## Conclusion
|
|
465
|
+
|
|
466
|
+
The Nordigen CLI + OpenClaw integration provides a simple, performant, and flexible way to give Claude access to open banking data. By leveraging standard CLI patterns and JSON output, you avoid protocol complexity while maintaining full functionality.
|
|
467
|
+
|
|
468
|
+
For most use cases, this approach is simpler and more maintainable than MCP, while providing equivalent or better performance.
|