@automattic/mcp-wordpress-remote 0.2.15 → 0.2.17
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 +49 -0
- package/dist/lib.d.ts +48 -31
- package/dist/lib.js +29058 -2351
- package/dist/proxy.js +28980 -28808
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -45,6 +45,55 @@ Add to your MCP client configuration (e.g., Claude Desktop's `claude_desktop_con
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### Custom Headers
|
|
49
|
+
|
|
50
|
+
You can add custom headers to all API requests using the `CUSTOM_HEADERS` environment variable. This is useful for API keys, custom authentication, or other header requirements.
|
|
51
|
+
|
|
52
|
+
#### JSON Format (Recommended):
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"wordpress": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["-y", "@automattic/mcp-wordpress-remote"],
|
|
59
|
+
"env": {
|
|
60
|
+
"WP_API_URL": "https://your-wordpress-site.com",
|
|
61
|
+
"CUSTOM_HEADERS": "{\"X-MCP-API-Key\": \"*Ibo7tweixlbfuwaiufxgakjyefctwajcetb*\", \"X-Custom-Header\": \"value\"}"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Comma-Separated Format:
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"wordpress": {
|
|
73
|
+
"command": "npx",
|
|
74
|
+
"args": ["-y", "@automattic/mcp-wordpress-remote"],
|
|
75
|
+
"env": {
|
|
76
|
+
"WP_API_URL": "https://your-wordpress-site.com",
|
|
77
|
+
"CUSTOM_HEADERS": "X-MCP-API-Key:IOskncfyes78U8on3q7ry43o487tybrc,X-Custom-Header:value"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Command Line Usage:
|
|
85
|
+
```bash
|
|
86
|
+
CUSTOM_HEADERS='{"X-MCP-API-Key": "wc_mcp_FaQduhQcW0mfVaZgP3yaaqDuXaZ3mw7j"}' \
|
|
87
|
+
WP_API_URL="https://your-site.com" \
|
|
88
|
+
npx @automattic/mcp-wordpress-remote
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Custom headers are included in:
|
|
92
|
+
- All WordPress API requests
|
|
93
|
+
- OAuth discovery requests
|
|
94
|
+
- OAuth token exchange requests
|
|
95
|
+
- OAuth client registration requests
|
|
96
|
+
|
|
48
97
|
### First Run
|
|
49
98
|
|
|
50
99
|
1. **Start your MCP client** (Claude Desktop, etc.)
|
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.
|
|
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.17";
|
|
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
|
|
@@ -69,6 +40,7 @@ declare const CONFIG: {
|
|
|
69
40
|
readonly JWT_TOKEN: string | undefined;
|
|
70
41
|
readonly WOO_CUSTOMER_KEY: string | undefined;
|
|
71
42
|
readonly WOO_CUSTOMER_SECRET: string | undefined;
|
|
43
|
+
readonly CUSTOM_HEADERS: string;
|
|
72
44
|
readonly NODE_ENV: string;
|
|
73
45
|
};
|
|
74
46
|
/**
|
|
@@ -113,6 +85,8 @@ declare const getConfig: () => {
|
|
|
113
85
|
wooCustomerKey: string | undefined;
|
|
114
86
|
/** WooCommerce customer secret */
|
|
115
87
|
wooCustomerSecret: string | undefined;
|
|
88
|
+
/** Custom headers for API requests */
|
|
89
|
+
customHeaders: string;
|
|
116
90
|
/** Current environment */
|
|
117
91
|
nodeEnv: string;
|
|
118
92
|
};
|
|
@@ -120,6 +94,18 @@ declare const getConfig: () => {
|
|
|
120
94
|
* Get default OAuth scopes
|
|
121
95
|
*/
|
|
122
96
|
declare function getDefaultOAuthScopes(): string[];
|
|
97
|
+
/**
|
|
98
|
+
* Parse custom headers from environment variable
|
|
99
|
+
* Supports both JSON format and comma-separated format
|
|
100
|
+
*
|
|
101
|
+
* JSON format: {"X-MCP-API-Key": "value", "X-Custom-Header": "value"}
|
|
102
|
+
* Comma format: X-MCP-API-Key:value,X-Custom-Header:value
|
|
103
|
+
*/
|
|
104
|
+
declare function parseCustomHeaders(customHeadersString: string): Record<string, string>;
|
|
105
|
+
/**
|
|
106
|
+
* Get parsed custom headers
|
|
107
|
+
*/
|
|
108
|
+
declare function getCustomHeaders(): Record<string, string>;
|
|
123
109
|
/**
|
|
124
110
|
* Validation function for required configuration
|
|
125
111
|
*/
|
|
@@ -128,6 +114,37 @@ declare function validateConfig(): {
|
|
|
128
114
|
errors: string[];
|
|
129
115
|
};
|
|
130
116
|
|
|
117
|
+
declare enum LogLevel {
|
|
118
|
+
ERROR = 0,
|
|
119
|
+
WARN = 1,
|
|
120
|
+
INFO = 2,
|
|
121
|
+
DEBUG = 3
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Enhanced logging function with levels and categories
|
|
125
|
+
*
|
|
126
|
+
* @param message - The message to log
|
|
127
|
+
* @param level - Log level (default: INFO)
|
|
128
|
+
* @param category - Log category for filtering (default: 'GENERAL')
|
|
129
|
+
* @param args - Additional arguments to log
|
|
130
|
+
*/
|
|
131
|
+
declare function log(message: string, level?: LogLevel, category?: string, ...args: any[]): void;
|
|
132
|
+
/**
|
|
133
|
+
* Convenience logging functions
|
|
134
|
+
*/
|
|
135
|
+
declare const logger: {
|
|
136
|
+
error: (message: string, category?: string, ...args: any[]) => void;
|
|
137
|
+
warn: (message: string, category?: string, ...args: any[]) => void;
|
|
138
|
+
info: (message: string, category?: string, ...args: any[]) => void;
|
|
139
|
+
debug: (message: string, category?: string, ...args: any[]) => void;
|
|
140
|
+
auth: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
141
|
+
oauth: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
142
|
+
api: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
143
|
+
config: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare function wpRequest(requestData: any, useJsonRpc?: boolean): Promise<WordPressResponse>;
|
|
147
|
+
|
|
131
148
|
/**
|
|
132
149
|
* WordPress OAuth types and error definitions
|
|
133
150
|
* Updated for MCP Authorization specification 2025-06-18 compliance
|
|
@@ -202,4 +219,4 @@ declare function isConfigError(error: any): error is ConfigError;
|
|
|
202
219
|
declare function isAuthError(error: any): error is AuthError;
|
|
203
220
|
declare function isAPIError(error: any): error is APIError;
|
|
204
221
|
|
|
205
|
-
export { APIError, AuthError, CONFIG, ConfigError, LogLevel, MCP_WORDPRESS_REMOTE_VERSION, OAuthError, type TokenValidationResult, type WPClientInfo, type WPTokens, type WordPressRequestParams, type WordPressResponse, getConfig, getDefaultOAuthScopes, isAPIError, isAuthError, isConfigError, isOAuthError, log, logger, validateConfig };
|
|
222
|
+
export { APIError, AuthError, CONFIG, ConfigError, LogLevel, MCP_WORDPRESS_REMOTE_VERSION, OAuthError, type TokenValidationResult, type WPClientInfo, type WPTokens, type WordPressRequestParams, type WordPressResponse, getConfig, getCustomHeaders, getDefaultOAuthScopes, isAPIError, isAuthError, isConfigError, isOAuthError, log, logger, parseCustomHeaders, validateConfig, wpRequest };
|