authflow-cli 0.5.0 → 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 +61 -492
- package/dist/commands/account.d.ts +2 -0
- package/dist/commands/account.js +105 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/mcp.js +11 -6
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/plan.js +7 -7
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/signup.d.ts +1 -0
- package/dist/commands/signup.js +4 -50
- package/dist/commands/signup.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/credentials.d.ts +22 -0
- package/dist/credentials.js +206 -0
- package/dist/credentials.js.map +1 -0
- package/dist/integration-plans.json +80 -0
- package/dist/integration.d.ts +17 -23
- package/dist/integration.js +29 -236
- package/dist/integration.js.map +1 -1
- package/dist/login.d.ts +11 -0
- package/dist/login.js +181 -0
- package/dist/login.js.map +1 -0
- package/dist/management.d.ts +17 -0
- package/dist/management.js +67 -0
- package/dist/management.js.map +1 -0
- package/dist/mcp/management-server.d.ts +4 -0
- package/dist/mcp/management-server.js +103 -0
- package/dist/mcp/management-server.js.map +1 -0
- package/dist/program.js +2 -0
- package/dist/program.js.map +1 -1
- package/dist/rail.js +4 -0
- package/dist/rail.js.map +1 -1
- package/dist/secrets.d.ts +29 -14
- package/dist/secrets.js +201 -90
- package/dist/secrets.js.map +1 -1
- package/dist/status.js +10 -2
- package/dist/status.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,539 +1,108 @@
|
|
|
1
1
|
# Authflow CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser-authorized creator management and an optional local MCP adapter. The primary entry point is the hosted management MCP at `https://staging.rails.authflow.ai/management/mcp`. It includes onboarding, resource management, integration guidance, and documentation. See [Onboard with your agent](../../docs/onboarding/agent.md).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`authflow mcp` exposes the same operations as an MCP server, so a coding agent can onboard a server against the codebase it already has open. The tenant-facing walkthrough is [Onboard with your agent](../../docs/onboarding/agent.md). Command reference: [`authflow mcp`](#authflow-mcp).
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
The command is `authflow`. The npm package is [`authflow-cli`](https://www.npmjs.com/package/authflow-cli) (npm blocked the unscoped name `authflow`). No repo checkout is required:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx -y -p authflow-cli authflow --help
|
|
15
|
-
npx -y -p authflow-cli authflow init --slug video --price 900 --credits 12
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Or install globally and drop the `npx` prefix:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install -g authflow-cli
|
|
22
|
-
authflow --help
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## From this repo (development)
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
cd sdk/cli
|
|
29
|
-
npm install
|
|
30
|
-
npm run build
|
|
31
|
-
node dist/cli.js --help
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
During development (no build step):
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npx tsx src/cli.ts --help
|
|
38
|
-
npm run authflow -- --help
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Config
|
|
42
|
-
|
|
43
|
-
| Env | Flag | Used by |
|
|
44
|
-
| --- | --- | --- |
|
|
45
|
-
| `AUTHFLOW_ISSUER` | `--issuer` | all HTTP commands |
|
|
46
|
-
| `AUTHFLOW_ADMIN_API_KEY` | `--admin-key` | `init`, `register`, `connect`, `set-connected-account`, `set-origin`, `set-domain`, `status`, `get`, `list`, `plan`, `rotate-origin-key`, and `doctor` when it should read the receipt (mint with `authflow signup`) |
|
|
47
|
-
| `AUTHFLOW_ORIGIN_API_KEY` | `--origin-key` | `mint-header`, `probe`, `set-origin` (for its probe) |
|
|
48
|
-
| `AUTHFLOW_RESOURCE` / `AUTHFLOW_GATEWAY_URL` | `--gateway-url` / `--receipt` | curl hint on `mint-header` |
|
|
49
|
-
|
|
50
|
-
Issuer is the Origin Protocol issuer origin, with no trailing slash: staging is `https://staging.rails.authflow.ai`, local is typically `https://localhost:7062`. For an already-registered resource it is the `issuer` field of the receipt. See [tenant quickstart §1](../../docs/onboarding/tenant-quickstart.md#environments-and-hostnames).
|
|
51
|
-
|
|
52
|
-
## Commands
|
|
53
|
-
|
|
54
|
-
### `authflow signup`
|
|
55
|
-
|
|
56
|
-
Mints a per-tenant admin API key. This is how a creator gets `AUTHFLOW_ADMIN_API_KEY` without the rail operator handing them one.
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
export AUTHFLOW_ISSUER=https://staging.rails.authflow.ai
|
|
60
|
-
npx -y -p authflow-cli authflow signup --email you@example.com
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The key (`afa_test_` on staging, `afa_live_` in production) is shown once and written to `.env.local` by default. It can only register and manage slugs created with that key. The operator bearer still exists as a super-admin.
|
|
64
|
-
|
|
65
|
-
### `authflow init`
|
|
66
|
-
|
|
67
|
-
The whole onboarding path in one command: register the resource, put the origin API key in a secret
|
|
68
|
-
store, print the config to paste into your MCP server, and probe the origin if it is already up.
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
export AUTHFLOW_ISSUER=https://staging.rails.authflow.ai
|
|
72
|
-
export AUTHFLOW_ADMIN_API_KEY=…
|
|
73
|
-
|
|
74
|
-
authflow init --slug video --price 900 --credits 12
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Neither a Stripe account nor a deployed origin is required. Both are deferrable, in any order, and
|
|
78
|
-
omitting either registers a **draft**: priced and registered, with a receipt you can build against,
|
|
79
|
-
but not routable. That is the normal case — you rarely have a connected Stripe account or an origin
|
|
80
|
-
URL before you have built anything.
|
|
81
|
-
|
|
82
|
-
The receipt's `pending_requirements` lists what is still outstanding:
|
|
83
|
-
|
|
84
|
-
| Requirement | Clear it with |
|
|
85
|
-
| --- | --- |
|
|
86
|
-
| `origin_base_uri` | `authflow set-origin --slug video --origin-url https://…` |
|
|
87
|
-
| `connected_account_id` | `authflow connect --slug video` (hosted KYC) or `authflow set-connected-account --slug video --account acct_…` (you already have the id) |
|
|
88
|
-
| `stripe_onboarding_complete` | finish Stripe's form, then `authflow connect --slug video` again |
|
|
89
|
-
|
|
90
|
-
Re-running `init` against a slug this admin key already owns resumes it: `409 slug_owned_by_caller`
|
|
91
|
-
is not a dead end. `--connected-account` and `--origin-url` then attach instead of failing. A slug
|
|
92
|
-
owned by someone else still returns `slug_taken`.
|
|
93
|
-
|
|
94
|
-
The resource goes live once the list is empty. Add `--connect` to `init` to get the Stripe
|
|
95
|
-
onboarding link from the first command instead of running `connect` separately.
|
|
96
|
-
|
|
97
|
-
Useful flags:
|
|
98
|
-
|
|
99
|
-
| Flag | Default | Meaning |
|
|
100
|
-
| --- | --- | --- |
|
|
101
|
-
| `--integration <dotnet\|proxy>` | `dotnet` | Which origin config to print |
|
|
102
|
-
| `--write-secrets <target>` | `user-secrets` | `user-secrets`, `env-file`, or `keyvault` |
|
|
103
|
-
| `--secret-destination <value>` | — | Project dir, env-file path, or vault name |
|
|
104
|
-
| `--connected-account <acct>` | — | Attach a Stripe account you already have |
|
|
105
|
-
| `--connect` | — | Start Stripe onboarding and print the hosted link |
|
|
106
|
-
| `--origin-url <url>` | — | Supply the origin now instead of later |
|
|
107
|
-
| `--no-probe` | — | Skip the conformance probe |
|
|
108
|
-
|
|
109
|
-
### `authflow connect`
|
|
110
|
-
|
|
111
|
-
Starts or resumes Stripe Connect Standard onboarding and prints the hosted link the creator opens to
|
|
112
|
-
complete KYC.
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
authflow connect --slug video
|
|
116
|
-
authflow connect --slug video --wait # poll until Stripe reports the account can take charges
|
|
117
|
-
authflow connect --slug video --connected-account acct_… # attach an account you already have
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Account links are single-use and expire in minutes. Re-running is the expected way to get a fresh
|
|
121
|
-
one: it resumes the same Stripe account rather than creating another, so retrying never leaves
|
|
122
|
-
abandoned accounts behind. Run it again after the form is submitted to confirm `charges_enabled` and
|
|
123
|
-
promote the resource.
|
|
124
|
-
|
|
125
|
-
`--connected-account` skips hosted KYC and is the same PUT as `authflow set-connected-account`.
|
|
126
|
-
|
|
127
|
-
### `authflow set-connected-account`
|
|
128
|
-
|
|
129
|
-
Attach a Stripe Standard account id the platform already has. This is the CLI twin of
|
|
130
|
-
`authflow_set_connected_account` and of `PUT /admin/resources/{slug}/connected-account`. Use it when
|
|
131
|
-
`connect` would otherwise start a new hosted onboarding you do not need.
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
authflow set-connected-account --slug video --account acct_…
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### `authflow set-origin`
|
|
138
|
-
|
|
139
|
-
Points a draft at its origin, promoting it to live if nothing else is pending, then runs the
|
|
140
|
-
conformance probe.
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
authflow set-origin --slug video --origin-url https://video-xyz.azurecontainerapps.io
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Pass the base URI without `/mcp`; the gateway appends it.
|
|
147
|
-
|
|
148
|
-
The probe runs automatically because this is the moment the resource starts accepting traffic, and a
|
|
149
|
-
closing "remember to verify" is a step that gets skipped. It needs `AUTHFLOW_ORIGIN_API_KEY` (or
|
|
150
|
-
`--origin-key`) — the admin key cannot stand in, because the probe authenticates as the origin. If
|
|
151
|
-
the key is not available the command says so and completes; `--no-probe` skips it deliberately.
|
|
152
|
-
|
|
153
|
-
The command also prints the client MCP config for the gateway URL. Use it verbatim: an MCP client
|
|
154
|
-
pointed at the origin's own hostname gets `403 invalid_origin_identity`, which is the origin
|
|
155
|
-
correctly refusing an unsigned request, not an auth bug.
|
|
156
|
-
|
|
157
|
-
### `authflow set-domain`
|
|
158
|
-
|
|
159
|
-
Serves a resource on your own hostname, so an MCP URL your clients already use keeps working. Run it
|
|
160
|
-
**before the resource has ever gone live**. The canonical URL is stamped on entitlements and Stripe
|
|
161
|
-
objects, so the rail refuses to change it afterwards (`409 resource_already_live`) and a resource
|
|
162
|
-
that is already live needs a new registration instead. Subdomains only: `mcp.example.com`, not
|
|
163
|
-
`example.com`.
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
authflow set-domain --slug video --host mcp.example.com
|
|
167
|
-
authflow set-domain --slug video --host mcp.example.com --path /api/mcp --wait
|
|
168
|
-
authflow set-domain --slug video --wait
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
The first two set the host. The third has no `--host`, which means **re-verify the host already set
|
|
172
|
-
on this resource**. There is no separate verify command, so that is how you re-check after adding
|
|
173
|
-
the DNS records. It reads the resource's receipt and stops with this error if there is no host to
|
|
174
|
-
check:
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
no custom domain set on video; pass --host
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Otherwise it asks the rail to verify the host, and with `--wait` it keeps polling exactly as
|
|
181
|
-
described below. Every "run this next" line the CLI prints is this form, because it needs no host or
|
|
182
|
-
path to retype.
|
|
183
|
-
|
|
184
|
-
`--host` is the bare hostname, with no scheme, path or port. `--path` is the public MCP path on that
|
|
185
|
-
host, and goes with `--host`; on its own it is an error. It is sent only when you pass it: the rail
|
|
186
|
-
uses `/mcp` the first time a host is set and keeps the stored path afterwards, so setting the host
|
|
187
|
-
again without `--path` never resets a path you chose.
|
|
188
|
-
|
|
189
|
-
The rail answers with the DNS records to create at your registrar, and the command prints them:
|
|
190
|
-
|
|
191
|
-
```
|
|
192
|
-
TYPE NAME VALUE PURPOSE
|
|
193
|
-
TXT _authflow-verify.mcp.example.com authflow-verify=… ownership
|
|
194
|
-
CNAME mcp.example.com customers.example-edge.net traffic
|
|
195
|
-
CNAME _acme-challenge.mcp.example.com mcp.example.com.….dcv.… certificate
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
| Record | Purpose |
|
|
199
|
-
| --- | --- |
|
|
200
|
-
| `_authflow-verify` TXT | Proves you own the host. The rail checks it before it provisions anything. |
|
|
201
|
-
| Traffic CNAME | Points the host at Authflow's edge. |
|
|
202
|
-
| `_acme-challenge` CNAME | Lets the certificate be issued and renewed with no further action from you. |
|
|
203
|
-
|
|
204
|
-
The certificate record is listed only once provisioning has begun, which is after ownership is
|
|
205
|
-
verified, so a first run shows two records. It appears on a later check.
|
|
206
|
-
|
|
207
|
-
Registrars such as GoDaddy usually want only the host part of the name, not the full name: for
|
|
208
|
-
`mcp.example.com` enter `mcp`, and for `_authflow-verify.mcp.example.com` enter
|
|
209
|
-
`_authflow-verify.mcp`. The command prints that hint with your own host in it.
|
|
210
|
-
|
|
211
|
-
`--wait` polls the rail's verify endpoint, straight away and then every 15 seconds, until the domain
|
|
212
|
-
is ready. It gives up after 1800 seconds unless `--timeout <seconds>` says otherwise. If the
|
|
213
|
-
certificate record appears while it waits, it prints it as a new record to add.
|
|
5
|
+
## Verified workspace onboarding
|
|
214
6
|
|
|
215
|
-
|
|
216
|
-
| --- | --- |
|
|
217
|
-
| `0` | The state is `ready`. Without `--wait`: the host was set, or re-checked, and the state is not a failure. |
|
|
218
|
-
| `1` | `--wait` timed out, or the state is `blocked`, `moved` or `removed`. The rail's `last_error` is printed. |
|
|
219
|
-
|
|
220
|
-
| State | Meaning |
|
|
221
|
-
| --- | --- |
|
|
222
|
-
| `awaiting_ownership` | Waiting for the ownership TXT record. |
|
|
223
|
-
| `provisioning` | Ownership verified. The hostname and certificate are being provisioned. |
|
|
224
|
-
| `awaiting_traffic` | Waiting for the traffic and certificate CNAMEs. |
|
|
225
|
-
| `ready` | Serving. |
|
|
226
|
-
| `moved` | DNS no longer points at Authflow. |
|
|
227
|
-
| `blocked` | The hostname is blocked. |
|
|
228
|
-
| `removed` | The hostname was removed. |
|
|
229
|
-
|
|
230
|
-
Once it is ready the resource's URL is `https://{host}{path}`, and the client config the command
|
|
231
|
-
prints names that URL. Hand that to your users, not the slug URL. To check the result from the
|
|
232
|
-
outside, run `authflow doctor --host mcp.example.com`.
|
|
233
|
-
|
|
234
|
-
You can also set the host at registration with `authflow register --public-host`. Afterwards,
|
|
235
|
-
`set-domain` with `--host` changes it, and `set-domain` without `--host` re-checks it.
|
|
236
|
-
|
|
237
|
-
### `authflow status`
|
|
238
|
-
|
|
239
|
-
Where onboarding actually got to, and the command that clears each remaining step.
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
authflow status --slug video
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
resource: video
|
|
247
|
-
status: draft
|
|
248
|
-
gateway: https://staging.rails.authflow.ai/video/mcp
|
|
249
|
-
|
|
250
|
-
[x] resource registered
|
|
251
|
-
[ ] origin URI set
|
|
252
|
-
no origin — the gateway has nowhere to forward to
|
|
253
|
-
next: authflow set-origin --slug video --origin-url https://your-origin.example
|
|
254
|
-
[ ] Stripe connected
|
|
255
|
-
no connected account — nothing can be charged
|
|
256
|
-
next: authflow connect --slug video (or authflow set-connected-account --slug video --account acct_…)
|
|
257
|
-
[ ] Stripe onboarding complete
|
|
258
|
-
no connected account — attach one before Stripe can confirm charges
|
|
259
|
-
next: authflow connect --slug video (or authflow set-connected-account --slug video --account acct_…)
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
"Stripe onboarding complete" is ticked only when this resource has an account attached **and** Stripe
|
|
263
|
-
has not listed `stripe_onboarding_complete` as pending. No account is not "charges enabled."
|
|
264
|
-
|
|
265
|
-
A resource on its own hostname gets one more step, which stays unticked while the receipt lists
|
|
266
|
-
`custom_domain_dns` as pending. It shows the state, the DNS records to add, and the command that
|
|
267
|
-
re-checks them:
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
[ ] custom domain DNS
|
|
271
|
-
mcp.example.com: awaiting_traffic (waiting for the traffic and certificate CNAMEs)
|
|
272
|
-
|
|
273
|
-
TYPE NAME VALUE PURPOSE
|
|
274
|
-
TXT _authflow-verify.mcp.example.com authflow-verify=… ownership
|
|
275
|
-
CNAME mcp.example.com customers.example-edge.net traffic
|
|
276
|
-
CNAME _acme-challenge.mcp.example.com mcp.example.com.….dcv.… certificate
|
|
277
|
-
|
|
278
|
-
next: authflow set-domain --slug video --wait
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
Once the domain is ready the step is ticked, the records stay listed as what to leave in place, and
|
|
282
|
-
the client config names your URL. `--json` adds a structured `customDomain` object with the host,
|
|
283
|
-
path, state, CNAME target and records. Resources on the gateway host are unchanged.
|
|
284
|
-
|
|
285
|
-
Use it to resume an onboarding whose earlier steps may or may not have finished — a deploy that got
|
|
286
|
-
backgrounded, a terminal that was closed. `doctor` answers "is the rail up", which is a different
|
|
287
|
-
question: the rail can be perfectly healthy while a resource sits half-configured and rejects every
|
|
288
|
-
request. Exit code is non-zero until the resource can take paid traffic, so it works as a deploy
|
|
289
|
-
gate. `--json` emits the report for scripting.
|
|
290
|
-
|
|
291
|
-
### `authflow plan`
|
|
292
|
-
|
|
293
|
-
Prints the same framework-specific origin integration plan as `authflow_integration_plan`.
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
authflow plan --slug video --framework dotnet
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
`--framework` is one of `dotnet`, `typescript`, `python`, or `proxy`. The generic, credential-free form of those plans is [Integration plans](../../docs/onboarding/integration-plans.md).
|
|
300
|
-
|
|
301
|
-
### `authflow get` / `authflow list`
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
authflow get --slug video # one receipt, plus the client MCP config
|
|
305
|
-
authflow list # every resource this admin key owns
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
`list` is the recovery path for a forgotten slug, which `get` cannot be — it needs the slug you are
|
|
309
|
-
trying to remember. If a registration reported the slug was taken and it is not in `list`, another
|
|
310
|
-
tenant owns it and you need a different name; slugs are global because they are the gateway path
|
|
311
|
-
segment.
|
|
312
|
-
|
|
313
|
-
### `authflow rotate-origin-key`
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
authflow rotate-origin-key --slug video --write-secrets user-secrets
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
The recovery path for a lost origin API key, which is shown only once. The previous key stops working
|
|
320
|
-
the moment the command returns, so update the origin's secret store immediately or its usage reports
|
|
321
|
-
and probes will start failing.
|
|
322
|
-
|
|
323
|
-
### `authflow doctor`
|
|
324
|
-
|
|
325
|
-
Preflights a rail deployment before you spend time debugging your own origin.
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
authflow doctor --issuer https://staging.rails.authflow.ai --slug video
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
Checks that the issuer is reachable, that the Origin Protocol keys document is served and
|
|
332
|
-
self-consistent (issuer byte-match, protocol version, a usable Ed25519 key, no private key
|
|
333
|
-
material), and — with `--slug` — that the resource's PRM document resolves and the gateway answers
|
|
334
|
-
an unauthenticated connect with a `401` carrying `resource_metadata`.
|
|
335
|
-
|
|
336
|
-
Run this first when anything looks broken. It separates the two failures that are indistinguishable
|
|
337
|
-
from the outside: a hostname that is not bound to the rail returns `404` on every path including
|
|
338
|
-
`/healthz`, which reads exactly like a broken endpoint. Exit code is non-zero on any failure.
|
|
339
|
-
|
|
340
|
-
`--client cursor|claude|chatgpt|all` additionally replays that MCP client's real OAuth registration
|
|
341
|
-
against the authorization server (the failure that presents as "this server does not work in
|
|
342
|
-
Cursor"). `--dry-run` is discovery only and does not POST DCR. Live DCR registrations are stamped
|
|
343
|
-
`authflow-cli doctor-connect` so a cleanup sweep can reclaim them.
|
|
344
|
-
|
|
345
|
-
A `400` from the rail's DCR endpoint is the interesting result: paste `error=` and
|
|
346
|
-
`error_description=` verbatim into a rail bug. Do not work around it client-side.
|
|
347
|
-
|
|
348
|
-
```bash
|
|
349
|
-
authflow doctor --issuer https://staging.rails.authflow.ai --slug video --client cursor
|
|
350
|
-
authflow doctor --client all --dry-run
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
With an admin key, `--slug` reads the resource's receipt and probes the PRM and the 401 challenge
|
|
354
|
-
where the receipt says they are. For a resource on its own hostname that is the tenant's host, and a
|
|
355
|
-
PRM whose `resource` is not the receipt's `resource` fails.
|
|
356
|
-
|
|
357
|
-
`--host` verifies a tenant's own hostname from the outside, the way a client would see it:
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
authflow doctor --issuer https://staging.rails.authflow.ai --host mcp.example.com
|
|
361
|
-
authflow doctor --issuer https://staging.rails.authflow.ai --host mcp.example.com --slug video
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Like the rest of `doctor`, it needs the issuer (`--issuer` or `AUTHFLOW_ISSUER`).
|
|
365
|
-
|
|
366
|
-
| Check | Passes when |
|
|
367
|
-
| --- | --- |
|
|
368
|
-
| `host custom domain` | The rail reports the domain `ready`. Skipped, with the reason, when doctor has no receipt to read. |
|
|
369
|
-
| `host DNS: traffic CNAME` | The host is a CNAME to the receipt's `cname_target`. |
|
|
370
|
-
| `host DNS: _acme-challenge CNAME` | The certificate CNAME is there and matches the receipt. Skipped while the rail has not issued one yet. |
|
|
371
|
-
| `host DNS: _authflow-verify TXT` | The ownership TXT is there and matches the receipt. |
|
|
372
|
-
| `host TLS certificate` | The certificate is trusted for the host and has at least 7 days left. The issuer and expiry are printed. |
|
|
373
|
-
| `host http redirects to https` | Plain `http://` answers with a redirect to `https://` on the same host. |
|
|
374
|
-
| `host PRM (path)` | The PRM is served at the well-known path followed by the resource's path, and names the tenant's URL as its `resource`. |
|
|
375
|
-
| `host PRM (root)` | The same document is served at the bare well-known path, which Claude Code probes. |
|
|
376
|
-
| `host 401 challenge` | An unauthenticated MCP request gets a 401 whose `resource_metadata` is an https URL on the host. |
|
|
377
|
-
|
|
378
|
-
With an admin key the receipt is found by `--slug`, or by the host among the resources the key owns.
|
|
379
|
-
Without one, the DNS checks only confirm that each record exists and report `SKIP` rather than
|
|
380
|
-
claiming they were compared. A DNS lookup that fails (a resolver timeout, say) is reported as a
|
|
381
|
-
lookup failure, not as a missing record. If the TLS check fails, the PRM and 401 checks are skipped
|
|
382
|
-
because every https request would fail with the same misleading error. With `--host`, the PRM and
|
|
383
|
-
401 checks of `--slug` are replaced by these, which probe the same URLs.
|
|
384
|
-
|
|
385
|
-
### `authflow register`
|
|
7
|
+
Install the pinned adapter and sign in. First-time authorization creates your personal workspace when you approve consent; no portal setup or admin key is required.
|
|
386
8
|
|
|
387
9
|
```bash
|
|
10
|
+
npm install -g authflow-cli@0.6.0
|
|
388
11
|
export AUTHFLOW_ISSUER=https://staging.rails.authflow.ai
|
|
389
|
-
|
|
390
|
-
authflow
|
|
12
|
+
authflow login
|
|
13
|
+
authflow workspace list
|
|
14
|
+
authflow resource create --file resource.json
|
|
15
|
+
authflow plan --slug my-mcp --framework typescript
|
|
16
|
+
authflow resource origin my-mcp --file origin.json
|
|
17
|
+
authflow resource verify my-mcp
|
|
18
|
+
authflow resource publish my-mcp
|
|
391
19
|
```
|
|
392
20
|
|
|
393
|
-
`resource.json`
|
|
21
|
+
`resource.json` for free authenticated access:
|
|
394
22
|
|
|
395
23
|
```json
|
|
396
|
-
{
|
|
397
|
-
"slug": "video",
|
|
398
|
-
"origin_base_uri": "https://video-xyz.azurecontainerapps.io",
|
|
399
|
-
"display_name": "Snyder Video",
|
|
400
|
-
"connected_account_id": "acct_…",
|
|
401
|
-
"currency": "usd",
|
|
402
|
-
"price_amount_minor": 900,
|
|
403
|
-
"credits_per_period": 12,
|
|
404
|
-
"price_version": 1
|
|
405
|
-
}
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
`origin_base_uri` may be `null` or omitted, which registers a draft — see `authflow set-origin`.
|
|
409
|
-
|
|
410
|
-
To serve the resource on your own hostname from the start, add `--public-host` (and, if it is not
|
|
411
|
-
`/mcp`, `--public-path`). They are shorthand for `public_host` and `public_path` in the file, and
|
|
412
|
-
override it. The receipt then lists the DNS records to add; see `authflow set-domain`.
|
|
413
|
-
|
|
414
|
-
```bash
|
|
415
|
-
authflow register --file resource.json --public-host mcp.example.com --public-path /api/mcp
|
|
24
|
+
{ "slug": "my-mcp", "display_name": "My MCP", "access_mode": "free" }
|
|
416
25
|
```
|
|
417
26
|
|
|
418
|
-
|
|
419
|
-
**not** written to that file: receipts get committed, pasted into issues, and handed to agents, and
|
|
420
|
-
the key is a live bearer credential for the usage endpoint. It is printed to the terminal instead, so
|
|
421
|
-
nothing is lost. `--keep-secret-in-receipt` restores the old behaviour if you really need it.
|
|
422
|
-
|
|
423
|
-
Better still, have the CLI store it for you:
|
|
27
|
+
`origin.json`:
|
|
424
28
|
|
|
425
|
-
```
|
|
426
|
-
|
|
29
|
+
```json
|
|
30
|
+
{ "origin_base_uri": "https://my-origin.example.com" }
|
|
427
31
|
```
|
|
428
32
|
|
|
429
|
-
|
|
430
|
-
`az keyvault secret set` and needs `--secret-destination <vault>`.
|
|
431
|
-
|
|
432
|
-
Lost the key? `authflow rotate-origin-key --slug <slug>`.
|
|
433
|
-
|
|
434
|
-
Registration also prints the client MCP config and, for a draft, the remaining steps — a registered
|
|
435
|
-
resource is not yet a reachable one, and from the outside the two are indistinguishable.
|
|
33
|
+
Free and gateway-metered origins verify signed identity with public keys. They do not require an origin credential. Every resource starts as a draft and requires conformance verification and explicit publication.
|
|
436
34
|
|
|
437
|
-
|
|
35
|
+
For paid access, include `access_mode: "paid"`, `currency: "usd"`, `price_amount_minor: 900`, and `credits_per_period: 12`. Gateway metering is the default, with `metering_default_units: 1` and `tool_units: {}`. Configure per-tool costs by supplying a replacement map such as `{ "preview": 0, "generate": 3 }`. Use `metering_mode: "origin_reported"` when your origin must determine completion or report variable costs. Never charge one call through both mechanisms.
|
|
438
36
|
|
|
439
|
-
|
|
37
|
+
Connect Stripe with `authflow stripe onboard` or `authflow stripe connect-existing`. These return authenticated Authflow links for the owner's browser. Then refresh status; returning from Stripe alone does not prove readiness. Authflow charges a 9% fee on paid sales; monthly platform plans are not implemented.
|
|
440
38
|
|
|
441
|
-
|
|
442
|
-
export AUTHFLOW_ORIGIN_API_KEY=afo_test_…
|
|
443
|
-
authflow mint-header --tier standard --ttl 90 --grant-credits 3 --receipt receipt.json
|
|
444
|
-
```
|
|
39
|
+
## Creator commands
|
|
445
40
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
41
|
+
| Command | Purpose |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `login [--workspace <id>] [--no-browser]` | Browser authorization with PKCE and workspace consent |
|
|
44
|
+
| `logout` | Revoke authorization and remove the OS-stored credential |
|
|
45
|
+
| `logout --local-only` | Clear this device only |
|
|
46
|
+
| `workspace list`, `workspace overview` | Workspace and recent activity |
|
|
47
|
+
| `resource list`, `resource get <slug>` | Receipts, status, and requirements |
|
|
48
|
+
| `resource create --file <json>` | Create a draft; keys are never printed |
|
|
49
|
+
| `resource update <slug> --file <json>` | Patch supplied name, offer, and metering fields |
|
|
50
|
+
| `resource origin <slug> --file <json>` | Set the private origin base URL without `/mcp` |
|
|
51
|
+
| `resource domain <slug> --file <json>` | Set `public_host` and `public_path` before first publication |
|
|
52
|
+
| `resource domain-refresh <slug>` | Refresh DNS/certificate readiness |
|
|
53
|
+
| `resource verify <slug>` | Probe the exact current configuration |
|
|
54
|
+
| `resource publish <slug>`, `resource disable <slug>` | Explicitly change traffic availability |
|
|
55
|
+
| `resource rotate-key <slug> --write-secrets <target> --secret-destination <value>` | Deliver an origin-reported usage credential |
|
|
56
|
+
| `stripe status`, `stripe onboard`, `stripe connect-existing` | Readiness and authenticated owner actions |
|
|
57
|
+
| `plan --slug <slug> --framework <framework>` | Resource-specific plan from Rail's canonical templates |
|
|
58
|
+
| `mcp` | Local management MCP with the protected CLI login |
|
|
451
59
|
|
|
452
|
-
|
|
453
|
-
authflow probe
|
|
454
|
-
authflow probe --slug video
|
|
455
|
-
```
|
|
60
|
+
Management commands accept `--issuer`; workspace operations also accept `--workspace`. Omitted PATCH fields preserve values. A supplied `tool_units` map replaces the old map. Actual offer/access/metering changes invalidate verification and publication; re-verify and explicitly publish. A name-only update preserves the policy.
|
|
456
61
|
|
|
457
|
-
|
|
458
|
-
documented `authflow probe --slug …` does not fail. Renders a pass/fail table. Exit code is
|
|
459
|
-
non-zero when any check fails or the origin is unreachable.
|
|
62
|
+
## Direct secret delivery
|
|
460
63
|
|
|
461
|
-
|
|
64
|
+
Paid origin-reported resources need a credential for the usage endpoint. Choose an explicit destination before issuance:
|
|
462
65
|
|
|
463
66
|
```bash
|
|
464
|
-
authflow
|
|
67
|
+
authflow resource rotate-key my-mcp --write-secrets keyvault --secret-destination my-vault
|
|
68
|
+
authflow resource rotate-key my-mcp --write-secrets user-secrets --secret-destination ./MyOrigin.csproj
|
|
69
|
+
authflow resource rotate-key my-mcp --write-secrets env-file --secret-destination ./.env.local
|
|
465
70
|
```
|
|
466
71
|
|
|
467
|
-
|
|
72
|
+
Use only the command for your destination. Key Vault secret names include the resource identity, avoiding collisions across workspaces/resources/environments. Destination preflight happens before rotation. Free/gateway resources return `not_required` without rotating. For origin-reported creation, the same destination flags can store the one-time key directly.
|
|
468
73
|
|
|
469
|
-
-
|
|
470
|
-
- `docker-compose.authflow.yml` — `authflow-origin-proxy` in front of an upstream placeholder
|
|
74
|
+
Key values stay out of normal output and errors. Secret writers avoid process arguments containing values where supported. Env files are plaintext development storage: exclude them from source control. Azure delivery uses the signed-in Azure CLI identity. A bounded metadata check confirms destination reachability and catches known authentication/network failures before rotation. It cannot prove `secrets/set` permission without writing: identities with write-only permission remain supported, and actual delivery determines write access.
|
|
471
75
|
|
|
472
|
-
|
|
473
|
-
nonce-cache options.
|
|
76
|
+
`origin_key_stored_at` confirms storage only, and `deployment_updated: false` means application bindings and deployment still need work. If delivery fails after issuance, the old key may already be revoked. Repair access, inspect state, and explicitly rotate again; the command never retries that mutation silently.
|
|
474
77
|
|
|
475
|
-
|
|
78
|
+
## Authflow MCP
|
|
476
79
|
|
|
477
|
-
|
|
478
|
-
instead of a human running commands. The agent already has the creator's codebase; what it lacks is
|
|
479
|
-
a way to talk to the rail. This supplies exactly that, and nothing more — the server never reads or
|
|
480
|
-
writes source files. It hands back an integration plan and the agent applies it.
|
|
481
|
-
|
|
482
|
-
Add it to Cursor or Claude Desktop:
|
|
80
|
+
For a remote client, add `https://staging.rails.authflow.ai/management/mcp` and complete browser consent. For a local adapter, run `authflow login` first, then configure:
|
|
483
81
|
|
|
484
82
|
```json
|
|
485
83
|
{
|
|
486
84
|
"mcpServers": {
|
|
487
85
|
"authflow": {
|
|
488
86
|
"command": "npx",
|
|
489
|
-
"args": ["-y", "-p", "authflow-cli", "authflow", "mcp"],
|
|
490
|
-
"env": {
|
|
491
|
-
"AUTHFLOW_ISSUER": "https://staging.rails.authflow.ai",
|
|
492
|
-
"AUTHFLOW_ADMIN_API_KEY": "…"
|
|
493
|
-
}
|
|
87
|
+
"args": ["-y", "-p", "authflow-cli@0.6.0", "authflow", "mcp"],
|
|
88
|
+
"env": { "AUTHFLOW_ISSUER": "https://staging.rails.authflow.ai" }
|
|
494
89
|
}
|
|
495
90
|
}
|
|
496
91
|
}
|
|
497
92
|
```
|
|
498
93
|
|
|
499
|
-
Tools
|
|
94
|
+
Both expose workspace overview/rename, resource lifecycle, usage, earnings, Stripe actions, integration plans, and docs search/read. Tools require their authorized workspace and scope; read-only consent cannot write. Personal identity/security and consumer billing are outside this creator tool surface. Tool results never include origin keys or OAuth credentials.
|
|
500
95
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
| `authflow_doctor` | Preflight the rail; distinguishes a bad hostname from an outage |
|
|
505
|
-
| `authflow_register_resource` | Register and price a resource; optionally store the key in a secret store |
|
|
506
|
-
| `authflow_get_resource` | Current receipt, `status`, and `pending_requirements` |
|
|
507
|
-
| `authflow_list_resources` | Every resource this key owns — how an agent recovers an unknown slug |
|
|
508
|
-
| `authflow_status` | Per-step readiness with the command that clears each one; use it to resume |
|
|
509
|
-
| `authflow_integration_plan` | Config, snippets, verification steps, and invariants for `dotnet`, `typescript`, `python`, or `proxy` |
|
|
510
|
-
| `authflow_start_stripe_connect` | Hosted Stripe onboarding link; resumable |
|
|
511
|
-
| `authflow_set_connected_account` | Attach an existing `acct_…` |
|
|
512
|
-
| `authflow_set_origin` | Supply the origin and promote to live |
|
|
513
|
-
| `authflow_set_custom_domain` | Serve a resource on the tenant's own hostname, or, with no `host`, re-verify the one already set: returns the DNS records to add and the state. With `wait` it re-verifies every 15 seconds for under a minute and returns the progress |
|
|
514
|
-
| `authflow_probe` | Conformance probe against the origin |
|
|
515
|
-
| `authflow_mint_test_header` | Signed identity header for local verifier testing |
|
|
516
|
-
| `authflow_rotate_origin_key` | Rotate the origin API key (invalidates the old one immediately) |
|
|
96
|
+
Integration templates are versioned in `rail/docs/onboarding/integration-plans.json`. Rail's resource-specific endpoint, hosted/local MCP, and modern `plan` consume this source; generic documentation is generated from it.
|
|
97
|
+
|
|
98
|
+
## Runtime and verification
|
|
517
99
|
|
|
518
|
-
|
|
519
|
-
stay in the MCP client config rather than in the conversation. `write_secrets` is available on both
|
|
520
|
-
tools that issue a key; prefer it, because a key returned in a tool result is a credential in a chat
|
|
521
|
-
transcript.
|
|
100
|
+
Credentials use Windows Credential Manager, macOS Keychain, or an available unlocked Linux secret service. There is no plaintext login fallback. Browser login uses a local callback. Refresh is serialized across processes; writes are not automatically retried. Read resource/Stripe state after interruptions.
|
|
522
101
|
|
|
523
|
-
`
|
|
524
|
-
DNS records as text for the agent to hand to the user, since only they can create them at their
|
|
525
|
-
registrar. `host` is optional with the same meaning as `--host`: leave it out and the tool
|
|
526
|
-
re-verifies the host already set, so the second call, once the user has added the records, is just
|
|
527
|
-
the slug and `wait`. `path` is sent only when given, and needs `host`. Its wait is deliberately short: a tool call that outlives the client's request timeout is
|
|
528
|
-
dropped together with its result, and DNS and certificate issuance usually take longer than a
|
|
529
|
-
minute. If the state is not `ready`, the agent tells the user to finish the records and calls again
|
|
530
|
-
with `wait`. A domain that is `blocked`, `moved` or `removed` comes back as a tool error.
|
|
531
|
-
`authflow_doctor` takes `host` for the same checks as `authflow doctor --host`, and
|
|
532
|
-
`authflow_register_resource` takes `public_host` and `public_path` like `authflow register`.
|
|
102
|
+
Staging issuer: `https://staging.rails.authflow.ai`. Local Compose defaults to `http://127.0.0.1:8080` (respect a configured `RAIL_PORT`). Production Rail provisioning is separate from this release.
|
|
533
103
|
|
|
534
|
-
|
|
535
|
-
through the gateway. Hand the user that, never the origin's hostname, which rejects unsigned requests
|
|
536
|
-
by design.
|
|
104
|
+
Origin diagnostics such as `doctor`, `probe`, `mint-header`, and `scaffold` remain available via command help for operators. They are not prerequisites for normal creator onboarding. Use `resource verify` with your scoped login; never ask a new creator for a tenant admin credential.
|
|
537
105
|
|
|
538
|
-
|
|
539
|
-
|
|
106
|
+
Gateway metering cannot infer all failures after a streamed response begins. Use origin-reported debit/compensation when provider completion determines the charge. The [tenant quickstart](../../docs/onboarding/tenant-quickstart.md) and [Origin Protocol v1](../../docs/origin-protocol/v1.md) define the integration contract.
|
|
107
|
+
|
|
108
|
+
License: Apache-2.0. See [LICENSE](LICENSE).
|