@automattic/mcp-wordpress-remote 0.3.3 → 0.3.4

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/lib.d.ts CHANGED
@@ -15,7 +15,7 @@ interface WordPressResponse {
15
15
  [key: string]: any;
16
16
  }
17
17
 
18
- declare const MCP_WORDPRESS_REMOTE_VERSION = "0.3.3";
18
+ declare const MCP_WORDPRESS_REMOTE_VERSION = "0.3.4";
19
19
  /**
20
20
  * Centralized configuration for MCP WordPress Remote
21
21
  * All default values are defined here and can be overridden via environment variables
@@ -290,16 +290,30 @@ declare function getFetchInfo(): {
290
290
  *
291
291
  * Supports:
292
292
  * - macOS: Automatic PAC file detection from system proxy settings
293
- * - macOS: System SOCKS proxy detection (AutoProxxy Tunnel All Traffic)
293
+ * - macOS: System SOCKS proxy detection (manual "tunnel all traffic" config)
294
294
  * - All platforms: Environment variables (SOCKS_PROXY, HTTPS_PROXY, etc.)
295
295
  */
296
296
 
297
297
  type ProxyAgent = SocksProxyAgent | HttpsProxyAgent<string>;
298
+ interface MacOsProxyInfo {
299
+ pacUrl: string | null;
300
+ socks: {
301
+ host: string;
302
+ port: string;
303
+ } | null;
304
+ }
305
+ /**
306
+ * Detector for macOS system proxy settings. Injectable so the precedence
307
+ * logic in doInitializeProxy() can be tested without shelling out to scutil.
308
+ */
309
+ type MacOsProxyDetector = () => MacOsProxyInfo | null;
298
310
  /**
299
311
  * Initialize proxy configuration (call once at startup)
300
312
  * Guards against concurrent initialization calls
313
+ *
314
+ * @param detectMacOs - Optional override for macOS proxy detection (testing seam)
301
315
  */
302
- declare function initializeProxy(): Promise<void>;
316
+ declare function initializeProxy(detectMacOs?: MacOsProxyDetector): Promise<void>;
303
317
  /**
304
318
  * Get appropriate agent for a URL based on proxy configuration
305
319
  */
package/dist/lib.js CHANGED
@@ -47325,7 +47325,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused) {
47325
47325
  }
47326
47326
 
47327
47327
  // src/lib/config.ts
47328
- var MCP_WORDPRESS_REMOTE_VERSION = "0.3.3";
47328
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.3.4";
47329
47329
  function parsePositiveIntEnv(value, defaultValue) {
47330
47330
  if (!value) {
47331
47331
  return defaultValue;
@@ -47691,18 +47691,24 @@ function detectEnvProxy() {
47691
47691
  }
47692
47692
  return null;
47693
47693
  }
47694
- async function initializeProxy() {
47694
+ async function initializeProxy(detectMacOs = detectMacOsProxy) {
47695
47695
  if (initializationPromise) {
47696
47696
  return initializationPromise;
47697
47697
  }
47698
- initializationPromise = doInitializeProxy().catch((error51) => {
47698
+ initializationPromise = doInitializeProxy(detectMacOs).catch((error51) => {
47699
47699
  initializationPromise = null;
47700
47700
  throw error51;
47701
47701
  });
47702
47702
  return initializationPromise;
47703
47703
  }
47704
- async function doInitializeProxy() {
47705
- const macProxy = detectMacOsProxy();
47704
+ async function doInitializeProxy(detectMacOs) {
47705
+ const envProxy = detectEnvProxy();
47706
+ if (envProxy) {
47707
+ proxyConfig = { type: "env", envProxy };
47708
+ logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
47709
+ return;
47710
+ }
47711
+ const macProxy = detectMacOs();
47706
47712
  if (macProxy?.pacUrl) {
47707
47713
  try {
47708
47714
  const response = await fetch(macProxy.pacUrl);
@@ -47729,12 +47735,6 @@ async function doInitializeProxy() {
47729
47735
  logger.info(`System SOCKS proxy configured: ${sanitizeProxyUrl(socksUrl)}`, "PROXY");
47730
47736
  return;
47731
47737
  }
47732
- const envProxy = detectEnvProxy();
47733
- if (envProxy) {
47734
- proxyConfig = { type: "env", envProxy };
47735
- logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
47736
- return;
47737
- }
47738
47738
  logger.debug("No proxy configured", "PROXY");
47739
47739
  proxyConfig = { type: "none" };
47740
47740
  }
package/dist/proxy.js CHANGED
@@ -55942,7 +55942,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused) {
55942
55942
  }
55943
55943
 
55944
55944
  // src/lib/config.ts
55945
- var MCP_WORDPRESS_REMOTE_VERSION = "0.3.3";
55945
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.3.4";
55946
55946
  function parsePositiveIntEnv(value, defaultValue) {
55947
55947
  if (!value) {
55948
55948
  return defaultValue;
@@ -56318,18 +56318,24 @@ function detectEnvProxy() {
56318
56318
  }
56319
56319
  return null;
56320
56320
  }
56321
- async function initializeProxy() {
56321
+ async function initializeProxy(detectMacOs = detectMacOsProxy) {
56322
56322
  if (initializationPromise) {
56323
56323
  return initializationPromise;
56324
56324
  }
56325
- initializationPromise = doInitializeProxy().catch((error51) => {
56325
+ initializationPromise = doInitializeProxy(detectMacOs).catch((error51) => {
56326
56326
  initializationPromise = null;
56327
56327
  throw error51;
56328
56328
  });
56329
56329
  return initializationPromise;
56330
56330
  }
56331
- async function doInitializeProxy() {
56332
- const macProxy = detectMacOsProxy();
56331
+ async function doInitializeProxy(detectMacOs) {
56332
+ const envProxy = detectEnvProxy();
56333
+ if (envProxy) {
56334
+ proxyConfig = { type: "env", envProxy };
56335
+ logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
56336
+ return;
56337
+ }
56338
+ const macProxy = detectMacOs();
56333
56339
  if (macProxy?.pacUrl) {
56334
56340
  try {
56335
56341
  const response = await fetch(macProxy.pacUrl);
@@ -56356,12 +56362,6 @@ async function doInitializeProxy() {
56356
56362
  logger.info(`System SOCKS proxy configured: ${sanitizeProxyUrl(socksUrl)}`, "PROXY");
56357
56363
  return;
56358
56364
  }
56359
- const envProxy = detectEnvProxy();
56360
- if (envProxy) {
56361
- proxyConfig = { type: "env", envProxy };
56362
- logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
56363
- return;
56364
- }
56365
56365
  logger.debug("No proxy configured", "PROXY");
56366
56366
  proxyConfig = { type: "none" };
56367
56367
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"