@wootsup/yt-builder-mcp 1.5.0 → 1.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/dist/auth.d.ts +11 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +11 -0
- package/dist/auth.js.map +1 -1
- package/dist/cli/doctor-command.d.ts.map +1 -1
- package/dist/cli/doctor-command.js +45 -2
- package/dist/cli/doctor-command.js.map +1 -1
- package/dist/client.d.ts +18 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/clients/claude-code.d.ts.map +1 -1
- package/dist/clients/claude-code.js +5 -2
- package/dist/clients/claude-code.js.map +1 -1
- package/dist/clients/claude-desktop.d.ts.map +1 -1
- package/dist/clients/claude-desktop.js +5 -2
- package/dist/clients/claude-desktop.js.map +1 -1
- package/dist/clients/cline.d.ts.map +1 -1
- package/dist/clients/cline.js +5 -2
- package/dist/clients/cline.js.map +1 -1
- package/dist/clients/codex-cli.d.ts.map +1 -1
- package/dist/clients/codex-cli.js +127 -2
- package/dist/clients/codex-cli.js.map +1 -1
- package/dist/clients/continue.d.ts.map +1 -1
- package/dist/clients/continue.js +11 -2
- package/dist/clients/continue.js.map +1 -1
- package/dist/clients/cursor.d.ts.map +1 -1
- package/dist/clients/cursor.js +5 -2
- package/dist/clients/cursor.js.map +1 -1
- package/dist/clients/gemini-cli.d.ts.map +1 -1
- package/dist/clients/gemini-cli.js +5 -2
- package/dist/clients/gemini-cli.js.map +1 -1
- package/dist/clients/index.d.ts +49 -0
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +79 -0
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/roo-code.d.ts.map +1 -1
- package/dist/clients/roo-code.js +5 -2
- package/dist/clients/roo-code.js.map +1 -1
- package/dist/clients/zed.d.ts.map +1 -1
- package/dist/clients/zed.js +22 -2
- package/dist/clients/zed.js.map +1 -1
- package/dist/diagnostics/doctor.d.ts +10 -1
- package/dist/diagnostics/doctor.d.ts.map +1 -1
- package/dist/diagnostics/doctor.js +23 -0
- package/dist/diagnostics/doctor.js.map +1 -1
- package/dist/diagnostics/startup-self-probe.d.ts +39 -0
- package/dist/diagnostics/startup-self-probe.d.ts.map +1 -0
- package/dist/diagnostics/startup-self-probe.js +87 -0
- package/dist/diagnostics/startup-self-probe.js.map +1 -0
- package/dist/gateway/essentials.d.ts +15 -6
- package/dist/gateway/essentials.d.ts.map +1 -1
- package/dist/gateway/essentials.js +51 -5
- package/dist/gateway/essentials.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/net/proxy-dispatcher.d.ts +7 -0
- package/dist/net/proxy-dispatcher.d.ts.map +1 -1
- package/dist/net/proxy-dispatcher.js +7 -2
- package/dist/net/proxy-dispatcher.js.map +1 -1
- package/dist/net/site-basic-auth.d.ts +65 -0
- package/dist/net/site-basic-auth.d.ts.map +1 -0
- package/dist/net/site-basic-auth.js +118 -0
- package/dist/net/site-basic-auth.js.map +1 -0
- package/dist/proxy/bridge.d.ts +18 -1
- package/dist/proxy/bridge.d.ts.map +1 -1
- package/dist/proxy/bridge.js +23 -3
- package/dist/proxy/bridge.js.map +1 -1
- package/dist/setup-wizard-types.d.ts +9 -0
- package/dist/setup-wizard-types.d.ts.map +1 -1
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +37 -0
- package/dist/setup-wizard.js.map +1 -1
- package/dist/sites/client-pool.d.ts +35 -1
- package/dist/sites/client-pool.d.ts.map +1 -1
- package/dist/sites/client-pool.js +45 -1
- package/dist/sites/client-pool.js.map +1 -1
- package/dist/tools/elements/builders.js +7 -7
- package/dist/tools/elements/builders.js.map +1 -1
- package/dist/tools/elements/handlers.d.ts +2 -0
- package/dist/tools/elements/handlers.d.ts.map +1 -1
- package/dist/tools/elements/handlers.js +48 -2
- package/dist/tools/elements/handlers.js.map +1 -1
- package/dist/tools/format/elements-format.d.ts.map +1 -1
- package/dist/tools/format/elements-format.js +8 -0
- package/dist/tools/format/elements-format.js.map +1 -1
- package/dist/tools/format/health-format.d.ts +2 -0
- package/dist/tools/format/health-format.d.ts.map +1 -1
- package/dist/tools/format/health-format.js +11 -0
- package/dist/tools/format/health-format.js.map +1 -1
- package/dist/tools/format/pages-format.d.ts +23 -0
- package/dist/tools/format/pages-format.d.ts.map +1 -1
- package/dist/tools/format/pages-format.js +28 -0
- package/dist/tools/format/pages-format.js.map +1 -1
- package/dist/tools/format/source-schema-format.d.ts +64 -0
- package/dist/tools/format/source-schema-format.d.ts.map +1 -0
- package/dist/tools/format/source-schema-format.js +161 -0
- package/dist/tools/format/source-schema-format.js.map +1 -0
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +31 -0
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/multi-items/builders.js +2 -2
- package/dist/tools/multi-items/builders.js.map +1 -1
- package/dist/tools/multi-items/inspect-handler.d.ts +8 -0
- package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/inspect-handler.js +48 -2
- package/dist/tools/multi-items/inspect-handler.js.map +1 -1
- package/dist/tools/pages/builders.d.ts.map +1 -1
- package/dist/tools/pages/builders.js +115 -26
- package/dist/tools/pages/builders.js.map +1 -1
- package/dist/tools/pages/handlers-read.d.ts +20 -1
- package/dist/tools/pages/handlers-read.d.ts.map +1 -1
- package/dist/tools/pages/handlers-read.js +131 -7
- package/dist/tools/pages/handlers-read.js.map +1 -1
- package/dist/tools/pages/handlers-write.d.ts +42 -1
- package/dist/tools/pages/handlers-write.d.ts.map +1 -1
- package/dist/tools/pages/handlers-write.js +114 -5
- package/dist/tools/pages/handlers-write.js.map +1 -1
- package/dist/tools/pages/schemas.d.ts +24 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -1
- package/dist/tools/pages/schemas.js +30 -0
- package/dist/tools/pages/schemas.js.map +1 -1
- package/dist/tools/pool-resolve-helper.d.ts +11 -26
- package/dist/tools/pool-resolve-helper.d.ts.map +1 -1
- package/dist/tools/pool-resolve-helper.js +50 -0
- package/dist/tools/pool-resolve-helper.js.map +1 -1
- package/dist/tools/sources/builders.d.ts.map +1 -1
- package/dist/tools/sources/builders.js +258 -4
- package/dist/tools/sources/builders.js.map +1 -1
- package/dist/tools/sources/handlers-bind.d.ts +107 -0
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -1
- package/dist/tools/sources/handlers-bind.js +197 -2
- package/dist/tools/sources/handlers-bind.js.map +1 -1
- package/dist/tools/sources/handlers.d.ts +54 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -1
- package/dist/tools/sources/handlers.js +82 -0
- package/dist/tools/sources/handlers.js.map +1 -1
- package/dist/tools/sparse-fields.d.ts +37 -1
- package/dist/tools/sparse-fields.d.ts.map +1 -1
- package/dist/tools/sparse-fields.js +35 -5
- package/dist/tools/sparse-fields.js.map +1 -1
- package/dist/tools/tool-builder/results.d.ts.map +1 -1
- package/dist/tools/tool-builder/results.js +3 -0
- package/dist/tools/tool-builder/results.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/yt-builder-mcp/SKILL.md +80 -34
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** A bounded TLS reachability probe of `url`. Resolves on any HTTP response
|
|
2
|
+
* (including 4xx/5xx — the TLS handshake succeeded), rejects on a transport
|
|
3
|
+
* failure (CA-trust, DNS, timeout, refused). */
|
|
4
|
+
export type TlsProbe = (url: string, timeoutMs: number) => Promise<void>;
|
|
5
|
+
export interface SelfProbeResult {
|
|
6
|
+
/** True → a TLS chain-of-trust failure was detected; the caller must exit. */
|
|
7
|
+
readonly caTrustFailure: boolean;
|
|
8
|
+
/** The actionable stderr message to print when `caTrustFailure` is true. */
|
|
9
|
+
readonly message?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Default bound for the startup probe — short enough to beat the host's ~30s
|
|
12
|
+
* connect-timeout with wide margin, long enough for a real corporate proxy. */
|
|
13
|
+
export declare const DEFAULT_SELF_PROBE_TIMEOUT_MS = 4000;
|
|
14
|
+
/**
|
|
15
|
+
* The default probe: a bounded `fetch` (HEAD) of `url` with an AbortController
|
|
16
|
+
* timeout. Resolves on ANY response (the handshake completed); the only thing we
|
|
17
|
+
* care about is whether the connection rejects with a CA-trust error, which
|
|
18
|
+
* surfaces as a rejected promise whose `.cause` chain carries the TLS code.
|
|
19
|
+
*/
|
|
20
|
+
export declare const defaultTlsProbe: TlsProbe;
|
|
21
|
+
/**
|
|
22
|
+
* Build the actionable stderr message for a CA-trust startup failure. Chooses
|
|
23
|
+
* the zero-export `--use-system-ca` remedy on Node ≥ 22.15, else the
|
|
24
|
+
* `NODE_EXTRA_CA_CERTS=<pem>` remedy. Never suggests disabling verification.
|
|
25
|
+
*/
|
|
26
|
+
export declare function caTrustStartupMessage(siteUrl: string, nodeVersion: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Run the startup TLS self-probe against `siteUrl`. Returns `{ caTrustFailure:
|
|
29
|
+
* false }` for every outcome EXCEPT a TLS chain-of-trust rejection — only that
|
|
30
|
+
* one outcome is fail-fast-worthy (everything else must still let the server
|
|
31
|
+
* boot). When `siteUrl` is empty/undefined the probe is skipped (the
|
|
32
|
+
* boot-unconfigured path must stay).
|
|
33
|
+
*/
|
|
34
|
+
export declare function runStartupSelfProbe(siteUrl: string | undefined, deps?: {
|
|
35
|
+
readonly probe?: TlsProbe;
|
|
36
|
+
readonly nodeVersion?: string;
|
|
37
|
+
readonly timeoutMs?: number;
|
|
38
|
+
}): Promise<SelfProbeResult>;
|
|
39
|
+
//# sourceMappingURL=startup-self-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-self-probe.d.ts","sourceRoot":"","sources":["../../src/diagnostics/startup-self-probe.ts"],"names":[],"mappings":"AA4BA;;gDAEgD;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;+EAC+E;AAC/E,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,QAQ7B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAUlF;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACrC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,GAAE;IACF,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC1B,GACP,OAAO,CAAC,eAAe,CAAC,CAoB1B"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// packages/mcp/src/diagnostics/startup-self-probe.ts
|
|
2
|
+
/**
|
|
3
|
+
* Startup TLS self-probe (P0.4 — fail-fast instead of a 30s /mcp hang).
|
|
4
|
+
*
|
|
5
|
+
* The Glöckle install-blocker: when the configured site sits behind a corporate
|
|
6
|
+
* TLS-inspection proxy whose root CA Node does not trust, the server opened
|
|
7
|
+
* stdio and waited — answering nothing — so the host's 30s `/mcp` connect-timeout
|
|
8
|
+
* fired with an opaque "Server disconnected" toast that "looked like an auth or
|
|
9
|
+
* server problem". The real cause (a self-signed cert in the chain) was invisible.
|
|
10
|
+
*
|
|
11
|
+
* This module sends ONE bounded HTTPS request to the configured site BEFORE the
|
|
12
|
+
* stdio transport is wired. If it rejects with a TLS chain-of-trust error
|
|
13
|
+
* (`isCaTrustError`), `main()` / the proxy bridge writes the actionable
|
|
14
|
+
* `--use-system-ca` / `NODE_EXTRA_CA_CERTS` fix to stderr and exits non-zero in
|
|
15
|
+
* < 2s — turning a silent 30s timeout into an immediate, copy-pasteable remedy.
|
|
16
|
+
* Any OTHER probe outcome (success, 401/404/5xx, DNS, plain timeout) is NOT a
|
|
17
|
+
* reason to abort: the server must still boot for those (auth can be fixed via a
|
|
18
|
+
* tool call; an unconfigured boot must stay). Never disables TLS verification.
|
|
19
|
+
*
|
|
20
|
+
* Pure + deps-injectable (the `probe` fn + `nodeVersion` + `now`) so it is
|
|
21
|
+
* unit-testable offline with no real network.
|
|
22
|
+
*
|
|
23
|
+
* @license MIT
|
|
24
|
+
*/
|
|
25
|
+
import { isCaTrustError, supportsSystemCa } from './ca-trust.js';
|
|
26
|
+
/** Default bound for the startup probe — short enough to beat the host's ~30s
|
|
27
|
+
* connect-timeout with wide margin, long enough for a real corporate proxy. */
|
|
28
|
+
export const DEFAULT_SELF_PROBE_TIMEOUT_MS = 4000;
|
|
29
|
+
/**
|
|
30
|
+
* The default probe: a bounded `fetch` (HEAD) of `url` with an AbortController
|
|
31
|
+
* timeout. Resolves on ANY response (the handshake completed); the only thing we
|
|
32
|
+
* care about is whether the connection rejects with a CA-trust error, which
|
|
33
|
+
* surfaces as a rejected promise whose `.cause` chain carries the TLS code.
|
|
34
|
+
*/
|
|
35
|
+
export const defaultTlsProbe = async (url, timeoutMs) => {
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
38
|
+
try {
|
|
39
|
+
await fetch(url, { method: 'HEAD', signal: controller.signal, redirect: 'manual' });
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Build the actionable stderr message for a CA-trust startup failure. Chooses
|
|
47
|
+
* the zero-export `--use-system-ca` remedy on Node ≥ 22.15, else the
|
|
48
|
+
* `NODE_EXTRA_CA_CERTS=<pem>` remedy. Never suggests disabling verification.
|
|
49
|
+
*/
|
|
50
|
+
export function caTrustStartupMessage(siteUrl, nodeVersion) {
|
|
51
|
+
const remedy = supportsSystemCa(nodeVersion)
|
|
52
|
+
? 'set NODE_OPTIONS=--use-system-ca (Node ≥ 22.15 — reads your OS / corporate root CA store)'
|
|
53
|
+
: `set NODE_EXTRA_CA_CERTS=<path-to-corp-root-ca.pem> (this Node ${nodeVersion} is below 22.15, so --use-system-ca is unavailable)`;
|
|
54
|
+
return (`[yt-builder-mcp] fatal: self-signed cert in chain reaching ${siteUrl} — ` +
|
|
55
|
+
'a corporate TLS-inspection proxy is injecting its own root CA that Node does not trust. ' +
|
|
56
|
+
`Fix: ${remedy}, then restart your AI client. ` +
|
|
57
|
+
'Re-run `npx -y @wootsup/yt-builder-mcp setup` to bake this automatically. Never disable TLS verification.');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Run the startup TLS self-probe against `siteUrl`. Returns `{ caTrustFailure:
|
|
61
|
+
* false }` for every outcome EXCEPT a TLS chain-of-trust rejection — only that
|
|
62
|
+
* one outcome is fail-fast-worthy (everything else must still let the server
|
|
63
|
+
* boot). When `siteUrl` is empty/undefined the probe is skipped (the
|
|
64
|
+
* boot-unconfigured path must stay).
|
|
65
|
+
*/
|
|
66
|
+
export async function runStartupSelfProbe(siteUrl, deps = {}) {
|
|
67
|
+
const url = (siteUrl ?? '').trim();
|
|
68
|
+
if (url === '')
|
|
69
|
+
return { caTrustFailure: false };
|
|
70
|
+
const probe = deps.probe ?? defaultTlsProbe;
|
|
71
|
+
const nodeVersion = deps.nodeVersion ?? process.version;
|
|
72
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_SELF_PROBE_TIMEOUT_MS;
|
|
73
|
+
try {
|
|
74
|
+
await probe(url, timeoutMs);
|
|
75
|
+
return { caTrustFailure: false };
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (isCaTrustError(err)) {
|
|
79
|
+
return { caTrustFailure: true, message: caTrustStartupMessage(url, nodeVersion) };
|
|
80
|
+
}
|
|
81
|
+
// Any other failure (DNS, timeout, refused, plain abort) is NOT a
|
|
82
|
+
// boot-blocker — the server must still come up. The proxy bridge's
|
|
83
|
+
// first-frame catch already turns those into actionable JSON-RPC errors.
|
|
84
|
+
return { caTrustFailure: false };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=startup-self-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-self-probe.js","sourceRoot":"","sources":["../../src/diagnostics/startup-self-probe.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAcjE;+EAC+E;AAC/E,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa,KAAK,EAAE,GAAW,EAAE,SAAiB,EAAiB,EAAE;IAC7F,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC;QACD,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxF,CAAC;YAAS,CAAC;QACP,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,WA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
*
|
|
18
|
-
* Why this split: Cursor caps MCP servers at ~40 tools.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* (
|
|
18
|
+
* Why this split: Cursor caps MCP servers at ~40 tools. The 3-lane shape
|
|
19
|
+
* keeps `tools/list` at 32 (L1) + 2 (L3) + 2 (gateways) = 36 entries, well
|
|
20
|
+
* under the cap, while every tool stays fully reachable (advanced tools
|
|
21
|
+
* through `yootheme_builder_advanced` / `yootheme_builder_advanced_read`).
|
|
22
|
+
* B4 (2026-06-27): element_get_binding promoted L2 → L1 (binding-read made
|
|
23
|
+
* first-class, mirroring the already-L1 element_bind_source write). L1 26 → 27.
|
|
24
|
+
* U4-L1 (Glöckle onboarding, 2026-06-27): source_get_schema promoted L2 → L1
|
|
25
|
+
* (the archive/category binding entry-point made first-class, mirroring how the
|
|
26
|
+
* bind→verify tools are already L1). L1 27 → 28.
|
|
27
|
+
* HANDOFF-4/5 L1 (Glöckle onboarding, 2026-06-28): render_preview,
|
|
28
|
+
* element_set_source, rename_source, template_set_type promoted L2 → L1 — the
|
|
29
|
+
* core write/refactor + render-verify tools the Glöckle HANDOFF-4/5 ask for,
|
|
30
|
+
* made first-class so a cold agent can discover them in tools/list (L2 was a
|
|
31
|
+
* discoverability workaround). L1 28 → 32, advanced 9 → 5.
|
|
23
32
|
*
|
|
24
33
|
* F116 (2026-06-11): the bind→save→publish chain (element_bind_source,
|
|
25
34
|
* page_save, page_publish) was promoted from the advanced lane to L1. It is
|
|
@@ -42,7 +51,7 @@
|
|
|
42
51
|
* L1 — Tools kept as first-class entries in `tools/list`.
|
|
43
52
|
* Forwarded by the CapturingServer to the real McpServer.
|
|
44
53
|
*/
|
|
45
|
-
export declare const ESSENTIAL_TOOLS: readonly ["yootheme_builder_pages_list", "yootheme_builder_pages_resolve", "yootheme_builder_get_etag", "yootheme_builder_element_list", "yootheme_builder_element_add", "yootheme_builder_element_update_settings", "yootheme_builder_sources_list", "yootheme_builder_element_types_list", "yootheme_builder_inspect_multi_items_binding", "yootheme_builder_element_get", "yootheme_builder_element_delete", "yootheme_builder_element_clone", "yootheme_builder_element_move", "yootheme_builder_page_get_layout", "yootheme_builder_template_summary", "yootheme_builder_element_type_get_schema", "yootheme_builder_sites_list", "yootheme_builder_sites_test", "yootheme_builder_use_site", "yootheme_builder_pages_create", "yootheme_builder_pages_delete", "yootheme_builder_element_bind_source", "yootheme_builder_page_save", "yootheme_builder_page_publish", "yootheme_builder_page_dynamize", "yootheme_builder_scaffold_section"];
|
|
54
|
+
export declare const ESSENTIAL_TOOLS: readonly ["yootheme_builder_pages_list", "yootheme_builder_pages_resolve", "yootheme_builder_get_etag", "yootheme_builder_element_list", "yootheme_builder_element_add", "yootheme_builder_element_update_settings", "yootheme_builder_sources_list", "yootheme_builder_element_types_list", "yootheme_builder_inspect_multi_items_binding", "yootheme_builder_element_get", "yootheme_builder_element_delete", "yootheme_builder_element_clone", "yootheme_builder_element_move", "yootheme_builder_page_get_layout", "yootheme_builder_template_summary", "yootheme_builder_element_type_get_schema", "yootheme_builder_sites_list", "yootheme_builder_sites_test", "yootheme_builder_use_site", "yootheme_builder_pages_create", "yootheme_builder_pages_delete", "yootheme_builder_element_bind_source", "yootheme_builder_page_save", "yootheme_builder_page_publish", "yootheme_builder_element_get_binding", "yootheme_builder_page_dynamize", "yootheme_builder_scaffold_section", "yootheme_builder_source_get_schema", "yootheme_builder_render_preview", "yootheme_builder_element_set_source", "yootheme_builder_rename_source", "yootheme_builder_template_set_type"];
|
|
46
55
|
/**
|
|
47
56
|
* L3 — Tools registered DIRECTLY on the real McpServer, BEFORE the
|
|
48
57
|
* CapturingServer wraps it. The CapturingServer treats these names as a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"essentials.d.ts","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"essentials.d.ts","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,onCAyHlB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,mEAGzB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
|
@@ -15,11 +15,20 @@
|
|
|
15
15
|
* entirely (no forward, no capture) so the
|
|
16
16
|
* SDK never sees a duplicate registration.
|
|
17
17
|
*
|
|
18
|
-
* Why this split: Cursor caps MCP servers at ~40 tools.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* (
|
|
18
|
+
* Why this split: Cursor caps MCP servers at ~40 tools. The 3-lane shape
|
|
19
|
+
* keeps `tools/list` at 32 (L1) + 2 (L3) + 2 (gateways) = 36 entries, well
|
|
20
|
+
* under the cap, while every tool stays fully reachable (advanced tools
|
|
21
|
+
* through `yootheme_builder_advanced` / `yootheme_builder_advanced_read`).
|
|
22
|
+
* B4 (2026-06-27): element_get_binding promoted L2 → L1 (binding-read made
|
|
23
|
+
* first-class, mirroring the already-L1 element_bind_source write). L1 26 → 27.
|
|
24
|
+
* U4-L1 (Glöckle onboarding, 2026-06-27): source_get_schema promoted L2 → L1
|
|
25
|
+
* (the archive/category binding entry-point made first-class, mirroring how the
|
|
26
|
+
* bind→verify tools are already L1). L1 27 → 28.
|
|
27
|
+
* HANDOFF-4/5 L1 (Glöckle onboarding, 2026-06-28): render_preview,
|
|
28
|
+
* element_set_source, rename_source, template_set_type promoted L2 → L1 — the
|
|
29
|
+
* core write/refactor + render-verify tools the Glöckle HANDOFF-4/5 ask for,
|
|
30
|
+
* made first-class so a cold agent can discover them in tools/list (L2 was a
|
|
31
|
+
* discoverability workaround). L1 28 → 32, advanced 9 → 5.
|
|
23
32
|
*
|
|
24
33
|
* F116 (2026-06-11): the bind→save→publish chain (element_bind_source,
|
|
25
34
|
* page_save, page_publish) was promoted from the advanced lane to L1. It is
|
|
@@ -112,6 +121,16 @@ export const ESSENTIAL_TOOLS = [
|
|
|
112
121
|
'yootheme_builder_element_bind_source',
|
|
113
122
|
'yootheme_builder_page_save',
|
|
114
123
|
'yootheme_builder_page_publish',
|
|
124
|
+
// B4 (Glöckle onboarding, 2026-06-27) — promote the binding READ to L1,
|
|
125
|
+
// mirroring its already-L1 WRITE sibling element_bind_source (F116). The
|
|
126
|
+
// READ stayed behind the advanced(-read) gateway: an agent that had just
|
|
127
|
+
// bound a relation traversal could not directly confirm query.field /
|
|
128
|
+
// arguments without first discovering the gateway — a 2-call discovery tax
|
|
129
|
+
// on the verify half of the bind→verify loop. Making binding-read
|
|
130
|
+
// first-class closes the asymmetry. This is a tier-LIST move (the catalog
|
|
131
|
+
// tool already exists); sync-catalog re-run flips its tier to essential.
|
|
132
|
+
// L1 surface 26 → 27.
|
|
133
|
+
'yootheme_builder_element_get_binding',
|
|
115
134
|
// P-G (Goldstandard wave 3) — page_dynamize is THE canonical one-call
|
|
116
135
|
// path to dynamize an existing designed section (copy byte-identically,
|
|
117
136
|
// swap only mapped queries + leaf names). It MUST be L1 so an agent
|
|
@@ -126,6 +145,33 @@ export const ESSENTIAL_TOOLS = [
|
|
|
126
145
|
// directly INSTEAD of hand-building (and tripping the guard on) an
|
|
127
146
|
// invalid root/section/row placement. With the prior set L1 24 → 25.
|
|
128
147
|
'yootheme_builder_scaffold_section',
|
|
148
|
+
// U4-L1 (Glöckle onboarding, 2026-06-27) — promote source_get_schema to L1.
|
|
149
|
+
// It is THE one-call entry-point for binding on an archive/category template
|
|
150
|
+
// (introspect a source's query methods + RELATIONS + the archive-context
|
|
151
|
+
// flag — turning a ~25-call code-dive into one). It stayed behind the
|
|
152
|
+
// advanced(-read) gateway, so a cold agent orienting toward a Term→Posts
|
|
153
|
+
// bind had to discover the gateway first — a 2-call discovery tax on the
|
|
154
|
+
// very first call of the canonical archive-binding workflow, whose write
|
|
155
|
+
// sibling element_bind_source is already L1 (F116). Making source-schema
|
|
156
|
+
// discovery first-class closes that asymmetry. This is a tier-LIST move
|
|
157
|
+
// (the catalog tool already exists); sync-catalog re-run flips its tier to
|
|
158
|
+
// essential. L1 surface 27 → 28.
|
|
159
|
+
'yootheme_builder_source_get_schema',
|
|
160
|
+
// HANDOFF-4/5 L1 (Glöckle onboarding, 2026-06-28) — promote the four core
|
|
161
|
+
// write/refactor + render-verify tools the Glöckle HANDOFF-4/5 explicitly
|
|
162
|
+
// ask for to L1. They were registered + reachable only via the advanced
|
|
163
|
+
// (-read) gateway, so a cold agent could not DISCOVER them in tools/list —
|
|
164
|
+
// L2 was a discoverability workaround, not a design choice. These ARE the
|
|
165
|
+
// canonical archive-rebind/refactor surface (set a precomposed source at a
|
|
166
|
+
// pointer; render-verify the saved page is not silently blank; rename a
|
|
167
|
+
// source/field template-wide after a taxonomy/CPT rename; re-type an
|
|
168
|
+
// orphaned archive/single template). Each is a tier-LIST move (the catalog
|
|
169
|
+
// tools already exist); sync-catalog re-run flips their tier to essential.
|
|
170
|
+
// L1 surface 28 → 32.
|
|
171
|
+
'yootheme_builder_render_preview',
|
|
172
|
+
'yootheme_builder_element_set_source',
|
|
173
|
+
'yootheme_builder_rename_source',
|
|
174
|
+
'yootheme_builder_template_set_type',
|
|
129
175
|
];
|
|
130
176
|
/**
|
|
131
177
|
* L3 — Tools registered DIRECTLY on the real McpServer, BEFORE the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"essentials.js","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"essentials.js","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,6BAA6B;IAC7B,qEAAqE;IACrE,qEAAqE;IACrE,uEAAuE;IACvE,mEAAmE;IACnE,gCAAgC;IAChC,2BAA2B;IAC3B,+BAA+B;IAC/B,8BAA8B;IAC9B,0CAA0C;IAC1C,+BAA+B;IAC/B,qCAAqC;IACrC,6DAA6D;IAC7D,kEAAkE;IAClE,6DAA6D;IAC7D,yCAAyC;IACzC,8CAA8C;IAC9C,iEAAiE;IACjE,4DAA4D;IAC5D,mEAAmE;IACnE,iEAAiE;IACjE,sEAAsE;IACtE,qEAAqE;IACrE,8BAA8B;IAC9B,iCAAiC;IACjC,gCAAgC;IAChC,+BAA+B;IAC/B,kCAAkC;IAClC,oEAAoE;IACpE,sEAAsE;IACtE,mCAAmC;IACnC,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IACjE,4DAA4D;IAC5D,4DAA4D;IAC5D,0CAA0C;IAC1C,mEAAmE;IACnE,oEAAoE;IACpE,mEAAmE;IACnE,kEAAkE;IAClE,uEAAuE;IACvE,6BAA6B;IAC7B,6BAA6B;IAC7B,mEAAmE;IACnE,oEAAoE;IACpE,oEAAoE;IACpE,8DAA8D;IAC9D,+BAA+B;IAC/B,2BAA2B;IAC3B,oEAAoE;IACpE,iEAAiE;IACjE,mEAAmE;IACnE,oEAAoE;IACpE,kEAAkE;IAClE,kCAAkC;IAClC,+BAA+B;IAC/B,+BAA+B;IAC/B,8EAA8E;IAC9E,sEAAsE;IACtE,uEAAuE;IACvE,oEAAoE;IACpE,oEAAoE;IACpE,yEAAyE;IACzE,kEAAkE;IAClE,yCAAyC;IACzC,sCAAsC;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
*/
|
|
14
|
+
import { type TlsProbe } from './diagnostics/startup-self-probe.js';
|
|
14
15
|
export { createServer, SERVER_NAME, SERVER_VERSION } from './server.js';
|
|
15
16
|
export { RestClient, REST_NAMESPACE_PATH, encodeElementPath } from './client.js';
|
|
16
17
|
export { loadConfig, loadRegistry, isTestMode, ENV_SITE_URL, ENV_WP_URL, ENV_BEARER, ENV_SITES_FILE, ENV_PLATFORM, ENV_PROFILE, ENV_TEST_MODE, } from './auth.js';
|
|
@@ -25,6 +26,19 @@ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel,
|
|
|
25
26
|
export { CapturingServer, type AdvancedToolEntry, type CapturedToolHandler, type ToolRegistrar, } from './gateway/capturing-server.js';
|
|
26
27
|
export { registerAdvancedTool } from './gateway/advanced-tool.js';
|
|
27
28
|
export { collectAllRegisteredTools, findTool, type CollectedTool, } from './gateway/test-support.js';
|
|
28
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Optional injection seam for {@link main} — lets the startup self-probe (P0.4)
|
|
31
|
+
* be driven deterministically in tests without a real network. Production passes
|
|
32
|
+
* nothing, so the real bounded `fetch` probe runs.
|
|
33
|
+
*/
|
|
34
|
+
export interface MainDeps {
|
|
35
|
+
/** Override the startup TLS self-probe (P0.4). Default: real bounded fetch. */
|
|
36
|
+
readonly selfProbe?: TlsProbe;
|
|
37
|
+
/** Override `process.version` for the self-probe's remedy choice. */
|
|
38
|
+
readonly nodeVersion?: string;
|
|
39
|
+
/** Override `process.exit` so a CA-trust abort is observable in tests. */
|
|
40
|
+
readonly exit?: (code: number) => never;
|
|
41
|
+
}
|
|
42
|
+
declare function main(deps?: MainDeps): Promise<void>;
|
|
29
43
|
export { main };
|
|
30
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAA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AAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;CAC3C;AAED,iBAAe,IAAI,CAAC,IAAI,GAAE,QAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoJtD;AAkBD,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* @license MIT
|
|
13
13
|
*/
|
|
14
14
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
|
-
import { isTestMode, loadRegistry } from './auth.js';
|
|
15
|
+
import { ENV_SITE_URL, ENV_WP_URL, isTestMode, loadRegistry } from './auth.js';
|
|
16
|
+
import { runStartupSelfProbe } from './diagnostics/startup-self-probe.js';
|
|
16
17
|
import { ConfigError } from './errors.js';
|
|
17
18
|
import { installGlobalProxyDispatcher } from './net/proxy-dispatcher.js';
|
|
18
19
|
import { SERVER_VERSION } from './server.js';
|
|
@@ -40,7 +41,7 @@ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel,
|
|
|
40
41
|
export { CapturingServer, } from './gateway/capturing-server.js';
|
|
41
42
|
export { registerAdvancedTool } from './gateway/advanced-tool.js';
|
|
42
43
|
export { collectAllRegisteredTools, findTool, } from './gateway/test-support.js';
|
|
43
|
-
async function main() {
|
|
44
|
+
async function main(deps = {}) {
|
|
44
45
|
// Honor an enterprise HTTP(S)_PROXY / NO_PROXY before any outbound call —
|
|
45
46
|
// BOTH proxy mode (below) and fat mode use Node's global fetch, which reads
|
|
46
47
|
// this global dispatcher. Unconditional + passthrough-safe (no proxy env =
|
|
@@ -55,6 +56,13 @@ async function main() {
|
|
|
55
56
|
for (const w of parseExtraHeaders().warnings) {
|
|
56
57
|
process.stderr.write(`[yt-builder-mcp] ${w}\n`);
|
|
57
58
|
}
|
|
59
|
+
// U3 — surface any YTB_MCP_SITE_BASIC_AUTH parse warning (missing colon /
|
|
60
|
+
// empty username) ONCE at startup. The warning NEVER contains the
|
|
61
|
+
// credential value (see net/site-basic-auth.ts).
|
|
62
|
+
const { parseSiteBasicAuth } = await import('./net/site-basic-auth.js');
|
|
63
|
+
for (const w of parseSiteBasicAuth().warnings) {
|
|
64
|
+
process.stderr.write(`[yt-builder-mcp] ${w}\n`);
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
// Update notice (non-blocking, cached 24h, fail-silent) — surfaces a newer
|
|
60
68
|
// npm version to stderr without ever delaying serving or breaking behind a
|
|
@@ -71,6 +79,33 @@ async function main() {
|
|
|
71
79
|
/* fail-silent — the notifier is a courtesy, never a dependency */
|
|
72
80
|
});
|
|
73
81
|
}
|
|
82
|
+
// P0.4 — bounded startup TLS self-probe. Before we open stdio (in EITHER
|
|
83
|
+
// proxy or fat mode), send ONE short HTTPS request to the configured site.
|
|
84
|
+
// If it rejects with a TLS chain-of-trust error (a corporate TLS-inspection
|
|
85
|
+
// proxy whose root CA Node doesn't trust), print the actionable
|
|
86
|
+
// --use-system-ca / NODE_EXTRA_CA_CERTS fix to stderr and exit fast (< 2s)
|
|
87
|
+
// instead of hanging until the host's ~30s /mcp connect-timeout. Skipped in
|
|
88
|
+
// test-mode (the smoke probe must not hit the network) and when no site is
|
|
89
|
+
// configured (the boot-unconfigured path must stay). Any non-CA outcome
|
|
90
|
+
// (success, 401/404/5xx, DNS, plain timeout) lets the server boot normally.
|
|
91
|
+
if (!isTestMode()) {
|
|
92
|
+
const siteUrl = process.env[ENV_SITE_URL] ?? process.env[ENV_WP_URL];
|
|
93
|
+
const probeResult = await runStartupSelfProbe(siteUrl, {
|
|
94
|
+
...(deps.selfProbe !== undefined ? { probe: deps.selfProbe } : {}),
|
|
95
|
+
...(deps.nodeVersion !== undefined ? { nodeVersion: deps.nodeVersion } : {}),
|
|
96
|
+
});
|
|
97
|
+
if (probeResult.caTrustFailure) {
|
|
98
|
+
process.stderr.write(`${probeResult.message ?? ''}\n`);
|
|
99
|
+
// Default exits the process (never returns). An injected stub in
|
|
100
|
+
// tests does NOT terminate, so we must still stop here — return
|
|
101
|
+
// BEFORE the call would be wrong (the real exit must fire), so we
|
|
102
|
+
// invoke then return. Typed `(code) => void` so the post-call return
|
|
103
|
+
// stays reachable for the stub path.
|
|
104
|
+
const doExit = deps.exit ?? ((code) => process.exit(code));
|
|
105
|
+
doExit(1);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
74
109
|
// Proxy mode: forward stdio 1:1 to the plugin-served PHP MCP endpoint and
|
|
75
110
|
// stop here — the fat catalog below is bypassed entirely. Default (fat) is
|
|
76
111
|
// unchanged. The dynamic import is gated on the env so the fat path never
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAiB,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,E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AO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -12,6 +12,13 @@ export interface ProxyDispatcherDeps {
|
|
|
12
12
|
/** Defaults to `console.error`. */
|
|
13
13
|
stderr?: (message: string) => void;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Is any forward-proxy configured in the environment? Exported so the setup
|
|
17
|
+
* wizard's P0.1 default-on CA bake can reuse the SAME definition of "a corporate
|
|
18
|
+
* proxy is present" (one source of truth — no drift between the dispatcher and
|
|
19
|
+
* the installer).
|
|
20
|
+
*/
|
|
21
|
+
export declare function hasProxyConfigured(env: NodeJS.ProcessEnv): boolean;
|
|
15
22
|
/**
|
|
16
23
|
* Install a process-global undici dispatcher that honors the enterprise
|
|
17
24
|
* `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` environment variables at request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-dispatcher.d.ts","sourceRoot":"","sources":["../../src/net/proxy-dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAuE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9G;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACvD,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,UAAU,CAAC;IACzC,mCAAmC;IACnC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"proxy-dispatcher.d.ts","sourceRoot":"","sources":["../../src/net/proxy-dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAuE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9G;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACvD,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,UAAU,CAAC;IACzC,mCAAmC;IACnC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAElE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAkCpF"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// packages/mcp/src/net/proxy-dispatcher.ts
|
|
2
2
|
import { EnvHttpProxyAgent, setGlobalDispatcher as undiciSetGlobalDispatcher } from 'undici';
|
|
3
3
|
import { deriveNoProxyForInternalSite } from './internal-host.js';
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Is any forward-proxy configured in the environment? Exported so the setup
|
|
6
|
+
* wizard's P0.1 default-on CA bake can reuse the SAME definition of "a corporate
|
|
7
|
+
* proxy is present" (one source of truth — no drift between the dispatcher and
|
|
8
|
+
* the installer).
|
|
9
|
+
*/
|
|
10
|
+
export function hasProxyConfigured(env) {
|
|
6
11
|
return Boolean(env.HTTPS_PROXY ?? env.https_proxy ?? env.HTTP_PROXY ?? env.http_proxy);
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-dispatcher.js","sourceRoot":"","sources":["../../src/net/proxy-dispatcher.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,IAAI,yBAAyB,EAAmB,MAAM,QAAQ,CAAC;AAE9G,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAgBlE
|
|
1
|
+
{"version":3,"file":"proxy-dispatcher.js","sourceRoot":"","sources":["../../src/net/proxy-dispatcher.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,IAAI,yBAAyB,EAAmB,MAAM,QAAQ,CAAC;AAE9G,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAgBlE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAsB;IACrD,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3F,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAA4B,EAAE;IACvE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,sEAAsE;QACtE,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,IAAI,yBAAyB,CAAC;IAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,IAAI,CAAC,GAAe,EAAE,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;IAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEhF,4EAA4E;IAC5E,2EAA2E;IAC3E,yEAAyE;IACzE,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,OAAO,GAAG,4BAA4B,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACrF,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACnD,oEAAoE;QACpE,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,wCAAwC,OAAO,CAAC,SAAS,IAAI,EAAE,0DAA0D,CAAC,CAAC;IACpI,CAAC;IAED,IAAI,CAAC;QACD,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,mEAAmE;QACnE,IAAI,CAAC,wFAAwF,OAAO,EAAE,CAAC,CAAC;QACxG,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse `YTB_MCP_SITE_BASIC_AUTH` ('user:pass') into URL **userinfo** that is
|
|
3
|
+
* injected into the upstream request URL (`https://user:pass@host/…`) on BOTH
|
|
4
|
+
* transports (fat-mode {@link RestClient} base URL and proxy-mode endpoint URL).
|
|
5
|
+
*
|
|
6
|
+
* Why this exists (U3 — Glöckle post-cert QA blocker): a site fronted by a pure
|
|
7
|
+
* HTTP **Basic-Auth realm** (e.g. `qa.gloeckle.de`) requires
|
|
8
|
+
* `Authorization: Basic …`. But the plugin Bearer already owns the single
|
|
9
|
+
* `Authorization` header on every outbound request, and `YTB_MCP_EXTRA_HEADERS`
|
|
10
|
+
* HARD-FORBIDS an `Authorization` key (see {@link parseExtraHeaders}) — so Basic
|
|
11
|
+
* and the Bearer collide on the one header and the site is unreachable.
|
|
12
|
+
*
|
|
13
|
+
* The fix routes the site-level Basic credentials on a **separate transport**:
|
|
14
|
+
* URL userinfo. Userinfo and the `Authorization` header are independent — undici
|
|
15
|
+
* / fetch turn `https://user:pass@host` into an `Authorization: Basic …` toward
|
|
16
|
+
* the **gateway/realm**, while we keep emitting `Authorization: Bearer …` toward
|
|
17
|
+
* the **plugin** behind it. The Bearer is never touched; the realm and the
|
|
18
|
+
* plugin each get the credential they expect.
|
|
19
|
+
*
|
|
20
|
+
* ── Accepted format ─────────────────────────────────────────────────────────
|
|
21
|
+
* `user:pass` — split on the FIRST colon (passwords may contain colons).
|
|
22
|
+
* - The username MUST be non-empty.
|
|
23
|
+
* - The password MAY be empty (some realms use a user-only token).
|
|
24
|
+
* Both halves are percent-encoded for userinfo via the WHATWG URL encoder, so
|
|
25
|
+
* reserved chars (`@`, `/`, `:`, space, …) survive into a valid URL.
|
|
26
|
+
*
|
|
27
|
+
* ── Security invariants ─────────────────────────────────────────────────────
|
|
28
|
+
* - The credential value is **NEVER** echoed in a warning or logged. Malformed
|
|
29
|
+
* input yields a generic "missing colon / empty username" warning only.
|
|
30
|
+
* - This channel NEVER touches the `Authorization` header — it rides URL
|
|
31
|
+
* userinfo exclusively, so the Bearer always wins (orthogonal transports).
|
|
32
|
+
*
|
|
33
|
+
* Pure + deterministic. `warnings` collects non-fatal issues; the caller (the
|
|
34
|
+
* server boot path) surfaces them once to stderr.
|
|
35
|
+
*
|
|
36
|
+
* @license MIT
|
|
37
|
+
*/
|
|
38
|
+
/** Canonical env-var name for the site-level HTTP Basic-Auth feature. */
|
|
39
|
+
export declare const ENV_SITE_BASIC_AUTH = "YTB_MCP_SITE_BASIC_AUTH";
|
|
40
|
+
export interface ParsedSiteBasicAuth {
|
|
41
|
+
/**
|
|
42
|
+
* Percent-encoded `user:pass` userinfo ready to splice into a URL, or
|
|
43
|
+
* `null` when the env var is unset/blank/malformed. NEVER contains the raw
|
|
44
|
+
* (un-encoded) credential beyond what userinfo requires.
|
|
45
|
+
*/
|
|
46
|
+
readonly userinfo: string | null;
|
|
47
|
+
/** Non-fatal issues (missing colon, empty username). Never echo the secret. */
|
|
48
|
+
readonly warnings: readonly string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Parse `YTB_MCP_SITE_BASIC_AUTH` from `env` (default `process.env`). Returns
|
|
52
|
+
* `{ userinfo: null, warnings: [] }` when unset/blank, and a generic warning
|
|
53
|
+
* (never containing the secret) when the value is malformed.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseSiteBasicAuth(env?: NodeJS.ProcessEnv): ParsedSiteBasicAuth;
|
|
56
|
+
/**
|
|
57
|
+
* Splice `userinfo` (a percent-encoded `user:pass`) into `url`, returning the
|
|
58
|
+
* resulting href. When `userinfo` is `null`, the URL is returned unchanged
|
|
59
|
+
* (string form). Any pre-existing userinfo on the URL is overwritten.
|
|
60
|
+
*
|
|
61
|
+
* This is the ONLY mutation the site-Basic channel performs — it never adds or
|
|
62
|
+
* alters a header, so the Bearer in `Authorization` is untouched.
|
|
63
|
+
*/
|
|
64
|
+
export declare function applyUserinfoToUrl(url: string | URL, userinfo: string | null): string;
|
|
65
|
+
//# sourceMappingURL=site-basic-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-basic-auth.d.ts","sourceRoot":"","sources":["../../src/net/site-basic-auth.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAqBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,mBAAmB,CA8B5F;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBrF"}
|