authflow-cli 0.2.0 → 0.4.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 +55 -5
- package/dist/cli.js +4 -35
- package/dist/cli.js.map +1 -1
- package/dist/client-conformance.d.ts +34 -0
- package/dist/client-conformance.js +379 -0
- package/dist/client-conformance.js.map +1 -0
- package/dist/client-fixtures.d.ts +67 -0
- package/dist/client-fixtures.js +130 -0
- package/dist/client-fixtures.js.map +1 -0
- package/dist/commands/connect.js +11 -1
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.js +13 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.js +32 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plan.d.ts +6 -0
- package/dist/commands/plan.js +26 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/probe.js +1 -0
- package/dist/commands/probe.js.map +1 -1
- package/dist/commands/set-connected-account.d.ts +7 -0
- package/dist/commands/set-connected-account.js +38 -0
- package/dist/commands/set-connected-account.js.map +1 -0
- package/dist/doctor.d.ts +26 -2
- package/dist/doctor.js +127 -16
- package/dist/doctor.js.map +1 -1
- package/dist/google-redirect.d.ts +31 -0
- package/dist/google-redirect.js +479 -0
- package/dist/google-redirect.js.map +1 -0
- package/dist/mcp/server.js +32 -11
- package/dist/mcp/server.js.map +1 -1
- package/dist/program.d.ts +6 -0
- package/dist/program.js +46 -0
- package/dist/program.js.map +1 -0
- package/dist/rail.js +2 -1
- package/dist/rail.js.map +1 -1
- package/dist/status.js +18 -6
- package/dist/status.js.map +1 -1
- package/dist/surface.d.ts +22 -0
- package/dist/surface.js +22 -0
- package/dist/surface.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical OAuth registration payloads as the named MCP clients actually send them.
|
|
3
|
+
*
|
|
4
|
+
* A wrong fixture is worse than no test: it would certify the rail against a made-up client.
|
|
5
|
+
* Keep `.cursor/skills/mcp-oauth-paywall/references/client-compatibility.md` in sync with this file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const clientIds: readonly ["cursor", "claude", "chatgpt"];
|
|
8
|
+
export type ClientId = (typeof clientIds)[number];
|
|
9
|
+
export type DcrPayload = {
|
|
10
|
+
redirect_uris: string[];
|
|
11
|
+
token_endpoint_auth_method: string;
|
|
12
|
+
grant_types: string[];
|
|
13
|
+
response_types: string[];
|
|
14
|
+
application_type?: string;
|
|
15
|
+
};
|
|
16
|
+
export type DcrVariant = {
|
|
17
|
+
id: string;
|
|
18
|
+
/** Stable check name; included in the doctor report. */
|
|
19
|
+
checkName: string;
|
|
20
|
+
payload: DcrPayload;
|
|
21
|
+
};
|
|
22
|
+
export declare const dcrProbeClientNamePrefix = "authflow-cli doctor-connect";
|
|
23
|
+
/**
|
|
24
|
+
* Cursor is DCR-only. The three-URI set is what it has sent since ~May 2026
|
|
25
|
+
* (https://forum.cursor.com/t/mcp-server-regression-mcp-oauth-registration-fails/159910,
|
|
26
|
+
* https://cursor.com/docs/mcp.md). `application_type` is deliberately absent — Cursor omits it
|
|
27
|
+
* (https://forum.cursor.com/t/cursor-does-not-send-application-type-native-when-registering-mcp-oauth-clients/136907).
|
|
28
|
+
*/
|
|
29
|
+
export declare const cursorCanonicalDcr: DcrVariant;
|
|
30
|
+
/** Same callbacks with `application_type: "web"` stated explicitly — a shape Cursor has also sent. */
|
|
31
|
+
export declare const cursorApplicationTypeWebDcr: DcrVariant;
|
|
32
|
+
/** Older Cursor registrations sent only the private-use callback. */
|
|
33
|
+
export declare const cursorSchemeOnlyDcr: DcrVariant;
|
|
34
|
+
export declare const cursorDcrVariants: DcrVariant[];
|
|
35
|
+
/**
|
|
36
|
+
* Obviously-fake callback id. ChatGPT mints a real one per connector; we cannot capture it.
|
|
37
|
+
* Used only to pin the documented URL shape.
|
|
38
|
+
*/
|
|
39
|
+
export declare const chatgptCallbackIdPlaceholder = "CALLBACK_ID_PLACEHOLDER";
|
|
40
|
+
export declare const chatgptStableRedirectUri = "https://chatgpt.com/connector_platform_oauth_redirect";
|
|
41
|
+
export declare const chatgptCallbackRedirectUri = "https://chatgpt.com/connector/oauth/CALLBACK_ID_PLACEHOLDER";
|
|
42
|
+
export declare const chatgptStableCimdDocument = "https://chatgpt.com/oauth/client.json";
|
|
43
|
+
export declare const chatgptCallbackCimdDocument = "https://chatgpt.com/oauth/CALLBACK_ID_PLACEHOLDER/client.json";
|
|
44
|
+
/**
|
|
45
|
+
* Primary ChatGPT DCR shape for this rail. Our AS advertises
|
|
46
|
+
* `authorization_response_iss_parameter_supported: true` and uses the same issuer in PRM, so
|
|
47
|
+
* ChatGPT selects this stable callback
|
|
48
|
+
* (https://developers.openai.com/plugins/build/auth, https://developers.openai.com/plugins/changelog
|
|
49
|
+
* 2026-08-21). A regression in that metadata flag silently switches ChatGPT to the callback-ID URI
|
|
50
|
+
* below. The rest of the body is the RFC 7591 public-client shape, not a captured ChatGPT POST.
|
|
51
|
+
*
|
|
52
|
+
* The Apps SDK page still calls this URI "legacy" for already-published apps and names
|
|
53
|
+
* `connector/oauth/{callback_id}` as the production allowlist entry
|
|
54
|
+
* (https://developers.openai.com/apps-sdk/build/auth). Both pages agree both URIs exist; they
|
|
55
|
+
* disagree on which is current. We replay both.
|
|
56
|
+
*/
|
|
57
|
+
export declare const chatgptStableRedirectDcr: DcrVariant;
|
|
58
|
+
/**
|
|
59
|
+
* Callback-ID DCR shape. `{callback_id}` is a placeholder, not a captured id. ChatGPT sends this
|
|
60
|
+
* when the AS does not meet RFC 9207 issuer identification, or when the Apps SDK path is in play.
|
|
61
|
+
*/
|
|
62
|
+
export declare const chatgptCallbackIdDcr: DcrVariant;
|
|
63
|
+
export declare const chatgptDcrVariants: DcrVariant[];
|
|
64
|
+
export declare function isClientId(value: string): value is ClientId;
|
|
65
|
+
export declare function parseClientOption(value: string): ClientId[];
|
|
66
|
+
export declare function dcrVariantsFor(client: ClientId): DcrVariant[];
|
|
67
|
+
export declare function probeClientName(client: ClientId, variantId: string): string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical OAuth registration payloads as the named MCP clients actually send them.
|
|
3
|
+
*
|
|
4
|
+
* A wrong fixture is worse than no test: it would certify the rail against a made-up client.
|
|
5
|
+
* Keep `.cursor/skills/mcp-oauth-paywall/references/client-compatibility.md` in sync with this file.
|
|
6
|
+
*/
|
|
7
|
+
export const clientIds = ["cursor", "claude", "chatgpt"];
|
|
8
|
+
export const dcrProbeClientNamePrefix = "authflow-cli doctor-connect";
|
|
9
|
+
/**
|
|
10
|
+
* Cursor is DCR-only. The three-URI set is what it has sent since ~May 2026
|
|
11
|
+
* (https://forum.cursor.com/t/mcp-server-regression-mcp-oauth-registration-fails/159910,
|
|
12
|
+
* https://cursor.com/docs/mcp.md). `application_type` is deliberately absent — Cursor omits it
|
|
13
|
+
* (https://forum.cursor.com/t/cursor-does-not-send-application-type-native-when-registering-mcp-oauth-clients/136907).
|
|
14
|
+
*/
|
|
15
|
+
export const cursorCanonicalDcr = {
|
|
16
|
+
id: "canonical",
|
|
17
|
+
checkName: "cursor: DCR canonical",
|
|
18
|
+
payload: {
|
|
19
|
+
redirect_uris: [
|
|
20
|
+
"cursor://anysphere.cursor-mcp/oauth/callback",
|
|
21
|
+
"https://www.cursor.com/agents/mcp/oauth/callback",
|
|
22
|
+
"http://localhost:8787/callback",
|
|
23
|
+
],
|
|
24
|
+
token_endpoint_auth_method: "none",
|
|
25
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
26
|
+
response_types: ["code"],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** Same callbacks with `application_type: "web"` stated explicitly — a shape Cursor has also sent. */
|
|
30
|
+
export const cursorApplicationTypeWebDcr = {
|
|
31
|
+
id: "application_type-web",
|
|
32
|
+
checkName: "cursor: DCR application_type web",
|
|
33
|
+
payload: {
|
|
34
|
+
...cursorCanonicalDcr.payload,
|
|
35
|
+
redirect_uris: [...cursorCanonicalDcr.payload.redirect_uris],
|
|
36
|
+
grant_types: [...cursorCanonicalDcr.payload.grant_types],
|
|
37
|
+
response_types: [...cursorCanonicalDcr.payload.response_types],
|
|
38
|
+
application_type: "web",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/** Older Cursor registrations sent only the private-use callback. */
|
|
42
|
+
export const cursorSchemeOnlyDcr = {
|
|
43
|
+
id: "cursor-scheme-only",
|
|
44
|
+
checkName: "cursor: DCR cursor-scheme only",
|
|
45
|
+
payload: {
|
|
46
|
+
redirect_uris: ["cursor://anysphere.cursor-mcp/oauth/callback"],
|
|
47
|
+
token_endpoint_auth_method: "none",
|
|
48
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
49
|
+
response_types: ["code"],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export const cursorDcrVariants = [
|
|
53
|
+
cursorCanonicalDcr,
|
|
54
|
+
cursorApplicationTypeWebDcr,
|
|
55
|
+
cursorSchemeOnlyDcr,
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Obviously-fake callback id. ChatGPT mints a real one per connector; we cannot capture it.
|
|
59
|
+
* Used only to pin the documented URL shape.
|
|
60
|
+
*/
|
|
61
|
+
export const chatgptCallbackIdPlaceholder = "CALLBACK_ID_PLACEHOLDER";
|
|
62
|
+
export const chatgptStableRedirectUri = "https://chatgpt.com/connector_platform_oauth_redirect";
|
|
63
|
+
export const chatgptCallbackRedirectUri = `https://chatgpt.com/connector/oauth/${chatgptCallbackIdPlaceholder}`;
|
|
64
|
+
export const chatgptStableCimdDocument = "https://chatgpt.com/oauth/client.json";
|
|
65
|
+
export const chatgptCallbackCimdDocument = `https://chatgpt.com/oauth/${chatgptCallbackIdPlaceholder}/client.json`;
|
|
66
|
+
/**
|
|
67
|
+
* Primary ChatGPT DCR shape for this rail. Our AS advertises
|
|
68
|
+
* `authorization_response_iss_parameter_supported: true` and uses the same issuer in PRM, so
|
|
69
|
+
* ChatGPT selects this stable callback
|
|
70
|
+
* (https://developers.openai.com/plugins/build/auth, https://developers.openai.com/plugins/changelog
|
|
71
|
+
* 2026-08-21). A regression in that metadata flag silently switches ChatGPT to the callback-ID URI
|
|
72
|
+
* below. The rest of the body is the RFC 7591 public-client shape, not a captured ChatGPT POST.
|
|
73
|
+
*
|
|
74
|
+
* The Apps SDK page still calls this URI "legacy" for already-published apps and names
|
|
75
|
+
* `connector/oauth/{callback_id}` as the production allowlist entry
|
|
76
|
+
* (https://developers.openai.com/apps-sdk/build/auth). Both pages agree both URIs exist; they
|
|
77
|
+
* disagree on which is current. We replay both.
|
|
78
|
+
*/
|
|
79
|
+
export const chatgptStableRedirectDcr = {
|
|
80
|
+
id: "stable-redirect",
|
|
81
|
+
checkName: "chatgpt: DCR stable redirect",
|
|
82
|
+
payload: {
|
|
83
|
+
redirect_uris: [chatgptStableRedirectUri],
|
|
84
|
+
token_endpoint_auth_method: "none",
|
|
85
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
86
|
+
response_types: ["code"],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Callback-ID DCR shape. `{callback_id}` is a placeholder, not a captured id. ChatGPT sends this
|
|
91
|
+
* when the AS does not meet RFC 9207 issuer identification, or when the Apps SDK path is in play.
|
|
92
|
+
*/
|
|
93
|
+
export const chatgptCallbackIdDcr = {
|
|
94
|
+
id: "callback-id",
|
|
95
|
+
checkName: "chatgpt: DCR callback-id redirect",
|
|
96
|
+
payload: {
|
|
97
|
+
redirect_uris: [chatgptCallbackRedirectUri],
|
|
98
|
+
token_endpoint_auth_method: "none",
|
|
99
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
100
|
+
response_types: ["code"],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const chatgptDcrVariants = [chatgptStableRedirectDcr, chatgptCallbackIdDcr];
|
|
104
|
+
export function isClientId(value) {
|
|
105
|
+
return clientIds.includes(value);
|
|
106
|
+
}
|
|
107
|
+
export function parseClientOption(value) {
|
|
108
|
+
const key = value.trim().toLowerCase();
|
|
109
|
+
if (key === "all") {
|
|
110
|
+
return [...clientIds];
|
|
111
|
+
}
|
|
112
|
+
if (isClientId(key)) {
|
|
113
|
+
return [key];
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`Unknown --client '${value}'. Use cursor, claude, chatgpt, or all.`);
|
|
116
|
+
}
|
|
117
|
+
export function dcrVariantsFor(client) {
|
|
118
|
+
switch (client) {
|
|
119
|
+
case "cursor":
|
|
120
|
+
return cursorDcrVariants;
|
|
121
|
+
case "chatgpt":
|
|
122
|
+
return chatgptDcrVariants;
|
|
123
|
+
case "claude":
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function probeClientName(client, variantId) {
|
|
128
|
+
return `${dcrProbeClientNamePrefix} ${client} ${variantId}`;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=client-fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-fixtures.js","sourceRoot":"","sources":["../src/client-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAkBlE,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAe;IAC5C,EAAE,EAAE,WAAW;IACf,SAAS,EAAE,uBAAuB;IAClC,OAAO,EAAE;QACP,aAAa,EAAE;YACb,8CAA8C;YAC9C,kDAAkD;YAClD,gCAAgC;SACjC;QACD,0BAA0B,EAAE,MAAM;QAClC,WAAW,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC;QACpD,cAAc,EAAE,CAAC,MAAM,CAAC;KACzB;CACF,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM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,UAAU,eAAe,CAAC,MAAgB,EAAE,SAAiB;IACjE,OAAO,GAAG,wBAAwB,IAAI,MAAM,IAAI,SAAS,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/commands/connect.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { requireAdminKey, requireIssuer } from "../config.js";
|
|
2
|
-
import { describePending, startConnect } from "../rail.js";
|
|
2
|
+
import { describePending, setConnectedAccount, startConnect } from "../rail.js";
|
|
3
|
+
import { formatReadiness, resourceReadiness } from "../status.js";
|
|
3
4
|
/**
|
|
4
5
|
* Stripe onboarding, which is the one step of the flow that genuinely cannot be automated: KYC is
|
|
5
6
|
* a hosted form the creator has to fill in themselves. So the command's job is to hand over a link
|
|
@@ -11,6 +12,7 @@ export function connectCommand(program) {
|
|
|
11
12
|
.description("Start or resume Stripe Connect onboarding for a resource")
|
|
12
13
|
.requiredOption("--slug <slug>", "Resource slug")
|
|
13
14
|
.option("--email <email>", "Pre-fill the Stripe onboarding form")
|
|
15
|
+
.option("--connected-account <acct>", "Attach an existing Stripe Standard account (acct_...) instead of starting hosted onboarding")
|
|
14
16
|
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
15
17
|
.option("--admin-key <key>", "Admin API key (default: AUTHFLOW_ADMIN_API_KEY)")
|
|
16
18
|
.option("--wait", "Poll until Stripe reports the account can take charges")
|
|
@@ -20,6 +22,14 @@ export function connectCommand(program) {
|
|
|
20
22
|
issuer: requireIssuer(opts.issuer),
|
|
21
23
|
adminKey: requireAdminKey(opts.adminKey),
|
|
22
24
|
};
|
|
25
|
+
if (opts.connectedAccount) {
|
|
26
|
+
const receipt = await setConnectedAccount(auth, opts.slug, opts.connectedAccount);
|
|
27
|
+
console.log(`Attached ${opts.connectedAccount} to ${receipt.slug ?? opts.slug}.`);
|
|
28
|
+
console.log(`status: ${receipt.status ?? "draft"}`);
|
|
29
|
+
console.log("");
|
|
30
|
+
console.log(formatReadiness(resourceReadiness(receipt)));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
23
33
|
let result = await startConnect(auth, opts.slug, opts.email);
|
|
24
34
|
if (result.charges_enabled) {
|
|
25
35
|
reportReady(result.slug, result.status, result.pending_requirements);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAElE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,0DAA0D,CAAC;SACvE,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC;SAChD,MAAM,CAAC,iBAAiB,EAAE,qCAAqC,CAAC;SAChE,MAAM,CACL,4BAA4B,EAC5B,6FAA6F,CAC9F;SACA,MAAM,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,iDAAiD,CAAC;SAC9E,MAAM,CAAC,QAAQ,EAAE,wDAAwD,CAAC;SAC1E,MAAM,CAAC,0BAA0B,EAAE,wCAAwC,EAAE,KAAK,CAAC;SACnF,MAAM,CACL,KAAK,EAAE,IAQN,EAAE,EAAE;QACH,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YAClC,Q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conformance.js";
|
|
1
2
|
import { requireIssuer } from "../config.js";
|
|
2
|
-
import { formatDoctorReport
|
|
3
|
+
import { formatDoctorReport } from "../doctor.js";
|
|
3
4
|
export function doctorCommand(program) {
|
|
4
5
|
program
|
|
5
6
|
.command("doctor")
|
|
6
|
-
.description("Check that the rail is reachable
|
|
7
|
+
.description("Check that the rail is reachable, serving a consistent Origin Protocol surface, and (with --client) accepts real MCP client OAuth registration. With --client and --slug (not --dry-run), also drive authorize through login and ask Google whether the rail's redirect_uri is registered")
|
|
7
8
|
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
8
9
|
.option("--slug <slug>", "Also check this resource's PRM document and gateway 401 challenge")
|
|
10
|
+
.option("--client <name>", "Replay MCP client OAuth registration: cursor, claude, chatgpt, or all")
|
|
11
|
+
.option("--dry-run", "With --client: discovery only, do not POST DCR registrations")
|
|
9
12
|
.option("--json", "Emit the report as JSON")
|
|
10
13
|
.action(async (opts) => {
|
|
11
|
-
|
|
14
|
+
if (opts.dryRun && !opts.client) {
|
|
15
|
+
throw new Error("--dry-run only applies with --client.");
|
|
16
|
+
}
|
|
17
|
+
const report = await runDoctorAndConnect(requireIssuer(opts.issuer), {
|
|
18
|
+
slug: opts.slug,
|
|
19
|
+
client: opts.client,
|
|
20
|
+
dryRun: opts.dryRun,
|
|
21
|
+
});
|
|
12
22
|
console.log(opts.json ? JSON.stringify(report, null, 2) : formatDoctorReport(report));
|
|
13
23
|
process.exitCode = report.pass ? 0 : 1;
|
|
14
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAA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@@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
2
|
import { apiJson, bearer, requireAdminKey, requireIssuer } from "../config.js";
|
|
3
|
-
import { describePending, startConnect } from "../rail.js";
|
|
3
|
+
import { describePending, getResource, setConnectedAccount, setOrigin, startConnect, } from "../rail.js";
|
|
4
4
|
import { originApiKeyConfigKey, secretTargets, writeOriginApiKey } from "../secrets.js";
|
|
5
5
|
import { formatCursorMcpConfig } from "../status.js";
|
|
6
6
|
/**
|
|
@@ -45,7 +45,7 @@ export function initCommand(program) {
|
|
|
45
45
|
price_amount_minor: Number(opts.price),
|
|
46
46
|
credits_per_period: Number(opts.credits),
|
|
47
47
|
};
|
|
48
|
-
const { body:
|
|
48
|
+
const { body: created, status: createStatus } = await apiJson(`${issuer}/admin/resources`, {
|
|
49
49
|
method: "POST",
|
|
50
50
|
headers: {
|
|
51
51
|
...bearer(adminKey),
|
|
@@ -53,9 +53,34 @@ export function initCommand(program) {
|
|
|
53
53
|
Accept: "application/json",
|
|
54
54
|
},
|
|
55
55
|
body: JSON.stringify(draft),
|
|
56
|
-
expectedStatuses: [201],
|
|
56
|
+
expectedStatuses: [201, 409],
|
|
57
57
|
});
|
|
58
|
-
|
|
58
|
+
let receipt;
|
|
59
|
+
let originApiKey;
|
|
60
|
+
let resumed = false;
|
|
61
|
+
if (createStatus === 409) {
|
|
62
|
+
if (created.error_code === "slug_taken") {
|
|
63
|
+
throw new Error(created.error_description ?? `Slug '${opts.slug}' is taken by another tenant.`);
|
|
64
|
+
}
|
|
65
|
+
if (created.error_code !== "slug_owned_by_caller") {
|
|
66
|
+
throw new Error(created.error_description ??
|
|
67
|
+
created.error ??
|
|
68
|
+
`Slug '${opts.slug}' is already registered.`);
|
|
69
|
+
}
|
|
70
|
+
resumed = true;
|
|
71
|
+
const auth = { issuer, adminKey };
|
|
72
|
+
receipt = (await getResource(auth, opts.slug));
|
|
73
|
+
if (opts.originUrl) {
|
|
74
|
+
receipt = (await setOrigin(auth, opts.slug, opts.originUrl));
|
|
75
|
+
}
|
|
76
|
+
if (opts.connectedAccount) {
|
|
77
|
+
receipt = (await setConnectedAccount(auth, opts.slug, opts.connectedAccount));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
receipt = created;
|
|
82
|
+
originApiKey = typeof created.origin_api_key === "string" ? created.origin_api_key : undefined;
|
|
83
|
+
}
|
|
59
84
|
let storedAt;
|
|
60
85
|
if (originApiKey) {
|
|
61
86
|
storedAt = await writeOriginApiKey({
|
|
@@ -71,7 +96,9 @@ export function initCommand(program) {
|
|
|
71
96
|
// charges_enabled, and only the receipt knows that.
|
|
72
97
|
const pending = receipt.pending_requirements ?? [];
|
|
73
98
|
const status = receipt.status ?? (pending.length === 0 ? "live" : "draft");
|
|
74
|
-
console.log(
|
|
99
|
+
console.log(resumed
|
|
100
|
+
? `Resumed ${receipt.slug} (${status}) — slug was already registered to this key.`
|
|
101
|
+
: `Registered ${receipt.slug} (${status}).`);
|
|
75
102
|
console.log(` gateway URL: ${receipt.gateway_url ?? "-"}`);
|
|
76
103
|
console.log(` receipt: ${opts.out}`);
|
|
77
104
|
if (storedAt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAA4B,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAA4B,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,EACL,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,S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,SAAS,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QACxE,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;IACjG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAkB,CAAC;IACzC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* CLI twin of `authflow_integration_plan`. The MCP tool is how an agent usually gets this; the
|
|
4
|
+
* command exists so the two surfaces stay the same size.
|
|
5
|
+
*/
|
|
6
|
+
export declare function planCommand(program: Command): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { requireAdminKey, requireIssuer } from "../config.js";
|
|
2
|
+
import { buildIntegrationPlan, integrationFrameworks, isIntegrationFramework, } from "../integration.js";
|
|
3
|
+
import { getResource } from "../rail.js";
|
|
4
|
+
/**
|
|
5
|
+
* CLI twin of `authflow_integration_plan`. The MCP tool is how an agent usually gets this; the
|
|
6
|
+
* command exists so the two surfaces stay the same size.
|
|
7
|
+
*/
|
|
8
|
+
export function planCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command("plan")
|
|
11
|
+
.description("Print the framework-specific origin integration plan for a resource")
|
|
12
|
+
.requiredOption("--slug <slug>", "Resource slug")
|
|
13
|
+
.requiredOption("--framework <kind>", `Origin implementation (${integrationFrameworks.join(" | ")})`)
|
|
14
|
+
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
15
|
+
.option("--admin-key <key>", "Admin API key (default: AUTHFLOW_ADMIN_API_KEY)")
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
if (!isIntegrationFramework(opts.framework)) {
|
|
18
|
+
throw new Error(`--framework must be one of: ${integrationFrameworks.join(", ")}. Got '${opts.framework}'.`);
|
|
19
|
+
}
|
|
20
|
+
const auth = { issuer: requireIssuer(opts.issuer), adminKey: requireAdminKey(opts.adminKey) };
|
|
21
|
+
const receipt = await getResource(auth, opts.slug);
|
|
22
|
+
const plan = buildIntegrationPlan(opts.framework, receipt);
|
|
23
|
+
console.log(JSON.stringify(plan, null, 2));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qEAAqE,CAAC;SAClF,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC;SAChD,cAAc,CACb,oBAAoB,EACpB,0BAA0B,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAC/D;SACA,MAAM,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,iDAAiD,CAAC;SAC9E,MAAM,CAAC,KAAK,EAAE,IAA6E,EAAE,EAAE;QAC9F,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,+BAA+B,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,IAAI,CAC5F,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9F,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/probe.js
CHANGED
|
@@ -3,6 +3,7 @@ export function probeCommand(program) {
|
|
|
3
3
|
program
|
|
4
4
|
.command("probe")
|
|
5
5
|
.description("POST /origin/v1/conformance and print a pass/fail table")
|
|
6
|
+
.option("--slug <slug>", "Ignored: the origin API key is already bound to one resource. Accepted so documented invocations do not fail.")
|
|
6
7
|
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
7
8
|
.option("--origin-key <key>", "Origin API key (default: AUTHFLOW_ORIGIN_API_KEY)")
|
|
8
9
|
.action(async (opts) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/commands/probe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAA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AAQ,GAAG,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC7B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,GAAG,CAAC,KAAa,EAAE,KAAa;IACvC,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* The path for a creator who already has a Stripe Standard account on the platform. Hosted
|
|
4
|
+
* `connect` cannot take an acct_ id; this is the CLI verb that matches the HTTP PUT and the
|
|
5
|
+
* `authflow_set_connected_account` MCP tool.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setConnectedAccountCommand(program: Command): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { requireAdminKey, requireIssuer } from "../config.js";
|
|
2
|
+
import { describePending, setConnectedAccount } from "../rail.js";
|
|
3
|
+
import { formatCursorMcpConfig, formatReadiness, resourceReadiness } from "../status.js";
|
|
4
|
+
/**
|
|
5
|
+
* The path for a creator who already has a Stripe Standard account on the platform. Hosted
|
|
6
|
+
* `connect` cannot take an acct_ id; this is the CLI verb that matches the HTTP PUT and the
|
|
7
|
+
* `authflow_set_connected_account` MCP tool.
|
|
8
|
+
*/
|
|
9
|
+
export function setConnectedAccountCommand(program) {
|
|
10
|
+
program
|
|
11
|
+
.command("set-connected-account")
|
|
12
|
+
.description("Attach an existing Stripe Standard account (acct_…) to a resource")
|
|
13
|
+
.requiredOption("--slug <slug>", "Resource slug")
|
|
14
|
+
.requiredOption("--account <acct>", "Stripe Standard account id (acct_...)")
|
|
15
|
+
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
16
|
+
.option("--admin-key <key>", "Admin API key (default: AUTHFLOW_ADMIN_API_KEY)")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const auth = { issuer: requireIssuer(opts.issuer), adminKey: requireAdminKey(opts.adminKey) };
|
|
19
|
+
const receipt = await setConnectedAccount(auth, opts.slug, opts.account);
|
|
20
|
+
console.log(`Attached ${opts.account} to ${receipt.slug ?? opts.slug}.`);
|
|
21
|
+
console.log(`status: ${receipt.status ?? "draft"}`);
|
|
22
|
+
const pending = receipt.pending_requirements ?? [];
|
|
23
|
+
if (pending.length > 0) {
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log("Still pending before go-live:");
|
|
26
|
+
for (const requirement of pending) {
|
|
27
|
+
console.log(` ${requirement}`);
|
|
28
|
+
console.log(` ${describePending(requirement, opts.slug)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
console.log("");
|
|
32
|
+
console.log(formatReadiness(resourceReadiness(receipt)));
|
|
33
|
+
for (const line of formatCursorMcpConfig(receipt)) {
|
|
34
|
+
console.log(line);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=set-connected-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-connected-account.js","sourceRoot":"","sources":["../../src/commands/set-connected-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzF;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,OAAO;SACJ,OAAO,CAAC,uBAAuB,CAAC;SAChC,WAAW,CAAC,mEAAmE,CAAC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eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEzD,KAAK,MAAM,IAAI,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/doctor.d.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* This exists because of a real onboarding failure: tenant #1 was given a staging hostname whose
|
|
5
5
|
* DNS resolved but which was never bound to the App Service, so Azure answered `404 Site Not Found`
|
|
6
6
|
* on every path. They read the 404 on the keys document as "the rail's keys endpoint is broken" and
|
|
7
|
-
* filed it, while the rail was healthy the whole time on a different hostname.
|
|
8
|
-
*
|
|
7
|
+
* filed it, while the rail was healthy the whole time on a different hostname. The same class
|
|
8
|
+
* showed up again as 500 HTML on /login (and the other consumer pages) when returnUrl is
|
|
9
|
+
* missing — it looks like an outage, it is an unhandled throw. These checks do.
|
|
9
10
|
*/
|
|
10
11
|
export type DoctorCheck = {
|
|
11
12
|
name: string;
|
|
@@ -17,8 +18,31 @@ export type DoctorCheck = {
|
|
|
17
18
|
export type DoctorReport = {
|
|
18
19
|
issuer: string;
|
|
19
20
|
slug?: string;
|
|
21
|
+
/** MCP clients whose OAuth registration was replayed; absent when `--client` was not passed. */
|
|
22
|
+
clients?: string[];
|
|
23
|
+
dryRun?: boolean;
|
|
20
24
|
pass: boolean;
|
|
21
25
|
checks: DoctorCheck[];
|
|
22
26
|
};
|
|
23
27
|
export declare function runDoctor(issuer: string, slug?: string): Promise<DoctorReport>;
|
|
28
|
+
export declare function checkConsumerPages(base: string): Promise<DoctorCheck>;
|
|
29
|
+
/**
|
|
30
|
+
* The paywall is a transport-level 401 carrying `resource_metadata`. If this is not exactly right,
|
|
31
|
+
* MCP clients never prompt for auth, which presents as "the server just does not work in Claude".
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* The paywall is a transport-level 401 carrying `resource_metadata`. If this is not exactly right,
|
|
35
|
+
* MCP clients never prompt for auth, which presents as "the server just does not work in Claude".
|
|
36
|
+
*/
|
|
37
|
+
export declare function checkGatewayChallenge(base: string, slug: string): Promise<DoctorCheck>;
|
|
38
|
+
export type FetchOutcome = {
|
|
39
|
+
ok: boolean;
|
|
40
|
+
status?: number;
|
|
41
|
+
body?: string;
|
|
42
|
+
headers?: Headers;
|
|
43
|
+
location?: string;
|
|
44
|
+
error?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Network failures are a diagnosis here, not an exception — every one of them is a real finding. */
|
|
47
|
+
export declare function fetchOrNull(url: string, init?: RequestInit): Promise<FetchOutcome>;
|
|
24
48
|
export declare function formatDoctorReport(report: DoctorReport): string;
|