@automattic/mcp-wordpress-remote 0.4.0 → 0.5.0
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 +17 -7
- package/dist/lib.d.ts +11 -23
- package/dist/lib.js +36558 -8066
- package/dist/proxy.js +46476 -25842
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MCP WordPress Remote
|
|
2
2
|
|
|
3
|
-
**A
|
|
3
|
+
**A stdio-to-HTTP pass-through proxy for WordPress MCP servers**
|
|
4
4
|
|
|
5
5
|
Connect AI assistants like Claude Desktop to your WordPress sites with multiple authentication methods including OAuth 2.0, JWT tokens, and application passwords.
|
|
6
6
|
|
|
@@ -102,7 +102,7 @@ Custom headers are included in:
|
|
|
102
102
|
|
|
103
103
|
1. **Start your MCP client** (Claude Desktop, etc.)
|
|
104
104
|
2. **Choose authentication method** based on your preference:
|
|
105
|
-
- **OAuth 2.0
|
|
105
|
+
- **OAuth 2.0**: Enable `OAUTH_ENABLED=true` to open the browser for authorization
|
|
106
106
|
- **JWT Token**: Set `JWT_TOKEN` environment variable
|
|
107
107
|
- **Application Password**: Set `WP_API_USERNAME` and `WP_API_PASSWORD`
|
|
108
108
|
3. **Start using WordPress features** in your AI assistant
|
|
@@ -111,9 +111,17 @@ Custom headers are included in:
|
|
|
111
111
|
|
|
112
112
|
Install the [MCP Adapter](https://github.com/WordPress/mcp-adapter) plugin on your WordPress site. Once active, it registers a default MCP server at `/wp-json/mcp/mcp-adapter-default-server` — set `WP_API_URL` to that full URL (examples throughout this README show the pattern). To target a custom server id or namespace, pass the full URL of that server instead.
|
|
113
113
|
|
|
114
|
-
###
|
|
114
|
+
### Forwarding behavior
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
The proxy forwards the MCP client's messages to the configured endpoint and returns the server's messages. It does not send its own initialization probe, select an MCP version, or register a fixed set of methods. The client and server own version negotiation, capabilities, and result validation. Requests, notifications, server requests, IDs, and metadata travel through the bridge; JSON and SSE responses are supported.
|
|
117
|
+
|
|
118
|
+
For initialization-based MCP connections, the server's selected version and session ID are used in subsequent HTTP headers. Requests carrying `io.modelcontextprotocol/protocolVersion` in `params._meta` use that version directly and do not require a proxy-generated handshake. This removes the proxy's version allowlist; it does not translate between protocol revisions or establish full compliance with every newer transport feature.
|
|
119
|
+
|
|
120
|
+
Existing authentication, custom headers, timeout, logging, token-storage, and system-proxy settings remain available. A bare-domain `WP_API_URL` now resolves to `/?rest_route=/mcp/mcp-adapter-default-server`. Full endpoint URLs remain configurable. The archived `wordpress-mcp` plugin's method-only request format and automatic transport fallback have been removed.
|
|
121
|
+
|
|
122
|
+
If the upstream connection fails during initialization, the proxy retains its degraded response with `experimental.connectionFailed` and no usable capabilities, using the client's offered version. Follow-up requests are rejected locally. Server-generated JSON-RPC errors are forwarded rather than converted to a successful handshake. The proxy does not silently reinitialize or retry failed client requests.
|
|
123
|
+
|
|
124
|
+
Tool-call hooks and `wpRequest` from the `/lib` bundle share the live authenticated connection when the proxy is running. Hook responses remain internal and hook failures cannot change the client response. Standalone `wpRequest` retains its result-returning interface and optional session recovery; both its existing argument shapes are encoded as standard JSON-RPC.
|
|
117
125
|
|
|
118
126
|
## Authentication Methods
|
|
119
127
|
|
|
@@ -248,10 +256,11 @@ For WooCommerce-specific tools and reports:
|
|
|
248
256
|
|
|
249
257
|
| Variable | Description | Default | Required |
|
|
250
258
|
| ----------------------------- | ------------------------------------------------ | -------------------- | --------------------- |
|
|
251
|
-
| `WP_API_URL` | WordPress site URL including the MCP endpoint path (e.g. `…/wp-json/mcp/mcp-adapter-default-server`). A bare domain resolves to the
|
|
252
|
-
| `OAUTH_ENABLED` | Enable OAuth authentication | `
|
|
259
|
+
| `WP_API_URL` | WordPress site URL including the MCP endpoint path (e.g. `…/wp-json/mcp/mcp-adapter-default-server`). A bare domain resolves to the MCP Adapter default server. | - | ✅ |
|
|
260
|
+
| `OAUTH_ENABLED` | Enable OAuth authentication | `false` | - |
|
|
253
261
|
| `OAUTH_CALLBACK_PORT` | OAuth callback port | `7665` | - |
|
|
254
262
|
| `OAUTH_HOST` | OAuth callback hostname | `127.0.0.1` | - |
|
|
263
|
+
| `OAUTH_TIMEOUT_MS` | Time to wait for the browser OAuth login (ms) | `30000` | - |
|
|
255
264
|
| `WP_OAUTH_CLIENT_ID` | Custom OAuth client ID | - | - |
|
|
256
265
|
| **OAuth Endpoints** | | | |
|
|
257
266
|
| `OAUTH_AUTHORIZE_ENDPOINT` | OAuth authorization endpoint | - | ✅ (for custom OAuth) |
|
|
@@ -268,7 +277,8 @@ For WooCommerce-specific tools and reports:
|
|
|
268
277
|
| `LOG_LEVEL` | Log level (0-3) | `2` | - |
|
|
269
278
|
| `LOG_TO_STDERR` | Mirror all log levels to stderr (errors always are) | `false` | - |
|
|
270
279
|
| `WP_API_TIMEOUT_MS` | Request timeout for tool calls (ms) | `120000` | - |
|
|
271
|
-
| `WP_API_INIT_TIMEOUT_MS` |
|
|
280
|
+
| `WP_API_INIT_TIMEOUT_MS` | Initialize timeout (ms), after OAuth login | `25000` | - |
|
|
281
|
+
| `PROXY_PAC_TIMEOUT_MS` | Timeout for PAC download and resolver setup (ms) | `5000` | - |
|
|
272
282
|
| **TLS / Certificates** | | | |
|
|
273
283
|
| `NODE_EXTRA_CA_CERTS` | Path to an extra CA file to trust (mkcert/corporate CA) | - | - |
|
|
274
284
|
| `NODE_USE_SYSTEM_CA` | Trust the OS certificate store (Node 22.15+) | - | - |
|
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.
|
|
18
|
+
declare const MCP_WORDPRESS_REMOTE_VERSION = "0.5.0";
|
|
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
|
|
@@ -34,7 +34,7 @@ declare const CONFIG: {
|
|
|
34
34
|
readonly OAUTH_AUTHENTICATE_ENDPOINT: string;
|
|
35
35
|
readonly OAUTH_RESOURCE_INDICATOR: boolean;
|
|
36
36
|
readonly OAUTH_SCOPES: string;
|
|
37
|
-
readonly OAUTH_TIMEOUT:
|
|
37
|
+
readonly OAUTH_TIMEOUT: number;
|
|
38
38
|
readonly LOCK_TIMEOUT: 300000;
|
|
39
39
|
readonly WP_API_TIMEOUT: number;
|
|
40
40
|
readonly WP_API_INIT_TIMEOUT: number;
|
|
@@ -74,7 +74,7 @@ declare const getConfig: () => {
|
|
|
74
74
|
/** Custom OAuth scopes (comma-separated) */
|
|
75
75
|
oauthScopes: string;
|
|
76
76
|
/** OAuth operation timeout in milliseconds */
|
|
77
|
-
oauthTimeout:
|
|
77
|
+
oauthTimeout: number;
|
|
78
78
|
/** Lock operation timeout in milliseconds */
|
|
79
79
|
lockTimeout: 300000;
|
|
80
80
|
/** WordPress request timeout in milliseconds (tool calls and non-init requests) */
|
|
@@ -155,6 +155,12 @@ declare const logger: {
|
|
|
155
155
|
config: (message: string, level?: LogLevel, ...args: any[]) => void;
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Send one request to WordPress. While the proxy is running, the request rides its live
|
|
160
|
+
* connection, and session recovery is left to the connected client.
|
|
161
|
+
*
|
|
162
|
+
* @param useJsonRpc Deprecated and ignored; requests are always sent as JSON-RPC.
|
|
163
|
+
*/
|
|
158
164
|
declare function wpRequest(requestData: any, useJsonRpc?: boolean, options?: {
|
|
159
165
|
allowSessionRecovery?: boolean;
|
|
160
166
|
}): Promise<WordPressResponse>;
|
|
@@ -235,12 +241,6 @@ declare function isConfigError(error: any): error is ConfigError;
|
|
|
235
241
|
declare function isAuthError(error: any): error is AuthError;
|
|
236
242
|
declare function isAPIError(error: any): error is APIError;
|
|
237
243
|
|
|
238
|
-
/**
|
|
239
|
-
* Fetch API utilities for MCP WordPress Remote
|
|
240
|
-
*
|
|
241
|
-
* Provides fetch polyfill setup for Node.js environments that don't have native fetch
|
|
242
|
-
* and proxy-aware fetch for routing through system proxies (PAC files, env-based SOCKS/HTTP proxies)
|
|
243
|
-
*/
|
|
244
244
|
/**
|
|
245
245
|
* Setup fetch polyfill for Node.js 18+ compatibility
|
|
246
246
|
*
|
|
@@ -327,17 +327,6 @@ declare function isProxyConfigured(): boolean;
|
|
|
327
327
|
*/
|
|
328
328
|
declare function getProxyType(): 'pac' | 'env' | 'none';
|
|
329
329
|
|
|
330
|
-
/**
|
|
331
|
-
* MCP Request Types for WordPress Remote Proxy
|
|
332
|
-
*
|
|
333
|
-
* Type definitions for all MCP JSON-RPC request schemas
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
interface WPRequestParams {
|
|
337
|
-
method: string;
|
|
338
|
-
[key: string]: unknown;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
330
|
/**
|
|
342
331
|
* Tool-call hooks for MCP WordPress Remote.
|
|
343
332
|
*
|
|
@@ -356,11 +345,10 @@ interface ToolCallContext {
|
|
|
356
345
|
name: string;
|
|
357
346
|
/**
|
|
358
347
|
* Dispatch an additional request over the proxy's live, authenticated
|
|
359
|
-
* session. The request is prepared
|
|
360
|
-
* (JSON-RPC envelope or simple format) before it is sent, e.g.
|
|
348
|
+
* session. The request is prepared as JSON-RPC before it is sent, e.g.
|
|
361
349
|
* `wpRequest({ method: 'tools/call', name, arguments })`.
|
|
362
350
|
*/
|
|
363
|
-
wpRequest: (params:
|
|
351
|
+
wpRequest: (params: WordPressRequestParams) => Promise<WordPressResponse>;
|
|
364
352
|
}
|
|
365
353
|
/** A hook fired after each completed `tools/call`. May be async. */
|
|
366
354
|
type ToolCallHook = (context: ToolCallContext) => void | Promise<void>;
|