@automattic/mcp-wordpress-remote 0.2.17 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/lib.d.ts +85 -2
- package/dist/lib.js +7844 -1075
- package/dist/proxy.js +421 -42
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ Custom headers are included in:
|
|
|
105
105
|
|
|
106
106
|
## WordPress MCP Plugin
|
|
107
107
|
|
|
108
|
-
You need to install the [wordpress-mcp](https://github.com/
|
|
108
|
+
You need to install the [wordpress-mcp](https://github.com/WordPress/mcp-adapter) plugin on your WordPress website and enable MCP Functionality in Settings > MCP Settings.
|
|
109
109
|
|
|
110
110
|
## Authentication Methods
|
|
111
111
|
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
2
|
+
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* WordPress API request parameters
|
|
3
6
|
*/
|
|
@@ -12,7 +15,7 @@ interface WordPressResponse {
|
|
|
12
15
|
[key: string]: any;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.
|
|
18
|
+
declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.19";
|
|
16
19
|
/**
|
|
17
20
|
* Centralized configuration for MCP WordPress Remote
|
|
18
21
|
* All default values are defined here and can be overridden via environment variables
|
|
@@ -42,6 +45,7 @@ declare const CONFIG: {
|
|
|
42
45
|
readonly WOO_CUSTOMER_SECRET: string | undefined;
|
|
43
46
|
readonly CUSTOM_HEADERS: string;
|
|
44
47
|
readonly NODE_ENV: string;
|
|
48
|
+
readonly USE_SYSTEM_PROXY: boolean;
|
|
45
49
|
};
|
|
46
50
|
/**
|
|
47
51
|
* Type-safe configuration access with JSDoc descriptions
|
|
@@ -89,6 +93,8 @@ declare const getConfig: () => {
|
|
|
89
93
|
customHeaders: string;
|
|
90
94
|
/** Current environment */
|
|
91
95
|
nodeEnv: string;
|
|
96
|
+
/** Whether to use system proxy (PAC files on macOS, env vars on all platforms) */
|
|
97
|
+
useSystemProxy: boolean;
|
|
92
98
|
};
|
|
93
99
|
/**
|
|
94
100
|
* Get default OAuth scopes
|
|
@@ -219,4 +225,81 @@ declare function isConfigError(error: any): error is ConfigError;
|
|
|
219
225
|
declare function isAuthError(error: any): error is AuthError;
|
|
220
226
|
declare function isAPIError(error: any): error is APIError;
|
|
221
227
|
|
|
222
|
-
|
|
228
|
+
/**
|
|
229
|
+
* Fetch API utilities for MCP WordPress Remote
|
|
230
|
+
*
|
|
231
|
+
* Provides fetch polyfill setup for Node.js environments that don't have native fetch
|
|
232
|
+
* and proxy-aware fetch for routing through system proxies (PAC files, env-based SOCKS/HTTP proxies)
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* Setup fetch polyfill for Node.js 18+ compatibility
|
|
236
|
+
*
|
|
237
|
+
* Checks if native fetch is available and loads node-fetch polyfill if needed.
|
|
238
|
+
* This ensures compatibility across different Node.js versions.
|
|
239
|
+
* Also initializes proxy support for system proxies (PAC files, env vars).
|
|
240
|
+
*/
|
|
241
|
+
declare function setupFetchPolyfill(): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Proxy-aware fetch that routes requests through system proxies when configured
|
|
244
|
+
*
|
|
245
|
+
* On macOS: Evaluates PAC file from system proxy settings to determine proxy per-URL
|
|
246
|
+
* On Linux/other: Uses SOCKS_PROXY, HTTPS_PROXY, etc. environment variables
|
|
247
|
+
* Falls back to direct connection if no proxy is configured or USE_SYSTEM_PROXY=false
|
|
248
|
+
*
|
|
249
|
+
* @param url - The URL to fetch
|
|
250
|
+
* @param init - Optional fetch init options
|
|
251
|
+
* @returns Promise resolving to the Response
|
|
252
|
+
*/
|
|
253
|
+
declare function proxyFetch(url: string, init?: RequestInit): Promise<Response>;
|
|
254
|
+
/**
|
|
255
|
+
* Get proxy status information for logging/debugging
|
|
256
|
+
*/
|
|
257
|
+
declare function getProxyInfo(): {
|
|
258
|
+
configured: boolean;
|
|
259
|
+
type: "pac" | "env" | "none";
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Check if fetch is available (either native or polyfilled)
|
|
263
|
+
*
|
|
264
|
+
* @returns true if fetch is available, false otherwise
|
|
265
|
+
*/
|
|
266
|
+
declare function isFetchAvailable(): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Get information about the current fetch implementation
|
|
269
|
+
*
|
|
270
|
+
* @returns Object with details about fetch availability and type
|
|
271
|
+
*/
|
|
272
|
+
declare function getFetchInfo(): {
|
|
273
|
+
available: boolean;
|
|
274
|
+
native: boolean;
|
|
275
|
+
polyfilled: boolean;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Cross-platform proxy utilities for MCP WordPress Remote
|
|
280
|
+
*
|
|
281
|
+
* Supports:
|
|
282
|
+
* - macOS: Automatic PAC file detection from system proxy settings
|
|
283
|
+
* - All platforms: Environment variables (SOCKS_PROXY, HTTPS_PROXY, etc.)
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
type ProxyAgent = SocksProxyAgent | HttpsProxyAgent<string>;
|
|
287
|
+
/**
|
|
288
|
+
* Initialize proxy configuration (call once at startup)
|
|
289
|
+
* Guards against concurrent initialization calls
|
|
290
|
+
*/
|
|
291
|
+
declare function initializeProxy(): Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* Get appropriate agent for a URL based on proxy configuration
|
|
294
|
+
*/
|
|
295
|
+
declare function getAgentForUrl(url: string): Promise<ProxyAgent | undefined>;
|
|
296
|
+
/**
|
|
297
|
+
* Check if proxy is configured
|
|
298
|
+
*/
|
|
299
|
+
declare function isProxyConfigured(): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Get proxy configuration type for logging
|
|
302
|
+
*/
|
|
303
|
+
declare function getProxyType(): 'pac' | 'env' | 'none';
|
|
304
|
+
|
|
305
|
+
export { APIError, AuthError, CONFIG, ConfigError, LogLevel, MCP_WORDPRESS_REMOTE_VERSION, OAuthError, type TokenValidationResult, type WPClientInfo, type WPTokens, type WordPressRequestParams, type WordPressResponse, getAgentForUrl, getConfig, getCustomHeaders, getDefaultOAuthScopes, getFetchInfo, getProxyInfo, getProxyType, initializeProxy, isAPIError, isAuthError, isConfigError, isFetchAvailable, isOAuthError, isProxyConfigured, log, logger, parseCustomHeaders, proxyFetch, setupFetchPolyfill, validateConfig, wpRequest };
|