@wootsup/mcp 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +157 -83
- package/README.md +31 -27
- package/SECURITY.md +15 -6
- package/dist/auth/keychain.d.ts +27 -1
- package/dist/auth/keychain.js +48 -2
- package/dist/auth/keychain.js.map +1 -1
- package/dist/catalog/build-catalog.d.ts +31 -0
- package/dist/catalog/build-catalog.js +68 -0
- package/dist/catalog/build-catalog.js.map +1 -0
- package/dist/cli-hint.d.ts +22 -0
- package/dist/cli-hint.js +55 -0
- package/dist/cli-hint.js.map +1 -0
- package/dist/index.js +129 -22
- package/dist/index.js.map +1 -1
- package/dist/install-skill.js +1 -1
- package/dist/modules/apimapper/auto-layout.d.ts +21 -0
- package/dist/modules/apimapper/auto-layout.js +54 -0
- package/dist/modules/apimapper/auto-layout.js.map +1 -0
- package/dist/modules/apimapper/cache.js +25 -17
- package/dist/modules/apimapper/cache.js.map +1 -1
- package/dist/modules/apimapper/client.d.ts +115 -4
- package/dist/modules/apimapper/client.js +699 -304
- package/dist/modules/apimapper/client.js.map +1 -1
- package/dist/modules/apimapper/connections-format.d.ts +31 -1
- package/dist/modules/apimapper/connections-format.js +97 -5
- package/dist/modules/apimapper/connections-format.js.map +1 -1
- package/dist/modules/apimapper/connections.d.ts +9 -7
- package/dist/modules/apimapper/connections.js +449 -127
- package/dist/modules/apimapper/connections.js.map +1 -1
- package/dist/modules/apimapper/credential-sanitizer.d.ts +5 -0
- package/dist/modules/apimapper/credential-sanitizer.js +60 -1
- package/dist/modules/apimapper/credential-sanitizer.js.map +1 -1
- package/dist/modules/apimapper/credentials.js +105 -61
- package/dist/modules/apimapper/credentials.js.map +1 -1
- package/dist/modules/apimapper/diagnose.js +21 -2
- package/dist/modules/apimapper/diagnose.js.map +1 -1
- package/dist/modules/apimapper/elicitation.d.ts +29 -0
- package/dist/modules/apimapper/elicitation.js +62 -0
- package/dist/modules/apimapper/elicitation.js.map +1 -1
- package/dist/modules/apimapper/example-extract.d.ts +13 -0
- package/dist/modules/apimapper/example-extract.js +111 -0
- package/dist/modules/apimapper/example-extract.js.map +1 -0
- package/dist/modules/apimapper/filter-operators.d.ts +24 -0
- package/dist/modules/apimapper/filter-operators.js +103 -0
- package/dist/modules/apimapper/filter-operators.js.map +1 -0
- package/dist/modules/apimapper/flows-format.js +92 -22
- package/dist/modules/apimapper/flows-format.js.map +1 -1
- package/dist/modules/apimapper/flows.d.ts +8 -7
- package/dist/modules/apimapper/flows.js +275 -120
- package/dist/modules/apimapper/flows.js.map +1 -1
- package/dist/modules/apimapper/gateway/advanced-read-tool.d.ts +9 -0
- package/dist/modules/apimapper/gateway/advanced-read-tool.js +172 -0
- package/dist/modules/apimapper/gateway/advanced-read-tool.js.map +1 -0
- package/dist/modules/apimapper/gateway/advanced-tool.js +66 -106
- package/dist/modules/apimapper/gateway/advanced-tool.js.map +1 -1
- package/dist/modules/apimapper/gateway/collect-module-tools.d.ts +17 -0
- package/dist/modules/apimapper/gateway/collect-module-tools.js +44 -0
- package/dist/modules/apimapper/gateway/collect-module-tools.js.map +1 -0
- package/dist/modules/apimapper/gateway/essentials.d.ts +1 -1
- package/dist/modules/apimapper/gateway/essentials.js +21 -2
- package/dist/modules/apimapper/gateway/essentials.js.map +1 -1
- package/dist/modules/apimapper/gateway/gateway-shared.d.ts +21 -0
- package/dist/modules/apimapper/gateway/gateway-shared.js +124 -0
- package/dist/modules/apimapper/gateway/gateway-shared.js.map +1 -0
- package/dist/modules/apimapper/gateway/test-support.d.ts +1 -17
- package/dist/modules/apimapper/gateway/test-support.js +4 -33
- package/dist/modules/apimapper/gateway/test-support.js.map +1 -1
- package/dist/modules/apimapper/get-skill-cores.d.ts +4 -0
- package/dist/modules/apimapper/get-skill-cores.js +220 -0
- package/dist/modules/apimapper/get-skill-cores.js.map +1 -0
- package/dist/modules/apimapper/get-skill.d.ts +1 -1
- package/dist/modules/apimapper/get-skill.js +74 -9
- package/dist/modules/apimapper/get-skill.js.map +1 -1
- package/dist/modules/apimapper/graph-builder.d.ts +85 -2
- package/dist/modules/apimapper/graph-builder.js +151 -15
- package/dist/modules/apimapper/graph-builder.js.map +1 -1
- package/dist/modules/apimapper/graph.js +152 -48
- package/dist/modules/apimapper/graph.js.map +1 -1
- package/dist/modules/apimapper/index.js +27 -13
- package/dist/modules/apimapper/index.js.map +1 -1
- package/dist/modules/apimapper/jmespath-test.d.ts +4 -0
- package/dist/modules/apimapper/jmespath-test.js +152 -0
- package/dist/modules/apimapper/jmespath-test.js.map +1 -0
- package/dist/modules/apimapper/library.js +553 -88
- package/dist/modules/apimapper/library.js.map +1 -1
- package/dist/modules/apimapper/license.js +12 -36
- package/dist/modules/apimapper/license.js.map +1 -1
- package/dist/modules/apimapper/list-footer.d.ts +27 -0
- package/dist/modules/apimapper/list-footer.js +57 -0
- package/dist/modules/apimapper/list-footer.js.map +1 -0
- package/dist/modules/apimapper/local-sources.js +100 -57
- package/dist/modules/apimapper/local-sources.js.map +1 -1
- package/dist/modules/apimapper/mcp-client-identity.d.ts +32 -0
- package/dist/modules/apimapper/mcp-client-identity.js +70 -0
- package/dist/modules/apimapper/mcp-client-identity.js.map +1 -0
- package/dist/modules/apimapper/merge-constants.d.ts +6 -0
- package/dist/modules/apimapper/merge-constants.js +26 -0
- package/dist/modules/apimapper/merge-constants.js.map +1 -0
- package/dist/modules/apimapper/misc.js +13 -27
- package/dist/modules/apimapper/misc.js.map +1 -1
- package/dist/modules/apimapper/node-schema.d.ts +52 -2
- package/dist/modules/apimapper/node-schema.js +95 -4
- package/dist/modules/apimapper/node-schema.js.map +1 -1
- package/dist/modules/apimapper/onboarding.d.ts +59 -1
- package/dist/modules/apimapper/onboarding.js +231 -28
- package/dist/modules/apimapper/onboarding.js.map +1 -1
- package/dist/modules/apimapper/read-cache.d.ts +16 -3
- package/dist/modules/apimapper/read-cache.js +59 -4
- package/dist/modules/apimapper/read-cache.js.map +1 -1
- package/dist/modules/apimapper/render/index.js +26 -5
- package/dist/modules/apimapper/render/index.js.map +1 -1
- package/dist/modules/apimapper/resource-id.d.ts +13 -0
- package/dist/modules/apimapper/resource-id.js +69 -0
- package/dist/modules/apimapper/resource-id.js.map +1 -0
- package/dist/modules/apimapper/schema.js +9 -18
- package/dist/modules/apimapper/schema.js.map +1 -1
- package/dist/modules/apimapper/settings.js +49 -52
- package/dist/modules/apimapper/settings.js.map +1 -1
- package/dist/modules/apimapper/sites-tools.d.ts +29 -0
- package/dist/modules/apimapper/sites-tools.js +165 -0
- package/dist/modules/apimapper/sites-tools.js.map +1 -0
- package/dist/modules/apimapper/tool-result.d.ts +66 -0
- package/dist/modules/apimapper/tool-result.js +125 -0
- package/dist/modules/apimapper/tool-result.js.map +1 -0
- package/dist/modules/apimapper/toolslist-size.d.ts +12 -11
- package/dist/modules/apimapper/toolslist-size.js +34 -21
- package/dist/modules/apimapper/toolslist-size.js.map +1 -1
- package/dist/modules/apimapper/types.d.ts +34 -0
- package/dist/modules/apimapper/types.js +1 -1
- package/dist/modules/apimapper/types.js.map +1 -1
- package/dist/modules/apimapper/whitelist-drift.d.ts +85 -0
- package/dist/modules/apimapper/whitelist-drift.js +375 -0
- package/dist/modules/apimapper/whitelist-drift.js.map +1 -0
- package/dist/modules/apimapper/workflows.js +302 -58
- package/dist/modules/apimapper/workflows.js.map +1 -1
- package/dist/modules/apimapper/yootheme-binding.d.ts +35 -0
- package/dist/modules/apimapper/yootheme-binding.js +267 -0
- package/dist/modules/apimapper/yootheme-binding.js.map +1 -0
- package/dist/platform/index.d.ts +56 -0
- package/dist/platform/index.js +158 -2
- package/dist/platform/index.js.map +1 -1
- package/dist/proxy/bridge.d.ts +35 -0
- package/dist/proxy/bridge.js +129 -0
- package/dist/proxy/bridge.js.map +1 -0
- package/dist/proxy/mode.d.ts +9 -0
- package/dist/proxy/mode.js +20 -0
- package/dist/proxy/mode.js.map +1 -0
- package/dist/setup/detect-clients.d.ts +40 -1
- package/dist/setup/detect-clients.js +148 -1
- package/dist/setup/detect-clients.js.map +1 -1
- package/dist/setup/probe-auth.d.ts +51 -0
- package/dist/setup/probe-auth.js +141 -0
- package/dist/setup/probe-auth.js.map +1 -0
- package/dist/setup/probe-handshake.js +40 -7
- package/dist/setup/probe-handshake.js.map +1 -1
- package/dist/setup/remove-config.d.ts +8 -0
- package/dist/setup/remove-config.js +145 -0
- package/dist/setup/remove-config.js.map +1 -0
- package/dist/setup/uninstall.d.ts +34 -0
- package/dist/setup/uninstall.js +147 -0
- package/dist/setup/uninstall.js.map +1 -0
- package/dist/setup-cli.d.ts +16 -0
- package/dist/setup-cli.js +63 -1
- package/dist/setup-cli.js.map +1 -1
- package/dist/sites/loader.d.ts +48 -0
- package/dist/sites/loader.js +134 -0
- package/dist/sites/loader.js.map +1 -0
- package/dist/sites/schema.d.ts +69 -0
- package/dist/sites/schema.js +71 -0
- package/dist/sites/schema.js.map +1 -0
- package/dist/sites/secret-resolver.d.ts +47 -0
- package/dist/sites/secret-resolver.js +150 -0
- package/dist/sites/secret-resolver.js.map +1 -0
- package/dist/skill-instructions.d.ts +14 -1
- package/dist/skill-instructions.js +35 -6
- package/dist/skill-instructions.js.map +1 -1
- package/dist/transports/stdio.js +4 -4
- package/dist/transports/stdio.js.map +1 -1
- package/dist/uninstall-skill.d.ts +27 -0
- package/dist/uninstall-skill.js +89 -0
- package/dist/uninstall-skill.js.map +1 -0
- package/docs/architecture.md +21 -21
- package/docs/customgraph-internal-migration.md +4 -4
- package/docs/security.md +2 -21
- package/docs/tools.md +40 -12
- package/manifest.json +77 -79
- package/package.json +69 -65
- package/skills/apimapper/SKILL.md +128 -7
- package/skills/apimapper/reference/conditional-style-multi-items.md +114 -0
- package/skills/apimapper/reference/dynamize-existing-layout.md +158 -0
- package/skills/apimapper/reference/jmespath-cookbook.md +241 -0
- package/skills/apimapper/reference/jmespath-pitfalls.md +189 -0
- package/skills/apimapper/reference/joomla.md +1 -1
- package/skills/apimapper/reference/library-template-discovery.md +65 -0
- package/skills/apimapper/reference/merge-two-sources-on-key.md +204 -0
- package/skills/apimapper/reference/oauth.md +143 -52
- package/skills/apimapper/reference/troubleshooting.md +22 -2
- package/skills/apimapper/reference/yootheme-source-to-builder-handoff.md +348 -0
- package/skills/apimapper/reference/yootheme.md +75 -44
- package/dist/auth/oauth-provider.d.ts +0 -68
- package/dist/auth/oauth-provider.js +0 -232
- package/dist/auth/oauth-provider.js.map +0 -1
- package/dist/server-http.d.ts +0 -22
- package/dist/server-http.js +0 -159
- package/dist/server-http.js.map +0 -1
- package/dist/transports/http.d.ts +0 -29
- package/dist/transports/http.js +0 -267
- package/dist/transports/http.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ApiResponse } from "@getimo/mcp-toolkit";
|
|
2
2
|
import { type Platform } from "../../platform/index.js";
|
|
3
|
+
import { type SitesRegistry } from "../../sites/loader.js";
|
|
3
4
|
/**
|
|
4
5
|
* WordPress / Joomla site base URL.
|
|
5
6
|
*
|
|
@@ -45,7 +46,7 @@ export declare function sanitizeErrorString(s: string): string;
|
|
|
45
46
|
* The underlying toolkit `ApiResponse` only carries `{success, data?, error?}`.
|
|
46
47
|
* We wrap each call so we capture the HTTP code via `fetch` and merge.
|
|
47
48
|
*/
|
|
48
|
-
export type ApiErrorCode = "auth" | "not_found" | "rate_limit" | "server" | "network" | "unknown";
|
|
49
|
+
export type ApiErrorCode = "auth" | "not_found" | "conflict" | "rate_limit" | "server" | "network" | "credential_expired" | "tier_limit_reached" | "unknown";
|
|
49
50
|
export interface ExtApiResponse<T = unknown> extends ApiResponse<T> {
|
|
50
51
|
status?: number;
|
|
51
52
|
errorCode?: ApiErrorCode;
|
|
@@ -105,6 +106,66 @@ export interface PlatformClient {
|
|
|
105
106
|
*/
|
|
106
107
|
export declare function createPlatformClient(platform: Platform): PlatformClient;
|
|
107
108
|
export declare const PLATFORM_KIND: "wordpress" | "joomla";
|
|
109
|
+
/**
|
|
110
|
+
* Network platform auto-detect. Concurrently probes the WordPress REST identity
|
|
111
|
+
* endpoint and the Joomla com_ajax getIdentity task with the same auth header,
|
|
112
|
+
* and decides which CMS is actually running at WP_BASE:
|
|
113
|
+
*
|
|
114
|
+
* - Joomla wins if its probe is HTTP 200 AND the body parses to
|
|
115
|
+
* `{success:true, data:[{success:true, …}]}` (or `data[0].platform` set).
|
|
116
|
+
* - WordPress wins if its probe is HTTP 200 AND the body is a JSON object
|
|
117
|
+
* that is NOT a `{success:false}` error envelope.
|
|
118
|
+
* - If both look OK (shouldn't happen on a single CMS), prefer the one whose
|
|
119
|
+
* reported identity `.platform` matches its own kind; else WordPress.
|
|
120
|
+
* - If neither answers → return "wordpress" (graceful fallback — no worse
|
|
121
|
+
* than the pre-Phase-1 silent default).
|
|
122
|
+
*
|
|
123
|
+
* All fetch errors are swallowed → fallback. The token is sent on the wire but
|
|
124
|
+
* never logged. Short timeout so a blocked probe host can't stall startup.
|
|
125
|
+
*
|
|
126
|
+
* Phase 3 (2026-06-03): accepts optional `(baseUrl, token)` overrides so a
|
|
127
|
+
* per-site probe (sites-file path) can target the entry's own URL + token. The
|
|
128
|
+
* no-arg call preserves the env-path behaviour exactly (module WP_BASE +
|
|
129
|
+
* probeAuthHeader()).
|
|
130
|
+
*/
|
|
131
|
+
export declare function probePlatform(baseUrl?: string, token?: string): Promise<"wordpress" | "joomla">;
|
|
132
|
+
/**
|
|
133
|
+
* Lazily load + memoize the sites-file registry from APIMAPPER_SITES_FILE.
|
|
134
|
+
* Returns `null` when the env var is unset/empty, the file is absent, or it has
|
|
135
|
+
* zero sites — in all those cases the caller falls through to the env path.
|
|
136
|
+
* A malformed / schema-invalid file throws `SitesFileError` (loud-fail at first
|
|
137
|
+
* use rather than silently degrading multi-site to single-site).
|
|
138
|
+
*/
|
|
139
|
+
export declare function getSitesRegistry(): SitesRegistry | null;
|
|
140
|
+
/**
|
|
141
|
+
* The currently-active site_id, or `null` when none has been explicitly set
|
|
142
|
+
* (the file's default entry is then used) or when no sites-file is loaded.
|
|
143
|
+
*/
|
|
144
|
+
export declare function getActiveSiteId(): string | null;
|
|
145
|
+
/**
|
|
146
|
+
* Switch the active site. Validates that `id` exists in the loaded sites-file
|
|
147
|
+
* registry, updates the in-memory pointer, and resets the resolution memo so
|
|
148
|
+
* the next `request()` re-resolves (URL + token + platform) against the new
|
|
149
|
+
* site. Throws when no sites-file is loaded or the id is unknown — the pointer
|
|
150
|
+
* is NOT changed on error.
|
|
151
|
+
*/
|
|
152
|
+
export declare function setActiveSite(id: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Drop the memoized platform resolution (and the cached sites-file registry +
|
|
155
|
+
* active-site pointer) so the next `request()` re-resolves from scratch —
|
|
156
|
+
* re-reading APIMAPPER_SITES_FILE, re-running the env-check / network probe.
|
|
157
|
+
*
|
|
158
|
+
* Production callers: invoke after deliberately changing the active selection
|
|
159
|
+
* outside `setActiveSite()` (the tool wiring uses `setActiveSite`, which already
|
|
160
|
+
* resets the memo). Safe to call any time.
|
|
161
|
+
*/
|
|
162
|
+
export declare function resetPlatformResolution(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Test-only alias of {@link resetPlatformResolution}, kept for the existing
|
|
165
|
+
* Phase-1 client tests that reference it by this name. New code should call
|
|
166
|
+
* `resetPlatformResolution()`.
|
|
167
|
+
*/
|
|
168
|
+
export declare function __resetPlatformResolutionForTests(): void;
|
|
108
169
|
/**
|
|
109
170
|
* Issue a request through the toolkit HTTP client + capture HTTP status.
|
|
110
171
|
*
|
|
@@ -120,11 +181,61 @@ export declare const PLATFORM_KIND: "wordpress" | "joomla";
|
|
|
120
181
|
*/
|
|
121
182
|
export declare function request<T = unknown>(path: string, init?: RequestInit, opts?: RequestOpts): Promise<ExtApiResponse<T>>;
|
|
122
183
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
184
|
+
* Optional second argument to {@link hintFor}, used to route a hint more
|
|
185
|
+
* precisely than the coarse `ApiErrorCode` alone allows. Both fields are
|
|
186
|
+
* optional and every legacy `hintFor(code)` call keeps its exact prior
|
|
187
|
+
* output (back-compat), so the ~12 call sites need not change.
|
|
188
|
+
*
|
|
189
|
+
* Welle 2 (F112 + F113, 2026-06-11):
|
|
190
|
+
* - `message`: the upstream error string. Lets the `unknown` branch route
|
|
191
|
+
* a config/validation/argument error to a "fix the field / fix the flow
|
|
192
|
+
* shape / detect schema" hint instead of the catch-all HEALTH_HINT
|
|
193
|
+
* (which sends the agent on a connectivity probe that always passes).
|
|
194
|
+
* It is also the channel for the F83 JMESPath depth-limit detection
|
|
195
|
+
* (see {@link DEPTH_SPLIT_HINT}).
|
|
196
|
+
* - `origin`: WHERE a 401/403 came from. `classify()` maps every 401/403
|
|
197
|
+
* to `'auth'`, but a 401/403 raised by a *connection* / *credential*
|
|
198
|
+
* fetch is an EXPIRED UPSTREAM token, not a broken MCP key. With
|
|
199
|
+
* `origin: 'connection' | 'credential'` the auth branch steers to
|
|
200
|
+
* re-authorising the upstream credential (`oauth_authorize_begin`)
|
|
201
|
+
* rather than rotating the still-valid MCP bearer key.
|
|
125
202
|
*/
|
|
126
|
-
export
|
|
203
|
+
export interface HintContext {
|
|
204
|
+
/** The upstream error message, used for message-pattern routing of `unknown`. */
|
|
205
|
+
message?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The origin of an auth (401/403) failure. `connection` / `credential`
|
|
208
|
+
* mean an expired upstream token; `mcp_transport` (or omitted) means the
|
|
209
|
+
* MCP bearer key itself.
|
|
210
|
+
*/
|
|
211
|
+
origin?: "connection" | "credential" | "mcp_transport";
|
|
212
|
+
}
|
|
213
|
+
export declare const DEPTH_SPLIT_HINT: string;
|
|
214
|
+
/**
|
|
215
|
+
* Map an `errorCode` (and optional {@link HintContext}) to a focused hint
|
|
216
|
+
* string for the caller. Falls back to the generic health-tool hint only for
|
|
217
|
+
* genuinely connectivity-shaped failures.
|
|
218
|
+
*
|
|
219
|
+
* The second argument is a UNION: a bare `string` is treated as
|
|
220
|
+
* `{ message }` so the ~12 legacy call sites that pass the upstream error
|
|
221
|
+
* string verbatim (`hintFor(code, r.error)`) keep working unchanged, while
|
|
222
|
+
* the richer `{ message, origin }` form drives F112/F113 routing. Omit it to
|
|
223
|
+
* keep the legacy code-only behaviour byte-for-byte.
|
|
224
|
+
*/
|
|
225
|
+
export declare function hintFor(code?: ApiErrorCode, context?: string | HintContext): string;
|
|
127
226
|
export declare const HEALTH_HINT = "Use apimapper_health to check connectivity and auth.";
|
|
227
|
+
/**
|
|
228
|
+
* Recovery hint for an auth failure on the MCP transport itself (the bearer
|
|
229
|
+
* key is wrong/revoked/expired). Kept verbatim for the legacy `hintFor('auth')`
|
|
230
|
+
* contract.
|
|
231
|
+
*/
|
|
232
|
+
export declare const MCP_KEY_AUTH_HINT: string;
|
|
233
|
+
/**
|
|
234
|
+
* F113 — recovery hint for an EXPIRED UPSTREAM credential surfaced as a
|
|
235
|
+
* connection/credential 401/403. The fix is to re-authorise the credential in
|
|
236
|
+
* place (preserving the refresh_token), NOT to rotate the MCP key.
|
|
237
|
+
*/
|
|
238
|
+
export declare const CREDENTIAL_EXPIRED_HINT: string;
|
|
128
239
|
export declare function authConfigured(): boolean;
|
|
129
240
|
export declare const api: {
|
|
130
241
|
request: <T>(path: string, init?: RequestInit, _retryCount?: number, responseSchema?: import("zod").ZodType<T>) => Promise<ApiResponse<T>>;
|