@wootsup/yt-builder-mcp 1.0.0 → 1.0.1
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/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/{yootheme-builder → yt-builder-mcp}/SKILL.md +1 -1
- package/dist/auth.d.ts +0 -39
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -93
- package/dist/auth.js.map +0 -1
- package/dist/client.d.ts +0 -84
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -151
- package/dist/client.js.map +0 -1
- package/dist/clients/claude-code.d.ts +0 -18
- package/dist/clients/claude-code.d.ts.map +0 -1
- package/dist/clients/claude-code.js +0 -53
- package/dist/clients/claude-code.js.map +0 -1
- package/dist/clients/claude-desktop.d.ts +0 -19
- package/dist/clients/claude-desktop.d.ts.map +0 -1
- package/dist/clients/claude-desktop.js +0 -56
- package/dist/clients/claude-desktop.js.map +0 -1
- package/dist/clients/cline.d.ts +0 -26
- package/dist/clients/cline.d.ts.map +0 -1
- package/dist/clients/cline.js +0 -80
- package/dist/clients/cline.js.map +0 -1
- package/dist/clients/codex-cli.d.ts +0 -42
- package/dist/clients/codex-cli.d.ts.map +0 -1
- package/dist/clients/codex-cli.js +0 -194
- package/dist/clients/codex-cli.js.map +0 -1
- package/dist/clients/continue.d.ts +0 -13
- package/dist/clients/continue.d.ts.map +0 -1
- package/dist/clients/continue.js +0 -52
- package/dist/clients/continue.js.map +0 -1
- package/dist/clients/cursor.d.ts +0 -12
- package/dist/clients/cursor.d.ts.map +0 -1
- package/dist/clients/cursor.js +0 -38
- package/dist/clients/cursor.js.map +0 -1
- package/dist/clients/gemini-cli.d.ts +0 -18
- package/dist/clients/gemini-cli.d.ts.map +0 -1
- package/dist/clients/gemini-cli.js +0 -44
- package/dist/clients/gemini-cli.js.map +0 -1
- package/dist/clients/home.d.ts +0 -14
- package/dist/clients/home.d.ts.map +0 -1
- package/dist/clients/home.js +0 -20
- package/dist/clients/home.js.map +0 -1
- package/dist/clients/index.d.ts +0 -52
- package/dist/clients/index.d.ts.map +0 -1
- package/dist/clients/index.js +0 -72
- package/dist/clients/index.js.map +0 -1
- package/dist/clients/roo-code.d.ts +0 -23
- package/dist/clients/roo-code.d.ts.map +0 -1
- package/dist/clients/roo-code.js +0 -69
- package/dist/clients/roo-code.js.map +0 -1
- package/dist/clients/zed.d.ts +0 -12
- package/dist/clients/zed.d.ts.map +0 -1
- package/dist/clients/zed.js +0 -41
- package/dist/clients/zed.js.map +0 -1
- package/dist/errors/hints.d.ts +0 -51
- package/dist/errors/hints.d.ts.map +0 -1
- package/dist/errors/hints.js +0 -95
- package/dist/errors/hints.js.map +0 -1
- package/dist/errors/mask.d.ts +0 -35
- package/dist/errors/mask.d.ts.map +0 -1
- package/dist/errors/mask.js +0 -49
- package/dist/errors/mask.js.map +0 -1
- package/dist/errors/sanitize.d.ts +0 -31
- package/dist/errors/sanitize.d.ts.map +0 -1
- package/dist/errors/sanitize.js +0 -90
- package/dist/errors/sanitize.js.map +0 -1
- package/dist/errors.d.ts +0 -42
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -61
- package/dist/errors.js.map +0 -1
- package/dist/gateway/advanced-tool/discovery.d.ts +0 -19
- package/dist/gateway/advanced-tool/discovery.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/discovery.js +0 -53
- package/dist/gateway/advanced-tool/discovery.js.map +0 -1
- package/dist/gateway/advanced-tool/domains.d.ts +0 -47
- package/dist/gateway/advanced-tool/domains.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/domains.js +0 -94
- package/dist/gateway/advanced-tool/domains.js.map +0 -1
- package/dist/gateway/advanced-tool/execute.d.ts +0 -29
- package/dist/gateway/advanced-tool/execute.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/execute.js +0 -54
- package/dist/gateway/advanced-tool/execute.js.map +0 -1
- package/dist/gateway/advanced-tool/index.d.ts +0 -36
- package/dist/gateway/advanced-tool/index.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/index.js +0 -39
- package/dist/gateway/advanced-tool/index.js.map +0 -1
- package/dist/gateway/advanced-tool/register.d.ts +0 -18
- package/dist/gateway/advanced-tool/register.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/register.js +0 -69
- package/dist/gateway/advanced-tool/register.js.map +0 -1
- package/dist/gateway/advanced-tool.d.ts +0 -13
- package/dist/gateway/advanced-tool.d.ts.map +0 -1
- package/dist/gateway/advanced-tool.js +0 -13
- package/dist/gateway/advanced-tool.js.map +0 -1
- package/dist/gateway/capturing-server.d.ts +0 -117
- package/dist/gateway/capturing-server.d.ts.map +0 -1
- package/dist/gateway/capturing-server.js +0 -103
- package/dist/gateway/capturing-server.js.map +0 -1
- package/dist/gateway/essentials.d.ts +0 -49
- package/dist/gateway/essentials.d.ts.map +0 -1
- package/dist/gateway/essentials.js +0 -79
- package/dist/gateway/essentials.js.map +0 -1
- package/dist/gateway/test-support.d.ts +0 -41
- package/dist/gateway/test-support.d.ts.map +0 -1
- package/dist/gateway/test-support.js +0 -60
- package/dist/gateway/test-support.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -77
- package/dist/index.js.map +0 -1
- package/dist/install-skill.d.ts +0 -35
- package/dist/install-skill.d.ts.map +0 -1
- package/dist/install-skill.js +0 -107
- package/dist/install-skill.js.map +0 -1
- package/dist/platform/index.d.ts +0 -49
- package/dist/platform/index.d.ts.map +0 -1
- package/dist/platform/index.js +0 -38
- package/dist/platform/index.js.map +0 -1
- package/dist/server.d.ts +0 -50
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -153
- package/dist/server.js.map +0 -1
- package/dist/setup-cli.d.ts +0 -100
- package/dist/setup-cli.d.ts.map +0 -1
- package/dist/setup-cli.js +0 -355
- package/dist/setup-cli.js.map +0 -1
- package/dist/setup-prompts.d.ts +0 -41
- package/dist/setup-prompts.d.ts.map +0 -1
- package/dist/setup-prompts.js +0 -142
- package/dist/setup-prompts.js.map +0 -1
- package/dist/setup-token.d.ts +0 -38
- package/dist/setup-token.d.ts.map +0 -1
- package/dist/setup-token.js +0 -106
- package/dist/setup-token.js.map +0 -1
- package/dist/setup-wizard-defaults.d.ts +0 -43
- package/dist/setup-wizard-defaults.d.ts.map +0 -1
- package/dist/setup-wizard-defaults.js +0 -160
- package/dist/setup-wizard-defaults.js.map +0 -1
- package/dist/setup-wizard-handshake.d.ts +0 -25
- package/dist/setup-wizard-handshake.d.ts.map +0 -1
- package/dist/setup-wizard-handshake.js +0 -103
- package/dist/setup-wizard-handshake.js.map +0 -1
- package/dist/setup-wizard-types.d.ts +0 -148
- package/dist/setup-wizard-types.d.ts.map +0 -1
- package/dist/setup-wizard-types.js +0 -11
- package/dist/setup-wizard-types.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -33
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -166
- package/dist/setup-wizard.js.map +0 -1
- package/dist/setup.d.ts +0 -17
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -33
- package/dist/setup.js.map +0 -1
- package/dist/skill-loader.d.ts +0 -51
- package/dist/skill-loader.d.ts.map +0 -1
- package/dist/skill-loader.js +0 -78
- package/dist/skill-loader.js.map +0 -1
- package/dist/tools/elements/builders.d.ts +0 -24
- package/dist/tools/elements/builders.d.ts.map +0 -1
- package/dist/tools/elements/builders.js +0 -177
- package/dist/tools/elements/builders.js.map +0 -1
- package/dist/tools/elements/handlers-write.d.ts +0 -49
- package/dist/tools/elements/handlers-write.d.ts.map +0 -1
- package/dist/tools/elements/handlers-write.js +0 -148
- package/dist/tools/elements/handlers-write.js.map +0 -1
- package/dist/tools/elements/handlers.d.ts +0 -61
- package/dist/tools/elements/handlers.d.ts.map +0 -1
- package/dist/tools/elements/handlers.js +0 -170
- package/dist/tools/elements/handlers.js.map +0 -1
- package/dist/tools/elements/index.d.ts +0 -28
- package/dist/tools/elements/index.d.ts.map +0 -1
- package/dist/tools/elements/index.js +0 -27
- package/dist/tools/elements/index.js.map +0 -1
- package/dist/tools/elements.d.ts +0 -13
- package/dist/tools/elements.d.ts.map +0 -1
- package/dist/tools/elements.js +0 -13
- package/dist/tools/elements.js.map +0 -1
- package/dist/tools/elicitation.d.ts +0 -87
- package/dist/tools/elicitation.d.ts.map +0 -1
- package/dist/tools/elicitation.js +0 -100
- package/dist/tools/elicitation.js.map +0 -1
- package/dist/tools/format/elements-format.d.ts +0 -40
- package/dist/tools/format/elements-format.d.ts.map +0 -1
- package/dist/tools/format/elements-format.js +0 -194
- package/dist/tools/format/elements-format.js.map +0 -1
- package/dist/tools/format/health-format.d.ts +0 -73
- package/dist/tools/format/health-format.d.ts.map +0 -1
- package/dist/tools/format/health-format.js +0 -178
- package/dist/tools/format/health-format.js.map +0 -1
- package/dist/tools/format/inspection-format.d.ts +0 -58
- package/dist/tools/format/inspection-format.d.ts.map +0 -1
- package/dist/tools/format/inspection-format.js +0 -164
- package/dist/tools/format/inspection-format.js.map +0 -1
- package/dist/tools/format/pages-format.d.ts +0 -42
- package/dist/tools/format/pages-format.d.ts.map +0 -1
- package/dist/tools/format/pages-format.js +0 -113
- package/dist/tools/format/pages-format.js.map +0 -1
- package/dist/tools/format/sources-format.d.ts +0 -25
- package/dist/tools/format/sources-format.d.ts.map +0 -1
- package/dist/tools/format/sources-format.js +0 -208
- package/dist/tools/format/sources-format.js.map +0 -1
- package/dist/tools/health.d.ts +0 -22
- package/dist/tools/health.d.ts.map +0 -1
- package/dist/tools/health.js +0 -147
- package/dist/tools/health.js.map +0 -1
- package/dist/tools/index.d.ts +0 -23
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -25
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/inspection.d.ts +0 -14
- package/dist/tools/inspection.d.ts.map +0 -1
- package/dist/tools/inspection.js +0 -125
- package/dist/tools/inspection.js.map +0 -1
- package/dist/tools/layout-flatten.d.ts +0 -75
- package/dist/tools/layout-flatten.d.ts.map +0 -1
- package/dist/tools/layout-flatten.js +0 -107
- package/dist/tools/layout-flatten.js.map +0 -1
- package/dist/tools/multi-items/builders.d.ts +0 -23
- package/dist/tools/multi-items/builders.d.ts.map +0 -1
- package/dist/tools/multi-items/builders.js +0 -56
- package/dist/tools/multi-items/builders.js.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.d.ts +0 -28
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.js +0 -40
- package/dist/tools/multi-items/clean-implode-handler.js.map +0 -1
- package/dist/tools/multi-items/index.d.ts +0 -18
- package/dist/tools/multi-items/index.d.ts.map +0 -1
- package/dist/tools/multi-items/index.js +0 -18
- package/dist/tools/multi-items/index.js.map +0 -1
- package/dist/tools/multi-items/inspect-handler.d.ts +0 -41
- package/dist/tools/multi-items/inspect-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/inspect-handler.js +0 -50
- package/dist/tools/multi-items/inspect-handler.js.map +0 -1
- package/dist/tools/multi-items/item-container-map.d.ts +0 -41
- package/dist/tools/multi-items/item-container-map.d.ts.map +0 -1
- package/dist/tools/multi-items/item-container-map.js +0 -73
- package/dist/tools/multi-items/item-container-map.js.map +0 -1
- package/dist/tools/pages/builders.d.ts +0 -14
- package/dist/tools/pages/builders.d.ts.map +0 -1
- package/dist/tools/pages/builders.js +0 -115
- package/dist/tools/pages/builders.js.map +0 -1
- package/dist/tools/pages/handlers-read.d.ts +0 -33
- package/dist/tools/pages/handlers-read.d.ts.map +0 -1
- package/dist/tools/pages/handlers-read.js +0 -161
- package/dist/tools/pages/handlers-read.js.map +0 -1
- package/dist/tools/pages/handlers-write.d.ts +0 -21
- package/dist/tools/pages/handlers-write.d.ts.map +0 -1
- package/dist/tools/pages/handlers-write.js +0 -52
- package/dist/tools/pages/handlers-write.js.map +0 -1
- package/dist/tools/pages/index.d.ts +0 -17
- package/dist/tools/pages/index.d.ts.map +0 -1
- package/dist/tools/pages/index.js +0 -17
- package/dist/tools/pages/index.js.map +0 -1
- package/dist/tools/pages/schemas.d.ts +0 -30
- package/dist/tools/pages/schemas.d.ts.map +0 -1
- package/dist/tools/pages/schemas.js +0 -30
- package/dist/tools/pages/schemas.js.map +0 -1
- package/dist/tools/pages.d.ts +0 -13
- package/dist/tools/pages.d.ts.map +0 -1
- package/dist/tools/pages.js +0 -13
- package/dist/tools/pages.js.map +0 -1
- package/dist/tools/progress-phases.d.ts +0 -46
- package/dist/tools/progress-phases.d.ts.map +0 -1
- package/dist/tools/progress-phases.js +0 -48
- package/dist/tools/progress-phases.js.map +0 -1
- package/dist/tools/shared-schemas.d.ts +0 -15
- package/dist/tools/shared-schemas.d.ts.map +0 -1
- package/dist/tools/shared-schemas.js +0 -30
- package/dist/tools/shared-schemas.js.map +0 -1
- package/dist/tools/sources/builders.d.ts +0 -13
- package/dist/tools/sources/builders.d.ts.map +0 -1
- package/dist/tools/sources/builders.js +0 -103
- package/dist/tools/sources/builders.js.map +0 -1
- package/dist/tools/sources/handlers-bind.d.ts +0 -28
- package/dist/tools/sources/handlers-bind.d.ts.map +0 -1
- package/dist/tools/sources/handlers-bind.js +0 -129
- package/dist/tools/sources/handlers-bind.js.map +0 -1
- package/dist/tools/sources/handlers.d.ts +0 -45
- package/dist/tools/sources/handlers.d.ts.map +0 -1
- package/dist/tools/sources/handlers.js +0 -91
- package/dist/tools/sources/handlers.js.map +0 -1
- package/dist/tools/sources/index.d.ts +0 -19
- package/dist/tools/sources/index.d.ts.map +0 -1
- package/dist/tools/sources/index.js +0 -18
- package/dist/tools/sources/index.js.map +0 -1
- package/dist/tools/sources.d.ts +0 -14
- package/dist/tools/sources.d.ts.map +0 -1
- package/dist/tools/sources.js +0 -14
- package/dist/tools/sources.js.map +0 -1
- package/dist/tools/sparse-fields.d.ts +0 -80
- package/dist/tools/sparse-fields.d.ts.map +0 -1
- package/dist/tools/sparse-fields.js +0 -144
- package/dist/tools/sparse-fields.js.map +0 -1
- package/dist/tools/tool-builder/annotations.d.ts +0 -55
- package/dist/tools/tool-builder/annotations.d.ts.map +0 -1
- package/dist/tools/tool-builder/annotations.js +0 -86
- package/dist/tools/tool-builder/annotations.js.map +0 -1
- package/dist/tools/tool-builder/define.d.ts +0 -31
- package/dist/tools/tool-builder/define.d.ts.map +0 -1
- package/dist/tools/tool-builder/define.js +0 -31
- package/dist/tools/tool-builder/define.js.map +0 -1
- package/dist/tools/tool-builder/index.d.ts +0 -28
- package/dist/tools/tool-builder/index.d.ts.map +0 -1
- package/dist/tools/tool-builder/index.js +0 -27
- package/dist/tools/tool-builder/index.js.map +0 -1
- package/dist/tools/tool-builder/results.d.ts +0 -59
- package/dist/tools/tool-builder/results.d.ts.map +0 -1
- package/dist/tools/tool-builder/results.js +0 -125
- package/dist/tools/tool-builder/results.js.map +0 -1
- package/dist/tools/tool-builder/types.d.ts +0 -82
- package/dist/tools/tool-builder/types.d.ts.map +0 -1
- package/dist/tools/tool-builder/types.js +0 -9
- package/dist/tools/tool-builder/types.js.map +0 -1
- package/dist/tools/tool-builder.d.ts +0 -16
- package/dist/tools/tool-builder.d.ts.map +0 -1
- package/dist/tools/tool-builder.js +0 -16
- package/dist/tools/tool-builder.js.map +0 -1
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"dxt_version": "0.1",
|
|
3
3
|
"name": "@wootsup/yt-builder-mcp",
|
|
4
4
|
"display_name": "YT Builder MCP for YOOtheme Pro (unofficial)",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.1",
|
|
6
6
|
"description": "Drive your page builder programmatically from Claude, Cursor, Codex, Gemini and 5 other MCP-capable AI assistants — read layouts, edit settings, add elements, bind dynamic sources. Built for YOOtheme Pro 4.0+. Independent third-party project, not affiliated with YOOtheme GmbH.",
|
|
7
7
|
"long_description": "YT Builder MCP gives AI assistants a typed, scoped, and idempotent surface for your YOOtheme Pro page builder. Tools cover page discovery, layout inspection, element CRUD, source binding, and diagnostics. Bearer auth, optimistic locking via ETag, scope hierarchy (read < write < admin), and structured-error responses keep the agent safe and the workflow correct on first try. Independent third-party project — YOOtheme® is a registered trademark of YOOtheme GmbH (yootheme.com); YT Builder MCP is built by WootsUp (getimo productions) and is not affiliated with, endorsed by, or sponsored by YOOtheme.",
|
|
8
8
|
"icon": "icon.png",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wootsup/yt-builder-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "YT Builder MCP — drive your page builder from Claude, Cursor, Codex, Gemini and 5 other MCP-capable AI assistants. Built for YOOtheme Pro 4.0+. Independent third-party project, not affiliated with YOOtheme GmbH.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: yt-builder-mcp
|
|
3
3
|
description: Drive the YOOtheme Pro page builder programmatically — discover pages, inspect layouts, add/move/clone/delete elements, bind dynamic sources, diagnose 401/403 auth failures. Use when the user wants to build, modify, audit, or troubleshoot a YOOtheme-powered WordPress site through the YT Builder MCP server.
|
|
4
4
|
---
|
|
5
5
|
|
package/dist/auth.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth / configuration loading for the MCP server.
|
|
3
|
-
*
|
|
4
|
-
* The MCP server reads two environment variables on startup:
|
|
5
|
-
*
|
|
6
|
-
* YTB_MCP_WP_URL — base URL of the WordPress install, e.g.
|
|
7
|
-
* `https://example.com`. The REST namespace
|
|
8
|
-
* `/wp-json/yt-builder-mcp/v1` is
|
|
9
|
-
* appended internally.
|
|
10
|
-
* YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
|
|
11
|
-
* Settings page (`wp-admin → YT Builder MCP`).
|
|
12
|
-
*
|
|
13
|
-
* `loadConfig()` throws `ConfigError` if either is missing, so the
|
|
14
|
-
* server fails fast with a useful message rather than emitting cryptic
|
|
15
|
-
* 401/Network errors deep in the request stack.
|
|
16
|
-
*
|
|
17
|
-
* @license MIT
|
|
18
|
-
*/
|
|
19
|
-
export interface ServerConfig {
|
|
20
|
-
/** Base URL of the WordPress install (no trailing slash). */
|
|
21
|
-
readonly baseUrl: string;
|
|
22
|
-
/** Bearer key. */
|
|
23
|
-
readonly bearerToken: string;
|
|
24
|
-
/** Network timeout (ms) for REST calls. */
|
|
25
|
-
readonly timeoutMs: number;
|
|
26
|
-
}
|
|
27
|
-
export interface LoadConfigOptions {
|
|
28
|
-
/** Allow the bearer-token to be empty (for health-only smoke tests). */
|
|
29
|
-
readonly allowMissingToken?: boolean;
|
|
30
|
-
/** Source of env vars (defaults to process.env). */
|
|
31
|
-
readonly env?: NodeJS.ProcessEnv;
|
|
32
|
-
}
|
|
33
|
-
export declare const ENV_WP_URL = "YTB_MCP_WP_URL";
|
|
34
|
-
export declare const ENV_BEARER = "YTB_MCP_BEARER_TOKEN";
|
|
35
|
-
export declare const ENV_TIMEOUT = "YTB_MCP_TIMEOUT_MS";
|
|
36
|
-
export declare const ENV_TEST_MODE = "YTB_MCP_TEST_MODE";
|
|
37
|
-
export declare function loadConfig(options?: LoadConfigOptions): ServerConfig;
|
|
38
|
-
export declare function isTestMode(env?: NodeJS.ProcessEnv): boolean;
|
|
39
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,MAAM,WAAW,YAAY;IACzB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAkCjD,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,YAAY,CAiDxE;AAED,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExE"}
|
package/dist/auth.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth / configuration loading for the MCP server.
|
|
3
|
-
*
|
|
4
|
-
* The MCP server reads two environment variables on startup:
|
|
5
|
-
*
|
|
6
|
-
* YTB_MCP_WP_URL — base URL of the WordPress install, e.g.
|
|
7
|
-
* `https://example.com`. The REST namespace
|
|
8
|
-
* `/wp-json/yt-builder-mcp/v1` is
|
|
9
|
-
* appended internally.
|
|
10
|
-
* YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
|
|
11
|
-
* Settings page (`wp-admin → YT Builder MCP`).
|
|
12
|
-
*
|
|
13
|
-
* `loadConfig()` throws `ConfigError` if either is missing, so the
|
|
14
|
-
* server fails fast with a useful message rather than emitting cryptic
|
|
15
|
-
* 401/Network errors deep in the request stack.
|
|
16
|
-
*
|
|
17
|
-
* @license MIT
|
|
18
|
-
*/
|
|
19
|
-
import { z } from 'zod';
|
|
20
|
-
import { ConfigError } from './errors.js';
|
|
21
|
-
export const ENV_WP_URL = 'YTB_MCP_WP_URL';
|
|
22
|
-
export const ENV_BEARER = 'YTB_MCP_BEARER_TOKEN';
|
|
23
|
-
export const ENV_TIMEOUT = 'YTB_MCP_TIMEOUT_MS';
|
|
24
|
-
export const ENV_TEST_MODE = 'YTB_MCP_TEST_MODE';
|
|
25
|
-
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
26
|
-
/**
|
|
27
|
-
* Maximum accepted length for a Bearer token (defense-in-depth bound;
|
|
28
|
-
* the real plugin keys are ~150-300 bytes, the 512 ceiling protects
|
|
29
|
-
* against accidental file-pastes / log dumps / memory abuse).
|
|
30
|
-
*/
|
|
31
|
-
const BEARER_MAX_LEN = 512;
|
|
32
|
-
/**
|
|
33
|
-
* Bearer-token format check — matches the plugin's `KeyService.php`
|
|
34
|
-
* `PREFIX = ytb_live_` (and the planned `ytb_test_` future variant).
|
|
35
|
-
* Token shape: `ytb_(live|test)_<payloadB64Url>.<sigB64Url>` where
|
|
36
|
-
* base64url uses `[A-Za-z0-9_-]` (no dots inside the payload or sig).
|
|
37
|
-
*
|
|
38
|
-
* Round-1 audit I7 fix (2026-05-22): the earlier `.trim()` + empty-check
|
|
39
|
-
* was not enough to catch the most common config mistakes — the leading
|
|
40
|
-
* `Bearer ` prefix accidentally pasted into the env var, copy-paste
|
|
41
|
-
* truncation (no `.` separator), or a totally wrong token style. We
|
|
42
|
-
* fail-fast here so the client never sends a known-bad value upstream.
|
|
43
|
-
*/
|
|
44
|
-
const BEARER_FORMAT_SCHEMA = z
|
|
45
|
-
.string()
|
|
46
|
-
.max(BEARER_MAX_LEN, `Bearer too long (max ${String(BEARER_MAX_LEN)} chars). The env var YTB_MCP_BEARER_TOKEN seems to contain something other than a plain key — strip leading "Bearer " or paste only the key copied from wp-admin → "YT Builder MCP" → Settings.`)
|
|
47
|
-
.regex(/^ytb_(live|test)_[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/, 'Bearer must match ytb_(live|test)_<payloadB64Url>.<sigB64Url> format (copy the key as shown in wp-admin → "YT Builder MCP" → Settings; do NOT prepend "Bearer ").');
|
|
48
|
-
export function loadConfig(options = {}) {
|
|
49
|
-
const env = options.env ?? process.env;
|
|
50
|
-
const rawUrl = (env[ENV_WP_URL] ?? '').trim();
|
|
51
|
-
const rawToken = (env[ENV_BEARER] ?? '').trim();
|
|
52
|
-
const rawTimeout = (env[ENV_TIMEOUT] ?? '').trim();
|
|
53
|
-
if (rawUrl === '') {
|
|
54
|
-
throw new ConfigError(`Missing ${ENV_WP_URL}. Set it to your WordPress base URL ` +
|
|
55
|
-
'(e.g. https://example.com). Run `yt-builder-mcp setup` to configure.');
|
|
56
|
-
}
|
|
57
|
-
if (!options.allowMissingToken && rawToken === '') {
|
|
58
|
-
throw new ConfigError(`Missing ${ENV_BEARER}. Generate a Bearer key in wp-admin → "YT Builder MCP" → ` +
|
|
59
|
-
'Settings, then run `yt-builder-mcp setup`.');
|
|
60
|
-
}
|
|
61
|
-
// I7-fix: enforce the Bearer-format contract before the client
|
|
62
|
-
// makes any request. Empty token is allowed only via
|
|
63
|
-
// `allowMissingToken` (the health-only smoke path); any other
|
|
64
|
-
// non-empty value MUST match the plugin's KeyService format.
|
|
65
|
-
if (rawToken !== '') {
|
|
66
|
-
const parsed = BEARER_FORMAT_SCHEMA.safeParse(rawToken);
|
|
67
|
-
if (!parsed.success) {
|
|
68
|
-
const issueMsg = parsed.error.issues
|
|
69
|
-
.map((iss) => iss.message)
|
|
70
|
-
.join(' ');
|
|
71
|
-
throw new ConfigError(`Invalid ${ENV_BEARER}: ${issueMsg}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
let timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
75
|
-
if (rawTimeout !== '') {
|
|
76
|
-
const parsed = Number.parseInt(rawTimeout, 10);
|
|
77
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
78
|
-
timeoutMs = parsed;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
baseUrl: stripTrailingSlash(rawUrl),
|
|
83
|
-
bearerToken: rawToken,
|
|
84
|
-
timeoutMs,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export function isTestMode(env = process.env) {
|
|
88
|
-
return (env[ENV_TEST_MODE] ?? '') === '1';
|
|
89
|
-
}
|
|
90
|
-
function stripTrailingSlash(url) {
|
|
91
|
-
return url.replace(/\/+$/, '');
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkB1C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAEjD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,oBAAoB,GAAG,CAAC;KACzB,MAAM,EAAE;KACR,GAAG,CACA,cAAc,EACd,wBAAwB,MAAM,CAAC,cAAc,CAAC,iMAAiM,CAClP;KACA,KAAK,CACF,kDAAkD,EAClD,mKAAmK,CACtK,CAAC;AAEN,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACtD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACvC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,CAAC,GAAG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C;IAED,OAAO;QACH,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC;QACnC,WAAW,EAAE,QAAQ;QACrB,SAAS;KACZ,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC3D,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC;AAC9C,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/client.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `RestClient` — thin wrapper around `fetch` that targets the
|
|
3
|
-
* `yt-builder-mcp/v1` REST namespace.
|
|
4
|
-
*
|
|
5
|
-
* Responsibilities:
|
|
6
|
-
* - Compose final URLs (`{baseUrl}/wp-json/yt-builder-mcp/v1{path}`)
|
|
7
|
-
* - Attach `Authorization: Bearer …`
|
|
8
|
-
* - Encode JSON bodies + propagate `If-Match` etag headers
|
|
9
|
-
* - Map non-2xx into `RestError` with status / `code` / message
|
|
10
|
-
* - Map network failures into `NetworkError`
|
|
11
|
-
*
|
|
12
|
-
* The client deliberately keeps zero state beyond constructor config
|
|
13
|
-
* so each tool can hold a reference and call `.get/.post/.put/.delete`
|
|
14
|
-
* without coordinating sessions.
|
|
15
|
-
*
|
|
16
|
-
* @license MIT
|
|
17
|
-
*/
|
|
18
|
-
import type { Platform } from './platform/index.js';
|
|
19
|
-
/**
|
|
20
|
-
* Canonical WordPress REST-namespace path. Re-exported for backward
|
|
21
|
-
* compat — new code should reach for `Platform.restNamespacePath`.
|
|
22
|
-
*/
|
|
23
|
-
export declare const REST_NAMESPACE_PATH = "/wp-json/yt-builder-mcp/v1";
|
|
24
|
-
/**
|
|
25
|
-
* Legacy single-platform options shape. Kept so existing call-sites
|
|
26
|
-
* continue working without touching every entry point.
|
|
27
|
-
*/
|
|
28
|
-
export interface LegacyRestClientOptions {
|
|
29
|
-
readonly baseUrl: string;
|
|
30
|
-
readonly bearerToken: string;
|
|
31
|
-
readonly timeoutMs?: number;
|
|
32
|
-
/** Injected for tests. Defaults to `globalThis.fetch`. */
|
|
33
|
-
readonly fetch?: typeof fetch;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Platform-aware options shape (Wave G.0+).
|
|
37
|
-
* Pass an instance of `WordPressPlatform` (or any future `Platform`)
|
|
38
|
-
* instead of a bare `baseUrl`.
|
|
39
|
-
*/
|
|
40
|
-
export interface PlatformRestClientOptions {
|
|
41
|
-
readonly platform: Platform;
|
|
42
|
-
readonly bearerToken: string;
|
|
43
|
-
readonly timeoutMs?: number;
|
|
44
|
-
/** Injected for tests. Defaults to `globalThis.fetch`. */
|
|
45
|
-
readonly fetch?: typeof fetch;
|
|
46
|
-
}
|
|
47
|
-
/** Discriminated union: callers pick whichever shape suits them. */
|
|
48
|
-
export type RestClientOptions = LegacyRestClientOptions | PlatformRestClientOptions;
|
|
49
|
-
export interface RequestOptions {
|
|
50
|
-
/** Optional ETag for optimistic-lock (`If-Match` header). */
|
|
51
|
-
readonly etag?: string;
|
|
52
|
-
/** JSON body. */
|
|
53
|
-
readonly body?: unknown;
|
|
54
|
-
/** Extra headers. */
|
|
55
|
-
readonly headers?: Record<string, string>;
|
|
56
|
-
/** Optional AbortSignal. */
|
|
57
|
-
readonly signal?: AbortSignal;
|
|
58
|
-
}
|
|
59
|
-
export declare class RestClient {
|
|
60
|
-
private readonly platform;
|
|
61
|
-
private readonly baseUrl;
|
|
62
|
-
private readonly bearerToken;
|
|
63
|
-
private readonly timeoutMs;
|
|
64
|
-
private readonly fetchImpl;
|
|
65
|
-
constructor(options: RestClientOptions);
|
|
66
|
-
/** Expose the underlying platform (used by tools that need restNamespacePath/kind). */
|
|
67
|
-
getPlatform(): Platform;
|
|
68
|
-
get<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
|
|
69
|
-
post<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
|
|
70
|
-
put<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
|
|
71
|
-
delete<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
|
|
72
|
-
request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
73
|
-
private buildUrl;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* URL-encode a JSON-Pointer-style element path for use in the route.
|
|
77
|
-
*
|
|
78
|
-
* The plugin's regex captures everything after `/elements/`, so the
|
|
79
|
-
* raw `/grid/1/columns/0` path can be passed as-is — but each segment
|
|
80
|
-
* must be percent-encoded so reserved chars like `~` (used in
|
|
81
|
-
* JSON-Pointer escapes) don't collide with WordPress' router.
|
|
82
|
-
*/
|
|
83
|
-
export declare function encodeElementPath(pointer: string): string;
|
|
84
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+BAAgC,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC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MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrE,OAAO,CAAC,CAAC,GAAG,OAAO,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,CAAC,CAAC;IAgDb,OAAO,CAAC,QAAQ;CAInB;AAgCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
package/dist/client.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `RestClient` — thin wrapper around `fetch` that targets the
|
|
3
|
-
* `yt-builder-mcp/v1` REST namespace.
|
|
4
|
-
*
|
|
5
|
-
* Responsibilities:
|
|
6
|
-
* - Compose final URLs (`{baseUrl}/wp-json/yt-builder-mcp/v1{path}`)
|
|
7
|
-
* - Attach `Authorization: Bearer …`
|
|
8
|
-
* - Encode JSON bodies + propagate `If-Match` etag headers
|
|
9
|
-
* - Map non-2xx into `RestError` with status / `code` / message
|
|
10
|
-
* - Map network failures into `NetworkError`
|
|
11
|
-
*
|
|
12
|
-
* The client deliberately keeps zero state beyond constructor config
|
|
13
|
-
* so each tool can hold a reference and call `.get/.post/.put/.delete`
|
|
14
|
-
* without coordinating sessions.
|
|
15
|
-
*
|
|
16
|
-
* @license MIT
|
|
17
|
-
*/
|
|
18
|
-
import { NetworkError, RestError } from './errors.js';
|
|
19
|
-
import { WordPressPlatform, WORDPRESS_REST_NAMESPACE_PATH } from './platform/index.js';
|
|
20
|
-
/**
|
|
21
|
-
* Canonical WordPress REST-namespace path. Re-exported for backward
|
|
22
|
-
* compat — new code should reach for `Platform.restNamespacePath`.
|
|
23
|
-
*/
|
|
24
|
-
export const REST_NAMESPACE_PATH = WORDPRESS_REST_NAMESPACE_PATH;
|
|
25
|
-
export class RestClient {
|
|
26
|
-
platform;
|
|
27
|
-
baseUrl;
|
|
28
|
-
bearerToken;
|
|
29
|
-
timeoutMs;
|
|
30
|
-
fetchImpl;
|
|
31
|
-
constructor(options) {
|
|
32
|
-
// Dual-form: accept either a `Platform` or a legacy `baseUrl`.
|
|
33
|
-
const platform = isPlatformOptions(options)
|
|
34
|
-
? options.platform
|
|
35
|
-
: new WordPressPlatform(options.baseUrl);
|
|
36
|
-
this.platform = platform;
|
|
37
|
-
this.baseUrl = platform.baseUrl.replace(/\/+$/, '');
|
|
38
|
-
this.bearerToken = options.bearerToken;
|
|
39
|
-
this.timeoutMs = options.timeoutMs ?? 15_000;
|
|
40
|
-
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
41
|
-
}
|
|
42
|
-
/** Expose the underlying platform (used by tools that need restNamespacePath/kind). */
|
|
43
|
-
getPlatform() {
|
|
44
|
-
return this.platform;
|
|
45
|
-
}
|
|
46
|
-
get(path, options = {}) {
|
|
47
|
-
return this.request('GET', path, options);
|
|
48
|
-
}
|
|
49
|
-
post(path, options = {}) {
|
|
50
|
-
return this.request('POST', path, options);
|
|
51
|
-
}
|
|
52
|
-
put(path, options = {}) {
|
|
53
|
-
return this.request('PUT', path, options);
|
|
54
|
-
}
|
|
55
|
-
delete(path, options = {}) {
|
|
56
|
-
return this.request('DELETE', path, options);
|
|
57
|
-
}
|
|
58
|
-
async request(method, path, options = {}) {
|
|
59
|
-
const url = this.buildUrl(path);
|
|
60
|
-
const headers = {
|
|
61
|
-
Authorization: `Bearer ${this.bearerToken}`,
|
|
62
|
-
Accept: 'application/json',
|
|
63
|
-
...(options.headers ?? {}),
|
|
64
|
-
};
|
|
65
|
-
if (options.etag !== undefined && options.etag !== '') {
|
|
66
|
-
headers['If-Match'] = options.etag;
|
|
67
|
-
}
|
|
68
|
-
const init = { method, headers };
|
|
69
|
-
if (options.body !== undefined) {
|
|
70
|
-
headers['Content-Type'] = 'application/json';
|
|
71
|
-
init.body = JSON.stringify(options.body);
|
|
72
|
-
}
|
|
73
|
-
const controller = new AbortController();
|
|
74
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
75
|
-
if (options.signal !== undefined) {
|
|
76
|
-
options.signal.addEventListener('abort', () => controller.abort());
|
|
77
|
-
}
|
|
78
|
-
init.signal = controller.signal;
|
|
79
|
-
let response;
|
|
80
|
-
try {
|
|
81
|
-
response = await this.fetchImpl(url, init);
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
throw new NetworkError({ cause: e, url });
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
clearTimeout(timeoutId);
|
|
88
|
-
}
|
|
89
|
-
const text = await response.text();
|
|
90
|
-
const parsed = parseJsonSafe(text);
|
|
91
|
-
if (!response.ok) {
|
|
92
|
-
throw new RestError({
|
|
93
|
-
status: response.status,
|
|
94
|
-
code: extractErrorCode(parsed),
|
|
95
|
-
message: extractErrorMessage(parsed, response.statusText),
|
|
96
|
-
body: parsed,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return parsed;
|
|
100
|
-
}
|
|
101
|
-
buildUrl(path) {
|
|
102
|
-
const normalized = path.startsWith('/') ? path : `/${path}`;
|
|
103
|
-
return `${this.baseUrl}${this.platform.restNamespacePath}${normalized}`;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/** Type guard — discriminate between the two RestClientOptions shapes. */
|
|
107
|
-
function isPlatformOptions(opts) {
|
|
108
|
-
return 'platform' in opts && opts.platform !== undefined;
|
|
109
|
-
}
|
|
110
|
-
function parseJsonSafe(text) {
|
|
111
|
-
if (text.trim() === '')
|
|
112
|
-
return null;
|
|
113
|
-
try {
|
|
114
|
-
return JSON.parse(text);
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
return text;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function extractErrorCode(body) {
|
|
121
|
-
if (body !== null && typeof body === 'object' && 'code' in body) {
|
|
122
|
-
const code = body.code;
|
|
123
|
-
if (typeof code === 'string')
|
|
124
|
-
return code;
|
|
125
|
-
}
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
function extractErrorMessage(body, fallback) {
|
|
129
|
-
if (body !== null && typeof body === 'object' && 'message' in body) {
|
|
130
|
-
const msg = body.message;
|
|
131
|
-
if (typeof msg === 'string' && msg !== '')
|
|
132
|
-
return msg;
|
|
133
|
-
}
|
|
134
|
-
return fallback !== '' ? fallback : 'Unknown REST error';
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* URL-encode a JSON-Pointer-style element path for use in the route.
|
|
138
|
-
*
|
|
139
|
-
* The plugin's regex captures everything after `/elements/`, so the
|
|
140
|
-
* raw `/grid/1/columns/0` path can be passed as-is — but each segment
|
|
141
|
-
* must be percent-encoded so reserved chars like `~` (used in
|
|
142
|
-
* JSON-Pointer escapes) don't collide with WordPress' router.
|
|
143
|
-
*/
|
|
144
|
-
export function encodeElementPath(pointer) {
|
|
145
|
-
if (pointer === '' || pointer === '/')
|
|
146
|
-
return '';
|
|
147
|
-
// Strip leading slash, split, encode each segment, rejoin.
|
|
148
|
-
const segments = pointer.replace(/^\//, '').split('/');
|
|
149
|
-
return segments.map(encodeURIComponent).join('/');
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAyCjE,MAAM,OAAO,UAAU;IACF,QAAQ,CAAW;IACnB,OAAO,CAAS;IAChB,WAAW,CAAS;IACpB,SAAS,CAAS;IAClB,SAA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
-
* Schema mirrors Claude Desktop's `mcpServers` map:
|
|
7
|
-
*
|
|
8
|
-
* {
|
|
9
|
-
* "mcpServers": {
|
|
10
|
-
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
11
|
-
* }
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* @license MIT
|
|
15
|
-
*/
|
|
16
|
-
import { type ClientWriter } from './index.js';
|
|
17
|
-
export declare const claudeCodeClient: ClientWriter;
|
|
18
|
-
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/clients/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAgBpF,eAAO,MAAM,gBAAgB,EAAE,YAqB9B,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code (Anthropic CLI) config writer.
|
|
3
|
-
*
|
|
4
|
-
* All platforms: ~/.claude.json (single file)
|
|
5
|
-
*
|
|
6
|
-
* Schema mirrors Claude Desktop's `mcpServers` map:
|
|
7
|
-
*
|
|
8
|
-
* {
|
|
9
|
-
* "mcpServers": {
|
|
10
|
-
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
11
|
-
* }
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* @license MIT
|
|
15
|
-
*/
|
|
16
|
-
import { existsSync } from 'node:fs';
|
|
17
|
-
import { join } from 'node:path';
|
|
18
|
-
import { userHome } from './home.js';
|
|
19
|
-
import { patchJsonFile } from './index.js';
|
|
20
|
-
function configPath() {
|
|
21
|
-
return join(userHome(), '.claude.json');
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Detection: either the user-config file already exists, or the
|
|
25
|
-
* `~/.claude/` directory does (Claude Code creates it on first run
|
|
26
|
-
* for skills, transcripts, etc., even before the JSON file lands).
|
|
27
|
-
*/
|
|
28
|
-
function isDetected() {
|
|
29
|
-
const home = userHome();
|
|
30
|
-
return existsSync(join(home, '.claude.json')) || existsSync(join(home, '.claude'));
|
|
31
|
-
}
|
|
32
|
-
export const claudeCodeClient = {
|
|
33
|
-
id: 'claude-code',
|
|
34
|
-
label: 'Claude Code',
|
|
35
|
-
configPath,
|
|
36
|
-
isDetected,
|
|
37
|
-
apply: async (serverName, config) => {
|
|
38
|
-
await patchJsonFile(configPath(), (current) => {
|
|
39
|
-
const servers = current.mcpServers !== null &&
|
|
40
|
-
typeof current.mcpServers === 'object' &&
|
|
41
|
-
!Array.isArray(current.mcpServers)
|
|
42
|
-
? { ...current.mcpServers }
|
|
43
|
-
: {};
|
|
44
|
-
servers[serverName] = {
|
|
45
|
-
command: config.command,
|
|
46
|
-
args: config.args,
|
|
47
|
-
env: config.env,
|
|
48
|
-
};
|
|
49
|
-
return { ...current, mcpServers: servers };
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=claude-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/clients/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU;IACf,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC1C,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,aAAa;IACpB,UAAU;IACV,UAAU;IACV,KAAK,EAAE,KAAK,EAAE,UAAkB,EAAE,MAAuB,EAAE,EAAE;QACzD,MAAM,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,OAAO,GACT,OAAO,CAAC,UAAU,KAAK,IAAI;gBAC3B,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;gBACtC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC9B,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,UAAsC,EAAE;gBACxD,CAAC,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,UAAU,CAAC,GAAG;gBAClB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;YACF,OAAO,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Desktop config writer.
|
|
3
|
-
*
|
|
4
|
-
* macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
5
|
-
* Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
6
|
-
* Linux: ~/.config/Claude/claude_desktop_config.json (unofficial)
|
|
7
|
-
*
|
|
8
|
-
* Schema:
|
|
9
|
-
* {
|
|
10
|
-
* "mcpServers": {
|
|
11
|
-
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/
|
|
17
|
-
import { type ClientWriter } from './index.js';
|
|
18
|
-
export declare const claudeDesktopClient: ClientWriter;
|
|
19
|
-
//# sourceMappingURL=claude-desktop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-desktop.d.ts","sourceRoot":"","sources":["../../src/clients/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAgBpF,eAAO,MAAM,mBAAmB,EAAE,YAqBjC,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Desktop config writer.
|
|
3
|
-
*
|
|
4
|
-
* macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
5
|
-
* Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
6
|
-
* Linux: ~/.config/Claude/claude_desktop_config.json (unofficial)
|
|
7
|
-
*
|
|
8
|
-
* Schema:
|
|
9
|
-
* {
|
|
10
|
-
* "mcpServers": {
|
|
11
|
-
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/
|
|
17
|
-
import { existsSync } from 'node:fs';
|
|
18
|
-
import { platform } from 'node:os';
|
|
19
|
-
import { join } from 'node:path';
|
|
20
|
-
import { userHome } from './home.js';
|
|
21
|
-
import { patchJsonFile } from './index.js';
|
|
22
|
-
function configPath() {
|
|
23
|
-
const home = userHome();
|
|
24
|
-
switch (platform()) {
|
|
25
|
-
case 'darwin':
|
|
26
|
-
return join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
27
|
-
case 'win32': {
|
|
28
|
-
const appData = process.env.APPDATA ?? join(home, 'AppData', 'Roaming');
|
|
29
|
-
return join(appData, 'Claude', 'claude_desktop_config.json');
|
|
30
|
-
}
|
|
31
|
-
default:
|
|
32
|
-
return join(home, '.config', 'Claude', 'claude_desktop_config.json');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export const claudeDesktopClient = {
|
|
36
|
-
id: 'claude-desktop',
|
|
37
|
-
label: 'Claude Desktop',
|
|
38
|
-
configPath,
|
|
39
|
-
isDetected: () => existsSync(configPath()),
|
|
40
|
-
apply: async (serverName, config) => {
|
|
41
|
-
await patchJsonFile(configPath(), (current) => {
|
|
42
|
-
const servers = current.mcpServers !== null &&
|
|
43
|
-
typeof current.mcpServers === 'object' &&
|
|
44
|
-
!Array.isArray(current.mcpServers)
|
|
45
|
-
? { ...current.mcpServers }
|
|
46
|
-
: {};
|
|
47
|
-
servers[serverName] = {
|
|
48
|
-
command: config.command,
|
|
49
|
-
args: config.args,
|
|
50
|
-
env: config.env,
|
|
51
|
-
};
|
|
52
|
-
return { ...current, mcpServers: servers };
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=claude-desktop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-desktop.js","sourceRoot":"","sources":["../../src/clients/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,QAAQ,QAAQ,EAAE,EAAE,CAAC;QACjB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,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ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline MCP config writer.
|
|
3
|
-
*
|
|
4
|
-
* Cline ships as the VS Code extension `saoudrizwan.claude-dev`. Per
|
|
5
|
-
* Cline's docs (`docs.cline.bot` "MCP / Configuration"), the per-user
|
|
6
|
-
* MCP server registry lives at
|
|
7
|
-
* `<vsCodeUserDir>/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
8
|
-
*
|
|
9
|
-
* VS Code's `<vsCodeUserDir>` is:
|
|
10
|
-
* macOS: ~/Library/Application Support/Code/User
|
|
11
|
-
* Linux: ~/.config/Code/User
|
|
12
|
-
* Windows: %APPDATA%\Code\User
|
|
13
|
-
*
|
|
14
|
-
* Schema mirrors Claude Desktop's `mcpServers` map:
|
|
15
|
-
*
|
|
16
|
-
* {
|
|
17
|
-
* "mcpServers": {
|
|
18
|
-
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* @license MIT
|
|
23
|
-
*/
|
|
24
|
-
import { type ClientWriter } from './index.js';
|
|
25
|
-
export declare const clineClient: ClientWriter;
|
|
26
|
-
//# sourceMappingURL=cline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../src/clients/cline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AA0CpF,eAAO,MAAM,WAAW,EAAE,YAqBzB,CAAC"}
|