@automattic/mcp-wordpress-remote 0.5.0 → 0.5.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/README.md CHANGED
@@ -19,6 +19,35 @@ Connect AI assistants like Claude Desktop to your WordPress sites with multiple
19
19
  - **Comprehensive Logging** - Structured logging with categories and levels
20
20
  - **Complete MCP Support** - Tools, resources, prompts, and more
21
21
 
22
+ ## When to use this proxy
23
+
24
+ If your MCP client supports the Streamable HTTP transport and can authenticate to your site, connect it to the MCP Adapter endpoint directly. You don't need this proxy. For example, in Claude Code (`.mcp.json`), using an application password:
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "wordpress": {
30
+ "type": "http",
31
+ "url": "https://your-wordpress-site.com/wp-json/mcp/mcp-adapter-default-server",
32
+ "headers": {
33
+ "Authorization": "Basic <base64 of username:application-password>"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ Other clients use their own config format. Check your client's documentation for remote or HTTP MCP servers.
41
+
42
+ Use the proxy when one of these applies:
43
+
44
+ 1. **Your client only supports stdio.** It can launch a local command but cannot connect to an HTTP MCP server.
45
+ 2. **Your client can't authenticate the way your site requires.** The proxy can send application passwords, JWT tokens, WooCommerce keys, or [custom headers](#custom-headers), and it can run the [OAuth flow](#authentication-methods) and store tokens for clients that can't.
46
+ 3. **Your traffic must go through a proxy.** Set `SOCKS_PROXY`, `HTTPS_PROXY`, `ALL_PROXY` or `HTTP_PROXY` to route requests through it. On macOS, set `USE_SYSTEM_PROXY=true` to use the system PAC file or SOCKS proxy instead.
47
+ 4. **Your site is slow or unreliable.** `WP_API_TIMEOUT_MS` and `WP_API_INIT_TIMEOUT_MS` set the timeouts, and a failed initialize returns a degraded response instead of a broken connection (see [Forwarding behavior](#forwarding-behavior)).
48
+ 5. **You need a local record of the connection.** `LOG_FILE` with `LOG_LEVEL=3` logs each forwarded method plus connection and authentication events (see [Log Analysis](#log-analysis)).
49
+ 6. **You are building a packaged integration.** Tool-call hooks from the `/lib` bundle can send extra requests over the proxy's authenticated connection, for example for usage telemetry.
50
+
22
51
  ## Quick Start
23
52
 
24
53
  ### Installation
@@ -279,6 +308,13 @@ For WooCommerce-specific tools and reports:
279
308
  | `WP_API_TIMEOUT_MS` | Request timeout for tool calls (ms) | `120000` | - |
280
309
  | `WP_API_INIT_TIMEOUT_MS` | Initialize timeout (ms), after OAuth login | `25000` | - |
281
310
  | `PROXY_PAC_TIMEOUT_MS` | Timeout for PAC download and resolver setup (ms) | `5000` | - |
311
+ | **Network Proxy** | | | |
312
+ | `SOCKS_PROXY` | SOCKS proxy URL (`socks5h://` resolves DNS on the proxy) | - | - |
313
+ | `HTTPS_PROXY` | HTTP(S) proxy URL, used when `SOCKS_PROXY` is unset | - | - |
314
+ | `ALL_PROXY` | Proxy URL, used when the above are unset | - | - |
315
+ | `HTTP_PROXY` | Proxy URL, used when the above are unset | - | - |
316
+ | `NO_PROXY` | Comma-separated hosts that bypass the proxy | - | - |
317
+ | `USE_SYSTEM_PROXY` | Also detect the macOS system PAC file or SOCKS proxy when no proxy URL is set | `false` | - |
282
318
  | **TLS / Certificates** | | | |
283
319
  | `NODE_EXTRA_CA_CERTS` | Path to an extra CA file to trust (mkcert/corporate CA) | - | - |
284
320
  | `NODE_USE_SYSTEM_CA` | Trust the OS certificate store (Node 22.15+) | - | - |
@@ -476,15 +512,6 @@ Log levels:
476
512
  - **Expired token cleanup** and refresh handling
477
513
  - **Multi-instance coordination** prevents authentication conflicts
478
514
 
479
- ## Why Use MCP WordPress Remote?
480
-
481
- 1. **Multiple Authentication Methods** - Choose what works best for your setup
482
- 2. **Enhanced Security** - OAuth 2.0 with persistent token storage
483
- 3. **Better User Experience** - One-time setup with automatic token management
484
- 4. **Multi-Instance Support** - Works reliably with multiple MCP clients
485
- 5. **Comprehensive Logging** - Detailed logs for troubleshooting
486
- 6. **Easy Setup** - No global installation required with npx
487
-
488
515
  ## Requirements
489
516
 
490
517
  - **Node.js 22+** (required for fetch API support)
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.5.0";
18
+ declare const MCP_WORDPRESS_REMOTE_VERSION = "0.5.1";
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
@@ -252,9 +252,9 @@ declare function setupFetchPolyfill(): Promise<void>;
252
252
  /**
253
253
  * Proxy-aware fetch that routes requests through system proxies when configured
254
254
  *
255
- * On macOS: Evaluates PAC file from system proxy settings to determine proxy per-URL
256
- * On Linux/other: Uses SOCKS_PROXY, HTTPS_PROXY, etc. environment variables
257
- * Falls back to direct connection if no proxy is configured or USE_SYSTEM_PROXY=false
255
+ * Uses SOCKS_PROXY, HTTPS_PROXY, ALL_PROXY or HTTP_PROXY when set
256
+ * With USE_SYSTEM_PROXY=true on macOS: Evaluates the system PAC file or SOCKS proxy
257
+ * Falls back to direct connection if no proxy is configured or NO_PROXY matches
258
258
  *
259
259
  * @param url - The URL to fetch
260
260
  * @param init - Optional fetch init options
@@ -289,9 +289,9 @@ declare function getFetchInfo(): {
289
289
  * Cross-platform proxy utilities for MCP WordPress Remote
290
290
  *
291
291
  * Supports:
292
- * - macOS: Automatic PAC file detection from system proxy settings
293
- * - macOS: System SOCKS proxy detection (manual "tunnel all traffic" config)
294
- * - All platforms: Environment variables (SOCKS_PROXY, HTTPS_PROXY, etc.)
292
+ * - All platforms: Environment variables (SOCKS_PROXY, HTTPS_PROXY, etc.), always
293
+ * - macOS, with USE_SYSTEM_PROXY=true: PAC file from system proxy settings
294
+ * - macOS, with USE_SYSTEM_PROXY=true: System SOCKS proxy ("tunnel all traffic")
295
295
  */
296
296
 
297
297
  type ProxyAgent = SocksProxyAgent | HttpsProxyAgent<string>;
package/dist/lib.js CHANGED
@@ -75774,7 +75774,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused) {
75774
75774
  }
75775
75775
 
75776
75776
  // src/lib/config.ts
75777
- var MCP_WORDPRESS_REMOTE_VERSION = "0.5.0";
75777
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.5.1";
75778
75778
  function parsePositiveIntEnv(value, defaultValue) {
75779
75779
  if (!value) {
75780
75780
  return defaultValue;
@@ -75844,7 +75844,7 @@ var CONFIG = {
75844
75844
  NODE_ENV: process.env.NODE_ENV || "development",
75845
75845
  // Proxy Configuration
75846
75846
  USE_SYSTEM_PROXY: process.env.USE_SYSTEM_PROXY === "true"
75847
- // Enable system proxy detection (PAC files, env vars)
75847
+ // Enable macOS system proxy detection (PAC file, system SOCKS)
75848
75848
  };
75849
75849
  var getConfig = () => ({
75850
75850
  /** WordPress site API endpoint */
@@ -76192,6 +76192,11 @@ async function doInitializeProxy(detectMacOs) {
76192
76192
  logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
76193
76193
  return;
76194
76194
  }
76195
+ if (!getConfig().useSystemProxy) {
76196
+ logger.debug("No proxy configured (system proxy detection disabled)", "PROXY");
76197
+ proxyConfig = { type: "none" };
76198
+ return;
76199
+ }
76195
76200
  const macProxy = detectMacOs();
76196
76201
  if (macProxy?.pacUrl) {
76197
76202
  try {
@@ -76301,11 +76306,7 @@ async function setupFetchPolyfill() {
76301
76306
  } else {
76302
76307
  logger.info("Using native fetch API", "SYSTEM");
76303
76308
  }
76304
- if (getConfig().useSystemProxy) {
76305
- await initializeProxy();
76306
- } else {
76307
- logger.debug("System proxy support disabled (USE_SYSTEM_PROXY=false)", "PROXY");
76308
- }
76309
+ await initializeProxy();
76309
76310
  }
76310
76311
  async function proxyFetch(url2, init) {
76311
76312
  const headers = new Headers(init?.headers);
@@ -76313,9 +76314,6 @@ async function proxyFetch(url2, init) {
76313
76314
  headers.set("User-Agent", clientProduct ? `${clientProduct} ${PROXY_PRODUCT}` : PROXY_PRODUCT);
76314
76315
  }
76315
76316
  init = { ...init, headers };
76316
- if (!getConfig().useSystemProxy) {
76317
- return fetch(url2, init);
76318
- }
76319
76317
  const agent = await getAgentForUrl(url2);
76320
76318
  if (agent) {
76321
76319
  const nodeFetch = (await Promise.resolve().then(() => (init_src(), src_exports))).default;
package/dist/proxy.js CHANGED
@@ -76507,7 +76507,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused) {
76507
76507
  }
76508
76508
 
76509
76509
  // src/lib/config.ts
76510
- var MCP_WORDPRESS_REMOTE_VERSION = "0.5.0";
76510
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.5.1";
76511
76511
  function parsePositiveIntEnv(value, defaultValue) {
76512
76512
  if (!value) {
76513
76513
  return defaultValue;
@@ -76577,7 +76577,7 @@ var CONFIG = {
76577
76577
  NODE_ENV: process.env.NODE_ENV || "development",
76578
76578
  // Proxy Configuration
76579
76579
  USE_SYSTEM_PROXY: process.env.USE_SYSTEM_PROXY === "true"
76580
- // Enable system proxy detection (PAC files, env vars)
76580
+ // Enable macOS system proxy detection (PAC file, system SOCKS)
76581
76581
  };
76582
76582
  var getConfig = () => ({
76583
76583
  /** WordPress site API endpoint */
@@ -76944,6 +76944,11 @@ async function doInitializeProxy(detectMacOs) {
76944
76944
  logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
76945
76945
  return;
76946
76946
  }
76947
+ if (!getConfig().useSystemProxy) {
76948
+ logger.debug("No proxy configured (system proxy detection disabled)", "PROXY");
76949
+ proxyConfig = { type: "none" };
76950
+ return;
76951
+ }
76947
76952
  const macProxy = detectMacOs();
76948
76953
  if (macProxy?.pacUrl) {
76949
76954
  try {
@@ -77056,11 +77061,7 @@ async function setupFetchPolyfill() {
77056
77061
  } else {
77057
77062
  logger.info("Using native fetch API", "SYSTEM");
77058
77063
  }
77059
- if (getConfig().useSystemProxy) {
77060
- await initializeProxy();
77061
- } else {
77062
- logger.debug("System proxy support disabled (USE_SYSTEM_PROXY=false)", "PROXY");
77063
- }
77064
+ await initializeProxy();
77064
77065
  }
77065
77066
  async function proxyFetch(url2, init) {
77066
77067
  const headers = new Headers(init?.headers);
@@ -77068,9 +77069,6 @@ async function proxyFetch(url2, init) {
77068
77069
  headers.set("User-Agent", clientProduct ? `${clientProduct} ${PROXY_PRODUCT}` : PROXY_PRODUCT);
77069
77070
  }
77070
77071
  init = { ...init, headers };
77071
- if (!getConfig().useSystemProxy) {
77072
- return fetch(url2, init);
77073
- }
77074
77072
  const agent = await getAgentForUrl(url2);
77075
77073
  if (agent) {
77076
77074
  const nodeFetch = (await Promise.resolve().then(() => (init_src(), src_exports))).default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"