@automattic/mcp-wordpress-remote 0.2.14 → 0.2.16

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.
Files changed (4) hide show
  1. package/dist/lib.d.ts +30 -30
  2. package/dist/lib.js +45 -43
  3. package/dist/proxy.js +28848 -28757
  4. package/package.json +5 -2
package/dist/lib.d.ts CHANGED
@@ -12,36 +12,7 @@ interface WordPressResponse {
12
12
  [key: string]: any;
13
13
  }
14
14
 
15
- declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.1";
16
- declare enum LogLevel {
17
- ERROR = 0,
18
- WARN = 1,
19
- INFO = 2,
20
- DEBUG = 3
21
- }
22
- /**
23
- * Enhanced logging function with levels and categories
24
- *
25
- * @param message - The message to log
26
- * @param level - Log level (default: INFO)
27
- * @param category - Log category for filtering (default: 'GENERAL')
28
- * @param args - Additional arguments to log
29
- */
30
- declare function log(message: string, level?: LogLevel, category?: string, ...args: any[]): void;
31
- /**
32
- * Convenience logging functions
33
- */
34
- declare const logger: {
35
- error: (message: string, category?: string, ...args: any[]) => void;
36
- warn: (message: string, category?: string, ...args: any[]) => void;
37
- info: (message: string, category?: string, ...args: any[]) => void;
38
- debug: (message: string, category?: string, ...args: any[]) => void;
39
- auth: (message: string, level?: LogLevel, ...args: any[]) => void;
40
- oauth: (message: string, level?: LogLevel, ...args: any[]) => void;
41
- api: (message: string, level?: LogLevel, ...args: any[]) => void;
42
- config: (message: string, level?: LogLevel, ...args: any[]) => void;
43
- };
44
-
15
+ declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.16";
45
16
  /**
46
17
  * Centralized configuration for MCP WordPress Remote
47
18
  * All default values are defined here and can be overridden via environment variables
@@ -128,6 +99,35 @@ declare function validateConfig(): {
128
99
  errors: string[];
129
100
  };
130
101
 
102
+ declare enum LogLevel {
103
+ ERROR = 0,
104
+ WARN = 1,
105
+ INFO = 2,
106
+ DEBUG = 3
107
+ }
108
+ /**
109
+ * Enhanced logging function with levels and categories
110
+ *
111
+ * @param message - The message to log
112
+ * @param level - Log level (default: INFO)
113
+ * @param category - Log category for filtering (default: 'GENERAL')
114
+ * @param args - Additional arguments to log
115
+ */
116
+ declare function log(message: string, level?: LogLevel, category?: string, ...args: any[]): void;
117
+ /**
118
+ * Convenience logging functions
119
+ */
120
+ declare const logger: {
121
+ error: (message: string, category?: string, ...args: any[]) => void;
122
+ warn: (message: string, category?: string, ...args: any[]) => void;
123
+ info: (message: string, category?: string, ...args: any[]) => void;
124
+ debug: (message: string, category?: string, ...args: any[]) => void;
125
+ auth: (message: string, level?: LogLevel, ...args: any[]) => void;
126
+ oauth: (message: string, level?: LogLevel, ...args: any[]) => void;
127
+ api: (message: string, level?: LogLevel, ...args: any[]) => void;
128
+ config: (message: string, level?: LogLevel, ...args: any[]) => void;
129
+ };
130
+
131
131
  /**
132
132
  * WordPress OAuth types and error definitions
133
133
  * Updated for MCP Authorization specification 2025-06-18 compliance
package/dist/lib.js CHANGED
@@ -4851,51 +4851,11 @@ var OAuthTokenRevocationRequestSchema = z.object({
4851
4851
 
4852
4852
  // src/lib/utils.ts
4853
4853
  import * as fs from "node:fs";
4854
- import * as path from "node:path";
4855
- var MCP_WORDPRESS_REMOTE_VERSION = "0.2.1";
4856
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
4857
- LogLevel2[LogLevel2["ERROR"] = 0] = "ERROR";
4858
- LogLevel2[LogLevel2["WARN"] = 1] = "WARN";
4859
- LogLevel2[LogLevel2["INFO"] = 2] = "INFO";
4860
- LogLevel2[LogLevel2["DEBUG"] = 3] = "DEBUG";
4861
- return LogLevel2;
4862
- })(LogLevel || {});
4863
- var CURRENT_LOG_LEVEL = process.env.LOG_LEVEL ? parseInt(process.env.LOG_LEVEL) : (process.env.NODE_ENV || "development") === "development" ? 3 /* DEBUG */ : 2 /* INFO */;
4864
- if (process.env.LOG_FILE) {
4865
- const logDir = path.dirname(process.env.LOG_FILE);
4866
- if (!fs.existsSync(logDir)) {
4867
- fs.mkdirSync(logDir, { recursive: true });
4868
- }
4869
- }
4870
- function log(message, level = 2 /* INFO */, category = "GENERAL", ...args) {
4871
- if (level > CURRENT_LOG_LEVEL) {
4872
- return;
4873
- }
4874
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
4875
- const levelName = LogLevel[level];
4876
- const formattedArgs = args.length > 0 ? args.map((arg) => typeof arg === "object" ? JSON.stringify(arg, null, 2) : arg).join(" ") : "";
4877
- const logMessage = `${timestamp} [${levelName}] [${category}] ${message}${formattedArgs ? "\n" + formattedArgs : ""}
4878
- `;
4879
- process.stderr.write(logMessage);
4880
- if (process.env.LOG_FILE) {
4881
- fs.appendFileSync(process.env.LOG_FILE, logMessage);
4882
- }
4883
- }
4884
- var logger = {
4885
- error: (message, category = "ERROR", ...args) => log(message, 0 /* ERROR */, category, ...args),
4886
- warn: (message, category = "WARN", ...args) => log(message, 1 /* WARN */, category, ...args),
4887
- info: (message, category = "INFO", ...args) => log(message, 2 /* INFO */, category, ...args),
4888
- debug: (message, category = "DEBUG", ...args) => log(message, 3 /* DEBUG */, category, ...args),
4889
- // Specialized category loggers
4890
- auth: (message, level = 2 /* INFO */, ...args) => log(message, level, "AUTH", ...args),
4891
- oauth: (message, level = 2 /* INFO */, ...args) => log(message, level, "OAUTH", ...args),
4892
- api: (message, level = 2 /* INFO */, ...args) => log(message, level, "API", ...args),
4893
- config: (message, level = 2 /* INFO */, ...args) => log(message, level, "CONFIG", ...args)
4894
- };
4854
+ import * as path2 from "node:path";
4895
4855
 
4896
4856
  // src/lib/config.ts
4897
4857
  import * as os from "os";
4898
- import * as path2 from "path";
4858
+ import * as path from "path";
4899
4859
 
4900
4860
  // src/lib/port-utils.ts
4901
4861
  var OAuthClientInfoSchema = z.object({
@@ -4905,6 +4865,7 @@ var OAuthClientInfoSchema = z.object({
4905
4865
  });
4906
4866
 
4907
4867
  // src/lib/config.ts
4868
+ var MCP_WORDPRESS_REMOTE_VERSION = "0.2.16";
4908
4869
  var CONFIG = {
4909
4870
  // API Configuration
4910
4871
  WP_API_URL: process.env.WP_API_URL || "https://example.com",
@@ -4941,7 +4902,7 @@ var CONFIG = {
4941
4902
  LOCK_TIMEOUT: 3e5,
4942
4903
  // 5 minutes
4943
4904
  // Directory Configuration
4944
- WP_MCP_CONFIG_DIR: process.env.WP_MCP_CONFIG_DIR || path2.join(os.homedir(), ".mcp-auth"),
4905
+ WP_MCP_CONFIG_DIR: process.env.WP_MCP_CONFIG_DIR || path.join(os.homedir(), ".mcp-auth"),
4945
4906
  // Logging Configuration
4946
4907
  LOG_FILE: process.env.LOG_FILE || null,
4947
4908
  // Authentication Configuration (legacy support)
@@ -5055,6 +5016,47 @@ function formatConfigError(error) {
5055
5016
  return error;
5056
5017
  }
5057
5018
 
5019
+ // src/lib/utils.ts
5020
+ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
5021
+ LogLevel2[LogLevel2["ERROR"] = 0] = "ERROR";
5022
+ LogLevel2[LogLevel2["WARN"] = 1] = "WARN";
5023
+ LogLevel2[LogLevel2["INFO"] = 2] = "INFO";
5024
+ LogLevel2[LogLevel2["DEBUG"] = 3] = "DEBUG";
5025
+ return LogLevel2;
5026
+ })(LogLevel || {});
5027
+ var CURRENT_LOG_LEVEL = process.env.LOG_LEVEL ? parseInt(process.env.LOG_LEVEL) : (process.env.NODE_ENV || "development") === "development" ? 3 /* DEBUG */ : 2 /* INFO */;
5028
+ if (process.env.LOG_FILE) {
5029
+ const logDir = path2.dirname(process.env.LOG_FILE);
5030
+ if (!fs.existsSync(logDir)) {
5031
+ fs.mkdirSync(logDir, { recursive: true });
5032
+ }
5033
+ }
5034
+ function log(message, level = 2 /* INFO */, category = "GENERAL", ...args) {
5035
+ if (level > CURRENT_LOG_LEVEL) {
5036
+ return;
5037
+ }
5038
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
5039
+ const levelName = LogLevel[level];
5040
+ const formattedArgs = args.length > 0 ? args.map((arg) => typeof arg === "object" ? JSON.stringify(arg, null, 2) : arg).join(" ") : "";
5041
+ const logMessage = `${timestamp} [${levelName}] [${category}] ${message}${formattedArgs ? "\n" + formattedArgs : ""}
5042
+ `;
5043
+ process.stderr.write(logMessage);
5044
+ if (process.env.LOG_FILE) {
5045
+ fs.appendFileSync(process.env.LOG_FILE, logMessage);
5046
+ }
5047
+ }
5048
+ var logger = {
5049
+ error: (message, category = "ERROR", ...args) => log(message, 0 /* ERROR */, category, ...args),
5050
+ warn: (message, category = "WARN", ...args) => log(message, 1 /* WARN */, category, ...args),
5051
+ info: (message, category = "INFO", ...args) => log(message, 2 /* INFO */, category, ...args),
5052
+ debug: (message, category = "DEBUG", ...args) => log(message, 3 /* DEBUG */, category, ...args),
5053
+ // Specialized category loggers
5054
+ auth: (message, level = 2 /* INFO */, ...args) => log(message, level, "AUTH", ...args),
5055
+ oauth: (message, level = 2 /* INFO */, ...args) => log(message, level, "OAUTH", ...args),
5056
+ api: (message, level = 2 /* INFO */, ...args) => log(message, level, "API", ...args),
5057
+ config: (message, level = 2 /* INFO */, ...args) => log(message, level, "CONFIG", ...args)
5058
+ };
5059
+
5058
5060
  // src/lib/oauth-types.ts
5059
5061
  var OAuthError = class _OAuthError extends Error {
5060
5062
  constructor(message, code = "OAUTH_ERROR", details) {