@automattic/mcp-wordpress-remote 0.2.18 → 0.2.20

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/proxy.js CHANGED
@@ -36036,7 +36036,7 @@ async function selectCallbackPort(serverUrl, specifiedPort, _unused) {
36036
36036
  }
36037
36037
 
36038
36038
  // src/lib/config.ts
36039
- var MCP_WORDPRESS_REMOTE_VERSION = "0.2.18";
36039
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.2.19";
36040
36040
  var CONFIG = {
36041
36041
  // API Configuration
36042
36042
  WP_API_URL: process.env.WP_API_URL || "https://example.com",
@@ -36086,8 +36086,57 @@ var CONFIG = {
36086
36086
  CUSTOM_HEADERS: process.env.CUSTOM_HEADERS || "",
36087
36087
  // JSON string or comma-separated header:value pairs
36088
36088
  // Environment
36089
- NODE_ENV: process.env.NODE_ENV || "development"
36089
+ NODE_ENV: process.env.NODE_ENV || "development",
36090
+ // Proxy Configuration
36091
+ USE_SYSTEM_PROXY: process.env.USE_SYSTEM_PROXY === "true"
36092
+ // Enable system proxy detection (PAC files, env vars)
36090
36093
  };
36094
+ var getConfig = () => ({
36095
+ /** WordPress site API endpoint */
36096
+ wpApiUrl: CONFIG.WP_API_URL,
36097
+ /** Whether OAuth authentication is enabled */
36098
+ oauthEnabled: CONFIG.OAUTH_ENABLED,
36099
+ /** Port for OAuth callback server (undefined for auto-detection on self-hosted sites) */
36100
+ oauthCallbackPort: CONFIG.OAUTH_CALLBACK_PORT,
36101
+ /** Hostname for OAuth callback */
36102
+ oauthHost: CONFIG.OAUTH_HOST,
36103
+ /** WordPress OAuth client ID */
36104
+ wpOAuthClientId: CONFIG.WP_OAUTH_CLIENT_ID,
36105
+ /** OAuth flow type (authorization_code recommended, implicit for legacy) */
36106
+ oauthFlowType: CONFIG.OAUTH_FLOW_TYPE,
36107
+ /** Whether to use PKCE (required for OAuth 2.1) */
36108
+ oauthUsePKCE: CONFIG.OAUTH_USE_PKCE,
36109
+ /** Whether to support dynamic client registration */
36110
+ oauthDynamicRegistration: CONFIG.OAUTH_DYNAMIC_REGISTRATION,
36111
+ /** Whether to use resource indicators (RFC 8707) */
36112
+ oauthResourceIndicator: CONFIG.OAUTH_RESOURCE_INDICATOR,
36113
+ /** Custom OAuth scopes (comma-separated) */
36114
+ oauthScopes: CONFIG.OAUTH_SCOPES,
36115
+ /** OAuth operation timeout in milliseconds */
36116
+ oauthTimeout: CONFIG.OAUTH_TIMEOUT,
36117
+ /** Lock operation timeout in milliseconds */
36118
+ lockTimeout: CONFIG.LOCK_TIMEOUT,
36119
+ /** Configuration directory path */
36120
+ configDir: CONFIG.WP_MCP_CONFIG_DIR,
36121
+ /** Log file path (null if not set) */
36122
+ logFile: CONFIG.LOG_FILE,
36123
+ /** WordPress API username (legacy) */
36124
+ wpApiUsername: CONFIG.WP_API_USERNAME,
36125
+ /** WordPress API password (legacy) */
36126
+ wpApiPassword: CONFIG.WP_API_PASSWORD,
36127
+ /** JWT token for authentication */
36128
+ jwtToken: CONFIG.JWT_TOKEN,
36129
+ /** WooCommerce customer key */
36130
+ wooCustomerKey: CONFIG.WOO_CUSTOMER_KEY,
36131
+ /** WooCommerce customer secret */
36132
+ wooCustomerSecret: CONFIG.WOO_CUSTOMER_SECRET,
36133
+ /** Custom headers for API requests */
36134
+ customHeaders: CONFIG.CUSTOM_HEADERS,
36135
+ /** Current environment */
36136
+ nodeEnv: CONFIG.NODE_ENV,
36137
+ /** Whether to use system proxy (PAC files on macOS, env vars on all platforms) */
36138
+ useSystemProxy: CONFIG.USE_SYSTEM_PROXY
36139
+ });
36091
36140
  function parseOAuthScopes(envScopes, defaultScopes) {
36092
36141
  if (!envScopes || envScopes.trim() === "") {
36093
36142
  return defaultScopes;
@@ -36250,6 +36299,177 @@ function validateNodeVersion(requiredVersion = 18) {
36250
36299
  }
36251
36300
  }
36252
36301
 
36302
+ // src/lib/proxy-utils.ts
36303
+ import { execSync } from "child_process";
36304
+ import { SocksProxyAgent } from "socks-proxy-agent";
36305
+ import { HttpsProxyAgent } from "https-proxy-agent";
36306
+ var proxyConfig = { type: "none" };
36307
+ var initializationPromise = null;
36308
+ function detectMacOsProxy() {
36309
+ if (process.platform !== "darwin") return null;
36310
+ try {
36311
+ const output = execSync("scutil --proxy", { encoding: "utf-8", timeout: 3e3 });
36312
+ const pacEnabled = output.match(/ProxyAutoConfigEnable\s*:\s*(\d)/)?.[1] === "1";
36313
+ const pacUrl = output.match(/ProxyAutoConfigURLString\s*:\s*(\S+)/)?.[1];
36314
+ const socksEnabled = output.match(/SOCKSEnable\s*:\s*(\d)/)?.[1] === "1";
36315
+ const socksHost = output.match(/SOCKSProxy\s*:\s*(\S+)/)?.[1];
36316
+ const socksPort = output.match(/SOCKSPort\s*:\s*(\d+)/)?.[1];
36317
+ return {
36318
+ pacUrl: pacEnabled && pacUrl ? pacUrl : null,
36319
+ socks: socksEnabled && socksHost && socksPort ? { host: socksHost, port: socksPort } : null
36320
+ };
36321
+ } catch {
36322
+ }
36323
+ return null;
36324
+ }
36325
+ function isSocksProxy(url) {
36326
+ return url.toLowerCase().startsWith("socks");
36327
+ }
36328
+ function sanitizeProxyUrl(url) {
36329
+ try {
36330
+ const parsed = new URL(url);
36331
+ if (parsed.password) parsed.password = "***";
36332
+ return parsed.toString();
36333
+ } catch {
36334
+ return url.replace(/\/\/[^:]+:[^@]+@/, "//***:***@");
36335
+ }
36336
+ }
36337
+ function shouldBypassProxy(targetUrl) {
36338
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy;
36339
+ if (!noProxy) return false;
36340
+ let hostname2;
36341
+ try {
36342
+ hostname2 = new URL(targetUrl).hostname.toLowerCase();
36343
+ } catch {
36344
+ return false;
36345
+ }
36346
+ const rules = noProxy.split(",").map((r2) => r2.trim().toLowerCase()).filter((r2) => r2.length > 0);
36347
+ for (const rule of rules) {
36348
+ if (rule === "*") return true;
36349
+ if (hostname2 === rule) return true;
36350
+ if (rule.startsWith(".") && hostname2.endsWith(rule) || !rule.startsWith(".") && hostname2.endsWith(`.${rule}`)) {
36351
+ return true;
36352
+ }
36353
+ }
36354
+ return false;
36355
+ }
36356
+ function detectEnvProxy() {
36357
+ const socksProxy = process.env.SOCKS_PROXY || process.env.socks_proxy;
36358
+ if (socksProxy) {
36359
+ return { url: socksProxy, type: "socks" };
36360
+ }
36361
+ const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
36362
+ if (httpsProxy) {
36363
+ return { url: httpsProxy, type: isSocksProxy(httpsProxy) ? "socks" : "http" };
36364
+ }
36365
+ const allProxy = process.env.ALL_PROXY || process.env.all_proxy;
36366
+ if (allProxy) {
36367
+ return { url: allProxy, type: isSocksProxy(allProxy) ? "socks" : "http" };
36368
+ }
36369
+ const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
36370
+ if (httpProxy) {
36371
+ return { url: httpProxy, type: isSocksProxy(httpProxy) ? "socks" : "http" };
36372
+ }
36373
+ return null;
36374
+ }
36375
+ async function initializeProxy() {
36376
+ if (initializationPromise) {
36377
+ return initializationPromise;
36378
+ }
36379
+ initializationPromise = doInitializeProxy().catch((error) => {
36380
+ initializationPromise = null;
36381
+ throw error;
36382
+ });
36383
+ return initializationPromise;
36384
+ }
36385
+ async function doInitializeProxy() {
36386
+ const macProxy = detectMacOsProxy();
36387
+ if (macProxy?.pacUrl) {
36388
+ try {
36389
+ const response = await fetch(macProxy.pacUrl);
36390
+ const pacScript = await response.text();
36391
+ const { getQuickJS } = await import("@tootallnate/quickjs-emscripten");
36392
+ const { createPacResolver } = await import("pac-resolver");
36393
+ const qjs = await getQuickJS();
36394
+ const resolver = createPacResolver(qjs, pacScript);
36395
+ proxyConfig = {
36396
+ type: "pac",
36397
+ pacResolver: resolver
36398
+ };
36399
+ logger.info(`PAC proxy initialized from ${sanitizeProxyUrl(macProxy.pacUrl)}`, "PROXY");
36400
+ return;
36401
+ } catch (error) {
36402
+ logger.error(`Failed to initialize PAC proxy: ${error}`, "PROXY");
36403
+ }
36404
+ }
36405
+ if (macProxy?.socks) {
36406
+ const { host, port } = macProxy.socks;
36407
+ const bracketedHost = host.includes(":") ? `[${host}]` : host;
36408
+ const socksUrl = `socks5://${bracketedHost}:${port}`;
36409
+ proxyConfig = { type: "env", envProxy: { url: socksUrl, type: "socks" } };
36410
+ logger.info(`System SOCKS proxy configured: ${sanitizeProxyUrl(socksUrl)}`, "PROXY");
36411
+ return;
36412
+ }
36413
+ const envProxy = detectEnvProxy();
36414
+ if (envProxy) {
36415
+ proxyConfig = { type: "env", envProxy };
36416
+ logger.info(`Proxy configured from environment: ${sanitizeProxyUrl(envProxy.url)}`, "PROXY");
36417
+ return;
36418
+ }
36419
+ logger.debug("No proxy configured", "PROXY");
36420
+ proxyConfig = { type: "none" };
36421
+ }
36422
+ async function getAgentForUrl(url) {
36423
+ if (proxyConfig.type === "none") {
36424
+ return void 0;
36425
+ }
36426
+ if (shouldBypassProxy(url)) {
36427
+ logger.debug(`Bypassing proxy for ${url} (matches NO_PROXY)`, "PROXY");
36428
+ return void 0;
36429
+ }
36430
+ if (proxyConfig.type === "pac" && proxyConfig.pacResolver) {
36431
+ try {
36432
+ const result = await proxyConfig.pacResolver(url);
36433
+ const directives = result.split(";");
36434
+ for (const rawDirective of directives) {
36435
+ const directive = rawDirective.trim();
36436
+ if (!directive) continue;
36437
+ if (directive.toUpperCase() === "DIRECT") {
36438
+ logger.debug(`PAC returned DIRECT for ${url}`, "PROXY");
36439
+ return void 0;
36440
+ }
36441
+ const socksMatch = directive.match(/SOCKS5?\s+(\S+):(\d+)/i);
36442
+ if (socksMatch) {
36443
+ const proxyUrl = `socks5://${socksMatch[1]}:${socksMatch[2]}`;
36444
+ logger.debug(`PAC returned SOCKS proxy for ${url}: ${sanitizeProxyUrl(proxyUrl)}`, "PROXY");
36445
+ return new SocksProxyAgent(proxyUrl);
36446
+ }
36447
+ const proxyMatch = directive.match(/PROXY\s+(\S+):(\d+)/i);
36448
+ if (proxyMatch) {
36449
+ const proxyUrl = `http://${proxyMatch[1]}:${proxyMatch[2]}`;
36450
+ logger.debug(`PAC returned HTTP proxy for ${url}: ${sanitizeProxyUrl(proxyUrl)}`, "PROXY");
36451
+ return new HttpsProxyAgent(proxyUrl);
36452
+ }
36453
+ }
36454
+ logger.debug(`PAC returned no usable proxy for ${url}: ${result}`, "PROXY");
36455
+ } catch (error) {
36456
+ logger.warn(`PAC evaluation failed for ${url}: ${error}`, "PROXY");
36457
+ }
36458
+ return void 0;
36459
+ }
36460
+ if (proxyConfig.type === "env" && proxyConfig.envProxy) {
36461
+ const { url: proxyUrl, type } = proxyConfig.envProxy;
36462
+ try {
36463
+ logger.debug(`Using env proxy ${sanitizeProxyUrl(proxyUrl)} for ${url}`, "PROXY");
36464
+ return type === "socks" ? new SocksProxyAgent(proxyUrl) : new HttpsProxyAgent(proxyUrl);
36465
+ } catch (error) {
36466
+ logger.error(`Invalid proxy URL "${proxyUrl}": ${error}`, "PROXY");
36467
+ return void 0;
36468
+ }
36469
+ }
36470
+ return void 0;
36471
+ }
36472
+
36253
36473
  // src/lib/fetch-utils.ts
36254
36474
  async function setupFetchPolyfill() {
36255
36475
  if (typeof globalThis.fetch !== "function") {
@@ -36269,6 +36489,22 @@ async function setupFetchPolyfill() {
36269
36489
  } else {
36270
36490
  logger.info("Using native fetch API", "SYSTEM");
36271
36491
  }
36492
+ if (getConfig().useSystemProxy) {
36493
+ await initializeProxy();
36494
+ } else {
36495
+ logger.debug("System proxy support disabled (USE_SYSTEM_PROXY=false)", "PROXY");
36496
+ }
36497
+ }
36498
+ async function proxyFetch(url, init) {
36499
+ if (!getConfig().useSystemProxy) {
36500
+ return fetch(url, init);
36501
+ }
36502
+ const agent = await getAgentForUrl(url);
36503
+ if (agent) {
36504
+ const nodeFetch = (await Promise.resolve().then(() => (init_src(), src_exports))).default;
36505
+ return nodeFetch(url, { ...init, agent });
36506
+ }
36507
+ return fetch(url, init);
36272
36508
  }
36273
36509
 
36274
36510
  // src/lib/wordpress-api.ts
@@ -36783,7 +37019,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl) {
36783
37019
  const metadataUrl = new URL("/.well-known/oauth-authorization-server", authorizationServerUrl);
36784
37020
  logger.oauth(`Discovering authorization server metadata: ${metadataUrl}`);
36785
37021
  const customHeaders = getCustomHeaders();
36786
- const response = await fetch(metadataUrl.toString(), {
37022
+ const response = await proxyFetch(metadataUrl.toString(), {
36787
37023
  headers: {
36788
37024
  "Accept": "application/json",
36789
37025
  ...customHeaders
@@ -36820,7 +37056,7 @@ async function discoverProtectedResourceMetadata(resourceUrl) {
36820
37056
  const metadataUrl = new URL("/.well-known/oauth-protected-resource", url.origin);
36821
37057
  logger.oauth(`Discovering protected resource metadata: ${metadataUrl}`);
36822
37058
  const customHeaders = getCustomHeaders();
36823
- const response = await fetch(metadataUrl.toString(), {
37059
+ const response = await proxyFetch(metadataUrl.toString(), {
36824
37060
  headers: {
36825
37061
  "Accept": "application/json",
36826
37062
  ...customHeaders
@@ -36886,7 +37122,7 @@ async function registerDynamicClient(registrationEndpoint, registrationRequest)
36886
37122
  try {
36887
37123
  logger.oauth(`Attempting dynamic client registration: ${registrationEndpoint}`);
36888
37124
  const customHeaders = getCustomHeaders();
36889
- const response = await fetch(registrationEndpoint, {
37125
+ const response = await proxyFetch(registrationEndpoint, {
36890
37126
  method: "POST",
36891
37127
  headers: {
36892
37128
  "Content-Type": "application/json",
@@ -36938,7 +37174,7 @@ async function exchangeAuthorizationCode(tokenEndpoint, code, redirectUri, clien
36938
37174
  params.set("resource", resource);
36939
37175
  }
36940
37176
  const customHeaders = getCustomHeaders();
36941
- const response = await fetch(tokenEndpoint, {
37177
+ const response = await proxyFetch(tokenEndpoint, {
36942
37178
  method: "POST",
36943
37179
  headers: {
36944
37180
  "Content-Type": "application/x-www-form-urlencoded",
@@ -37406,7 +37642,7 @@ var MCPOAuthProvider = class {
37406
37642
  try {
37407
37643
  logger.oauth("Attempting discovery via 401 response method");
37408
37644
  const customHeaders = getCustomHeaders();
37409
- const response = await fetch(this.config.serverUrl, {
37645
+ const response = await proxyFetch(this.config.serverUrl, {
37410
37646
  headers: {
37411
37647
  Accept: "application/json",
37412
37648
  ...customHeaders
@@ -37418,7 +37654,7 @@ var MCPOAuthProvider = class {
37418
37654
  const authInfo = parseWWWAuthenticateHeader(wwwAuthHeader);
37419
37655
  logger.oauth("WWW-Authenticate header parsed successfully");
37420
37656
  if (authInfo.resource_metadata_url) {
37421
- const metadataResponse = await fetch(authInfo.resource_metadata_url, {
37657
+ const metadataResponse = await proxyFetch(authInfo.resource_metadata_url, {
37422
37658
  headers: {
37423
37659
  "Accept": "application/json",
37424
37660
  ...customHeaders
@@ -38493,7 +38729,7 @@ async function wpRequest(requestData, useJsonRpc = true) {
38493
38729
  logger.api("Sending request to WordPress API...");
38494
38730
  logger.debug(`Request URL: ${url}`, "API");
38495
38731
  logger.debug(`Request method: ${method}`, "API");
38496
- const response = await fetch(url, fetchOptions);
38732
+ const response = await proxyFetch(url, fetchOptions);
38497
38733
  logger.debug(`Response status: ${response.status}`, "API");
38498
38734
  if (!response.ok) {
38499
38735
  const errorText = await response.text();
@@ -38914,7 +39150,7 @@ async function WordPressProxy() {
38914
39150
  const server = new Server(
38915
39151
  {
38916
39152
  name: "WordPress MCP Remote Proxy",
38917
- version: "0.2.17"
39153
+ version: MCP_WORDPRESS_REMOTE_VERSION
38918
39154
  },
38919
39155
  {
38920
39156
  capabilities: {
@@ -38942,17 +39178,29 @@ async function WordPressProxy() {
38942
39178
  logger.debug("Initialize response:", "INIT", wordpressInitResponse);
38943
39179
  return wordpressInitResponse;
38944
39180
  } catch (error) {
38945
- logger.error("\u274C Failed to initialize WordPress connection with client parameters", "INIT", error);
39181
+ logger.error(
39182
+ "\u274C Failed to initialize WordPress connection with client parameters",
39183
+ "INIT",
39184
+ error
39185
+ );
39186
+ const clientProtocolVersion = request?.params?.protocolVersion || "2025-06-18";
38946
39187
  const fallbackResponse = {
38947
- protocolVersion: "2025-06-18",
39188
+ protocolVersion: clientProtocolVersion,
38948
39189
  serverInfo: {
38949
39190
  name: "WordPress MCP Remote Proxy",
38950
- version: "0.2.17"
39191
+ version: MCP_WORDPRESS_REMOTE_VERSION
38951
39192
  },
38952
39193
  capabilities: {
38953
- tools: {},
38954
- resources: {},
38955
- prompts: {},
39194
+ tools: {
39195
+ listChanged: false
39196
+ },
39197
+ resources: {
39198
+ listChanged: false,
39199
+ subscribe: false
39200
+ },
39201
+ prompts: {
39202
+ listChanged: false
39203
+ },
38956
39204
  logging: {},
38957
39205
  completions: {}
38958
39206
  },
@@ -38962,24 +39210,62 @@ async function WordPressProxy() {
38962
39210
  return fallbackResponse;
38963
39211
  }
38964
39212
  });
38965
- server.setRequestHandler(ListToolsRequestSchema, createWrappedHandler(HANDLER_CONFIGS.listTools, sessionContext));
38966
- server.setRequestHandler(CallToolRequestSchema, createWrappedHandler(HANDLER_CONFIGS.callTool, sessionContext));
38967
- server.setRequestHandler(ListResourcesRequestSchema, createWrappedHandler(HANDLER_CONFIGS.listResources, sessionContext));
38968
- server.setRequestHandler(ListResourceTemplatesRequestSchema, createWrappedHandler(HANDLER_CONFIGS.listResourceTemplates, sessionContext));
38969
- server.setRequestHandler(ReadResourceRequestSchema, createWrappedHandler(HANDLER_CONFIGS.readResource, sessionContext));
38970
- server.setRequestHandler(SubscribeRequestSchema, createWrappedHandler(HANDLER_CONFIGS.subscribe, sessionContext));
38971
- server.setRequestHandler(UnsubscribeRequestSchema, createWrappedHandler(HANDLER_CONFIGS.unsubscribe, sessionContext));
38972
- server.setRequestHandler(ListPromptsRequestSchema, createWrappedHandler(HANDLER_CONFIGS.listPrompts, sessionContext));
38973
- server.setRequestHandler(GetPromptRequestSchema, createWrappedHandler(HANDLER_CONFIGS.getPrompt, sessionContext));
38974
- server.setRequestHandler(SetLevelRequestSchema, createWrappedHandler(HANDLER_CONFIGS.setLevel, sessionContext));
38975
- server.setRequestHandler(CompleteRequestSchema, createWrappedHandler(HANDLER_CONFIGS.complete, sessionContext));
38976
- server.setRequestHandler(ListRootsRequestSchema, createWrappedHandler(HANDLER_CONFIGS.listRoots, sessionContext));
39213
+ server.setRequestHandler(
39214
+ ListToolsRequestSchema,
39215
+ createWrappedHandler(HANDLER_CONFIGS.listTools, sessionContext)
39216
+ );
39217
+ server.setRequestHandler(
39218
+ CallToolRequestSchema,
39219
+ createWrappedHandler(HANDLER_CONFIGS.callTool, sessionContext)
39220
+ );
39221
+ server.setRequestHandler(
39222
+ ListResourcesRequestSchema,
39223
+ createWrappedHandler(HANDLER_CONFIGS.listResources, sessionContext)
39224
+ );
39225
+ server.setRequestHandler(
39226
+ ListResourceTemplatesRequestSchema,
39227
+ createWrappedHandler(HANDLER_CONFIGS.listResourceTemplates, sessionContext)
39228
+ );
39229
+ server.setRequestHandler(
39230
+ ReadResourceRequestSchema,
39231
+ createWrappedHandler(HANDLER_CONFIGS.readResource, sessionContext)
39232
+ );
39233
+ server.setRequestHandler(
39234
+ SubscribeRequestSchema,
39235
+ createWrappedHandler(HANDLER_CONFIGS.subscribe, sessionContext)
39236
+ );
39237
+ server.setRequestHandler(
39238
+ UnsubscribeRequestSchema,
39239
+ createWrappedHandler(HANDLER_CONFIGS.unsubscribe, sessionContext)
39240
+ );
39241
+ server.setRequestHandler(
39242
+ ListPromptsRequestSchema,
39243
+ createWrappedHandler(HANDLER_CONFIGS.listPrompts, sessionContext)
39244
+ );
39245
+ server.setRequestHandler(
39246
+ GetPromptRequestSchema,
39247
+ createWrappedHandler(HANDLER_CONFIGS.getPrompt, sessionContext)
39248
+ );
39249
+ server.setRequestHandler(
39250
+ SetLevelRequestSchema,
39251
+ createWrappedHandler(HANDLER_CONFIGS.setLevel, sessionContext)
39252
+ );
39253
+ server.setRequestHandler(
39254
+ CompleteRequestSchema,
39255
+ createWrappedHandler(HANDLER_CONFIGS.complete, sessionContext)
39256
+ );
39257
+ server.setRequestHandler(
39258
+ ListRootsRequestSchema,
39259
+ createWrappedHandler(HANDLER_CONFIGS.listRoots, sessionContext)
39260
+ );
38977
39261
  const transport = new StdioServerTransport();
38978
39262
  transport.onmessage = (message) => {
38979
39263
  const msg = message;
38980
39264
  const method = typeof msg?.method === "string" ? msg.method : "unknown";
38981
39265
  const id = msg?.id ?? "none";
38982
- const hasParams = Boolean(msg?.params && typeof msg.params === "object" && Object.keys(msg.params).length);
39266
+ const hasParams = Boolean(
39267
+ msg?.params && typeof msg.params === "object" && Object.keys(msg.params).length
39268
+ );
38983
39269
  logger.info("\u{1F4E5} Raw client message received", "TRANSPORT", {
38984
39270
  method,
38985
39271
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -59,9 +59,13 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@modelcontextprotocol/sdk": "^1.8.0",
62
+ "@tootallnate/quickjs-emscripten": "^0.23.0",
62
63
  "express": "^4.18.2",
64
+ "https-proxy-agent": "^7.0.6",
63
65
  "node-fetch": "^3.3.2",
64
- "open": "^10.0.0"
66
+ "open": "^10.0.0",
67
+ "pac-resolver": "^7.0.1",
68
+ "socks-proxy-agent": "^8.0.5"
65
69
  },
66
70
  "devDependencies": {
67
71
  "@playwright/test": "^1.54.2",
@@ -101,7 +105,11 @@
101
105
  "open"
102
106
  ],
103
107
  "external": [
104
- "node:*"
108
+ "node:*",
109
+ "@tootallnate/quickjs-emscripten",
110
+ "pac-resolver",
111
+ "socks-proxy-agent",
112
+ "https-proxy-agent"
105
113
  ],
106
114
  "minify": false,
107
115
  "sourcemap": false,