@stripe/link-cli 0.4.3 → 0.6.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/README.md +48 -4
- package/dist/cli.js +2194 -1100
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -58,6 +58,17 @@ Link CLI can run as a local MCP server. Add the following to your MCP client con
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
#### HTTP MCP Server
|
|
62
|
+
|
|
63
|
+
Use `serve` to expose link-cli as an MCP endpoint over HTTP. This is useful for remote or containerised agents that can't launch a local subprocess.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
link-cli serve # listens on port 54321 by default
|
|
67
|
+
link-cli serve --port 8080
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The MCP endpoint is available at `/mcp` on the chosen port.
|
|
71
|
+
|
|
61
72
|
## Quickstart
|
|
62
73
|
|
|
63
74
|
Run a guided onboarding and demo flow:
|
|
@@ -84,6 +95,14 @@ link-cli payment-methods list
|
|
|
84
95
|
|
|
85
96
|
Returns the cards and bank accounts saved to your Link account. Use the `id` field as `payment_method_id` in the next step. If you have no payment methods, [add new ones in Link](https://app.link.com/wallet).
|
|
86
97
|
|
|
98
|
+
### List shipping addresses
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
link-cli shipping-address list
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Returns the shipping addresses saved to your Link account. The response preserves nullable `nickname`, `address`, and address fields exactly as returned by the API.
|
|
105
|
+
|
|
87
106
|
### Create a spend request
|
|
88
107
|
|
|
89
108
|
Create a spend request with a payment method, merchant details, line items, and amounts:
|
|
@@ -114,7 +133,7 @@ Easily approve requests with the [Link app](https://link.com/download).
|
|
|
114
133
|
--line-item "name:Running Shoes,unit_amount:12000,quantity:1,description:Trail runners"
|
|
115
134
|
```
|
|
116
135
|
|
|
117
|
-
**`--total` keys:** `type` (required; one of: `subtotal`, `tax`, `total`), `display_text` (required), `amount` (required)
|
|
136
|
+
**`--total` keys:** `type` (required; one of: `subtotal`, `tax`, `total`, `items_base_amount`, `items_discount`, `discount`, `fulfillment`, `shipping`, `fee`, `gift_wrap`, `tip`, `store_credit`), `display_text` (required), `amount` (required)
|
|
118
137
|
|
|
119
138
|
```bash
|
|
120
139
|
--total "type:subtotal,display_text:Subtotal,amount:12000" \
|
|
@@ -145,10 +164,10 @@ The file is created with `0600` permissions. If the file already exists, the com
|
|
|
145
164
|
For agent polling, pass `--interval` and optionally `--max-attempts`:
|
|
146
165
|
|
|
147
166
|
```bash
|
|
148
|
-
link-cli spend-request retrieve lsrq_001 --interval 2 --max-attempts
|
|
167
|
+
link-cli spend-request retrieve lsrq_001 --interval 2 --max-attempts 300
|
|
149
168
|
```
|
|
150
169
|
|
|
151
|
-
Polling exits successfully only after the request reaches a terminal status such as `approved`, `denied`, or `
|
|
170
|
+
Polling exits successfully only after the request reaches a terminal status such as `approved`, `denied`, `expired`, or `canceled`. If polling reaches `--timeout` or exhausts `--max-attempts` while the request is still non-terminal, the command exits non-zero with `code: "POLLING_TIMEOUT"` so callers do not treat a still-pending request as complete.
|
|
152
171
|
|
|
153
172
|
If the merchant supports MPP, use `link-cli mpp pay` instead:
|
|
154
173
|
|
|
@@ -165,12 +184,15 @@ link-cli mpp pay https://climate.stripe.dev/api/contribute \
|
|
|
165
184
|
|
|
166
185
|
```bash
|
|
167
186
|
link-cli auth login --client-name "Claude Code" # identify the connecting agent
|
|
187
|
+
link-cli auth login --client-name "Claude Code" --interval 5 --timeout 300 # login + poll in one call
|
|
168
188
|
link-cli auth status # check auth status
|
|
169
189
|
link-cli auth logout # disconnect
|
|
170
190
|
```
|
|
171
191
|
|
|
172
192
|
When you provide `--client-name`, the Link app displays it when you approve the connection — for example, `Claude Code on my-macbook` instead of `link-cli on my-macbook`.
|
|
173
193
|
|
|
194
|
+
With `--interval`, the login command yields the verification code immediately and then polls inline until authenticated or timed out — no separate `auth status` call needed. This is recommended for agents that cannot relay the code while a separate polling command blocks their I/O channel.
|
|
195
|
+
|
|
174
196
|
`auth status` includes an `update` field when a newer version is available:
|
|
175
197
|
|
|
176
198
|
```json
|
|
@@ -186,13 +208,15 @@ When you provide `--client-name`, the Link app displays it when you approve the
|
|
|
186
208
|
|
|
187
209
|
Set `NO_UPDATE_NOTIFIER=1` to suppress update checks (for example, in CI).
|
|
188
210
|
|
|
211
|
+
All commands accept `--auth <path>` to store auth credentials in a specific file instead of the default location. `auth login` writes to this file; all other commands read from it. Useful for running multiple sessions with separate identities.
|
|
212
|
+
|
|
189
213
|
### Spend request lifecycle
|
|
190
214
|
|
|
191
215
|
A spend request moves through: **create** → **request approval** → **approved** (with credentials).
|
|
192
216
|
|
|
193
217
|
**Required fields for create:** `payment_method_id`, `merchant_name`, `merchant_url`, `context`, `amount`
|
|
194
218
|
|
|
195
|
-
**Constraints:** `context` must be at least 100 characters; `amount` must not exceed 50000 (cents); `currency` must be a 3-letter ISO code.
|
|
219
|
+
**Constraints:** `context` must be at least 100 characters; `amount` must not exceed 50000 (cents); `currency` must be a 3-letter ISO code. The user has 10 minutes from when approval is requested to approve. Approved credentials (card or SPT) are valid for 12 hours from spend request creation.
|
|
196
220
|
**Test mode:** Pass `--test` to create testmode credentials (uses test card `4242424242424242`), useful for development and integration testing without real payment methods.
|
|
197
221
|
|
|
198
222
|
```bash
|
|
@@ -205,8 +229,24 @@ link-cli spend-request request-approval lsrq_001
|
|
|
205
229
|
|
|
206
230
|
# Retrieve at any time (includes card credentials after approval)
|
|
207
231
|
link-cli spend-request retrieve lsrq_001
|
|
232
|
+
|
|
233
|
+
# Cancel a spend request (from created, pending_approval, or approved state)
|
|
234
|
+
link-cli spend-request cancel lsrq_001
|
|
208
235
|
```
|
|
209
236
|
|
|
237
|
+
### Limits
|
|
238
|
+
|
|
239
|
+
| Limit | Value |
|
|
240
|
+
|-------|-------|
|
|
241
|
+
| Max amount per spend request | $500 (50,000 cents) |
|
|
242
|
+
| Approval window | 10 minutes — user must approve within 10 min of `request-approval` |
|
|
243
|
+
| Card / SPT validity | 12 hours from spend request creation |
|
|
244
|
+
| Daily spend | $500 |
|
|
245
|
+
| Concurrent active requests (created + approved) | 30 |
|
|
246
|
+
| Concurrent approved requests | 10 |
|
|
247
|
+
| Hourly creation rate | 50 per hour |
|
|
248
|
+
| Rolling creation rate | 200 per 60 days |
|
|
249
|
+
|
|
210
250
|
### MPP
|
|
211
251
|
|
|
212
252
|
Use `mpp pay` to complete purchases on merchants that use the [Machine Payments Protocol](https://mpp.dev). The spend request must use `credential_type: "shared_payment_token"` and you must approve it before paying. The SPT is one-time-use — if payment fails, create a new spend request.
|
|
@@ -230,6 +270,10 @@ link-cli mpp decode \
|
|
|
230
270
|
|
|
231
271
|
| Variable | Effect |
|
|
232
272
|
|----------|--------|
|
|
273
|
+
| `LINK_AUTH_FILE` | Same as `--auth` — override the auth credential file path (flag takes precedence) |
|
|
274
|
+
| `LINK_ACCESS_TOKEN` | Use this access token directly, bypassing auth storage |
|
|
275
|
+
| `LINK_REFRESH_TOKEN` | Refresh token to use when `LINK_ACCESS_TOKEN` is expired |
|
|
276
|
+
| `LINK_NO_REFRESH` | When set, never auto-refresh the access token — error instead |
|
|
233
277
|
| `LINK_API_BASE_URL` | Override the API base URL |
|
|
234
278
|
| `LINK_AUTH_BASE_URL` | Override the auth base URL |
|
|
235
279
|
| `LINK_HTTP_PROXY` | Route all requests through an HTTP proxy (requires `undici`) |
|