@automattic/mcp-wordpress-remote 0.2.16 → 0.2.18
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 +19 -2
- package/dist/lib.js +28809 -2102
- package/dist/proxy.js +290 -53
- package/package.json +1 -1
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,7 +12,7 @@ interface WordPressResponse {
|
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.
|
|
15
|
+
declare const MCP_WORDPRESS_REMOTE_VERSION = "0.2.18";
|
|
16
16
|
/**
|
|
17
17
|
* Centralized configuration for MCP WordPress Remote
|
|
18
18
|
* All default values are defined here and can be overridden via environment variables
|
|
@@ -40,6 +40,7 @@ declare const CONFIG: {
|
|
|
40
40
|
readonly JWT_TOKEN: string | undefined;
|
|
41
41
|
readonly WOO_CUSTOMER_KEY: string | undefined;
|
|
42
42
|
readonly WOO_CUSTOMER_SECRET: string | undefined;
|
|
43
|
+
readonly CUSTOM_HEADERS: string;
|
|
43
44
|
readonly NODE_ENV: string;
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
@@ -84,6 +85,8 @@ declare const getConfig: () => {
|
|
|
84
85
|
wooCustomerKey: string | undefined;
|
|
85
86
|
/** WooCommerce customer secret */
|
|
86
87
|
wooCustomerSecret: string | undefined;
|
|
88
|
+
/** Custom headers for API requests */
|
|
89
|
+
customHeaders: string;
|
|
87
90
|
/** Current environment */
|
|
88
91
|
nodeEnv: string;
|
|
89
92
|
};
|
|
@@ -91,6 +94,18 @@ declare const getConfig: () => {
|
|
|
91
94
|
* Get default OAuth scopes
|
|
92
95
|
*/
|
|
93
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>;
|
|
94
109
|
/**
|
|
95
110
|
* Validation function for required configuration
|
|
96
111
|
*/
|
|
@@ -128,6 +143,8 @@ declare const logger: {
|
|
|
128
143
|
config: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
129
144
|
};
|
|
130
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 };
|