@automattic/mcp-wordpress-remote 0.1.13 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +32 -2
  2. package/dist/proxy.js +17 -4
  3. package/package.json +77 -74
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  The mcp-wordpress-remote package acts as a bridge between local Model Context Protocol (MCP) clients and remote WordPress MCP servers. By leveraging npx, you can execute this package without a global installation, simplifying the setup process.
4
4
 
5
+ ## Requirements
6
+
7
+ - Node.js version 22 or higher
8
+
5
9
  ## WordPress MCP plugin
6
10
 
7
11
  You have to install the [wordpress-mcp](https://github.com/Automattic/wordpress-mcp) plugin on your WordPress website, and enable MCP Functionality on Settings > MCP Settings.
@@ -43,7 +47,7 @@ Example configuration:
43
47
  "mcpServers": {
44
48
  "wordpress-mcp": {
45
49
  "command": "npx",
46
- "args": ["-y", "@automattic/mcp-wordpress-remote"],
50
+ "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
47
51
  "env": {
48
52
  "WP_API_URL": "https://your-wordpress-site.com",
49
53
  "WP_API_USERNAME": "your-username",
@@ -70,7 +74,7 @@ Example configuration:
70
74
  "mcpServers": {
71
75
  "wordpress-mcp": {
72
76
  "command": "npx",
73
- "args": ["-y", "@automattic/mcp-wordpress-remote"],
77
+ "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
74
78
  "env": {
75
79
  "WP_API_URL": "https://your-wordpress-site.com",
76
80
  "WP_API_USERNAME": "your-username",
@@ -84,6 +88,32 @@ Example configuration:
84
88
  }
85
89
  ```
86
90
 
91
+ #### VS Code
92
+
93
+ The configuration file can be created inside `.vscode/mcp.json` in your workspace/folder.
94
+
95
+ ```json
96
+ {
97
+ "servers": {
98
+ "wordpress-mcp": {
99
+ "type": "stdio",
100
+ "command": "npx",
101
+ "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
102
+ "env": {
103
+ "WP_API_URL": "https://your-wordpress-site.com",
104
+ "WP_API_USERNAME": "your-username",
105
+ "WP_API_PASSWORD": "your-password",
106
+ "WOO_CUSTOMER_KEY": "your-woo-customer-key",
107
+ "WOO_CUSTOMER_SECRET": "your-woo-customer-secret",
108
+ "LOG_FILE": "optional full path to the log file"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ More information on VS Code and MCP is available in the [VS Code docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
116
+
87
117
  ## @todo
88
118
 
89
119
  As of now, this package is in its early development stages. Any suggestions, bugreports, PR's are welcome.
package/dist/proxy.js CHANGED
@@ -8,9 +8,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
8
8
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
9
9
  import * as fs from "node:fs";
10
10
  import * as path from "node:path";
11
- var LOG_DIR = process.env.LOG_DIR || path.join(process.cwd(), "logs");
12
- var LOG_FILE = process.env.LOG_FILE || path.join(LOG_DIR, "mcp-proxy.log");
13
- if (process.env.LOG_FILE || process.env.LOG_DIR) {
11
+ var LOG_FILE = process.env.LOG_FILE || null;
12
+ if (LOG_FILE) {
14
13
  const logDir = path.dirname(LOG_FILE);
15
14
  if (!fs.existsSync(logDir)) {
16
15
  fs.mkdirSync(logDir, { recursive: true });
@@ -21,7 +20,7 @@ function log(message, ...args) {
21
20
  const formattedArgs = args.length > 0 ? args.map((arg) => typeof arg === "object" ? JSON.stringify(arg) : arg).join(" ") : "";
22
21
  const logMessage = `${timestamp}: ${message}${formattedArgs ? " " + formattedArgs : ""}
23
22
  `;
24
- if (process.env.LOG_FILE || process.env.LOG_DIR) {
23
+ if (LOG_FILE) {
25
24
  fs.appendFileSync(LOG_FILE, logMessage);
26
25
  }
27
26
  }
@@ -114,6 +113,20 @@ import {
114
113
  CompleteRequestSchema,
115
114
  ListRootsRequestSchema
116
115
  } from "@modelcontextprotocol/sdk/types.js";
116
+ var requiredNodeVersion = 22;
117
+ var currentNodeVersion = parseInt(process.version.slice(1).split(".")[0]);
118
+ if (currentNodeVersion < requiredNodeVersion) {
119
+ log(`Error: This application requires Node.js version ${requiredNodeVersion} or higher.`);
120
+ log(`Current version: ${process.version}`);
121
+ process.exit(1);
122
+ }
123
+ if (typeof globalThis.fetch !== "function") {
124
+ log(
125
+ "Error: This application requires the fetch API, which is not available in your Node.js environment."
126
+ );
127
+ log("Please ensure you are using Node.js 22 or later, or install node-fetch.");
128
+ process.exit(1);
129
+ }
117
130
  async function WordPressProxy() {
118
131
  const init = await wpRequest({ method: "init" });
119
132
  const server = new Server(
package/package.json CHANGED
@@ -1,75 +1,78 @@
1
1
  {
2
- "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.1.13",
4
- "description": "MCP WordPress Remote proxy server",
5
- "keywords": [
6
- "mcp",
7
- "wordpress",
8
- "remote",
9
- "proxy"
10
- ],
11
- "author": "Automattic Inc.",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/Automattic/mcp-wordpress-remote.git"
15
- },
16
- "type": "module",
17
- "files": [
18
- "dist",
19
- "README.md",
20
- "LICENSE"
21
- ],
22
- "main": "dist/proxy.js",
23
- "bin": {
24
- "@automattic/mcp-wordpress-remote": "dist/proxy.js"
25
- },
26
- "scripts": {
27
- "build": "tsup",
28
- "build:watch": "tsup --watch",
29
- "check": "prettier --check . && tsc",
30
- "start": "NODE_ENV=development tsup --watch",
31
- "dev": "NODE_ENV=development node dist/proxy.js",
32
- "test": "jest",
33
- "test:watch": "jest --watch"
34
- },
35
- "dependencies": {
36
- "@modelcontextprotocol/sdk": "^1.8.0",
37
- "express": "^4.18.2",
38
- "open": "^10.0.0"
39
- },
40
- "devDependencies": {
41
- "@types/express": "^4.17.21",
42
- "@types/jest": "^29.5.12",
43
- "@types/node": "^20.11.19",
44
- "jest": "^29.7.0",
45
- "prettier": "^3.2.5",
46
- "ts-jest": "^29.1.2",
47
- "tsup": "^8.0.2",
48
- "typescript": "^5.3.3"
49
- },
50
- "tsup": {
51
- "entry": [
52
- "src/proxy.ts"
53
- ],
54
- "format": [
55
- "esm"
56
- ],
57
- "dts": true,
58
- "clean": true,
59
- "outDir": "dist"
60
- },
61
- "jest": {
62
- "preset": "ts-jest",
63
- "testEnvironment": "node",
64
- "testMatch": [
65
- "**/__tests__/**/*.ts",
66
- "**/?(*.)+(spec|test).ts"
67
- ],
68
- "moduleFileExtensions": [
69
- "ts",
70
- "js",
71
- "json",
72
- "node"
73
- ]
74
- }
75
- }
2
+ "name": "@automattic/mcp-wordpress-remote",
3
+ "version": "0.1.18",
4
+ "description": "MCP WordPress Remote proxy server",
5
+ "engines": {
6
+ "node": ">=22.0.0"
7
+ },
8
+ "keywords": [
9
+ "mcp",
10
+ "wordpress",
11
+ "remote",
12
+ "proxy"
13
+ ],
14
+ "author": "Automattic Inc.",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Automattic/mcp-wordpress-remote.git"
18
+ },
19
+ "type": "module",
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "main": "dist/proxy.js",
26
+ "bin": {
27
+ "@automattic/mcp-wordpress-remote": "dist/proxy.js"
28
+ },
29
+ "scripts": {
30
+ "build": "tsup",
31
+ "build:watch": "tsup --watch",
32
+ "check": "prettier --check . && tsc",
33
+ "start": "NODE_ENV=development tsup --watch",
34
+ "dev": "NODE_ENV=development node dist/proxy.js",
35
+ "test": "jest",
36
+ "test:watch": "jest --watch"
37
+ },
38
+ "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^1.8.0",
40
+ "express": "^4.18.2",
41
+ "open": "^10.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/express": "^4.17.21",
45
+ "@types/jest": "^29.5.12",
46
+ "@types/node": "^20.11.19",
47
+ "jest": "^29.7.0",
48
+ "prettier": "^3.2.5",
49
+ "ts-jest": "^29.1.2",
50
+ "tsup": "^8.0.2",
51
+ "typescript": "^5.3.3"
52
+ },
53
+ "tsup": {
54
+ "entry": [
55
+ "src/proxy.ts"
56
+ ],
57
+ "format": [
58
+ "esm"
59
+ ],
60
+ "dts": true,
61
+ "clean": true,
62
+ "outDir": "dist"
63
+ },
64
+ "jest": {
65
+ "preset": "ts-jest",
66
+ "testEnvironment": "node",
67
+ "testMatch": [
68
+ "**/__tests__/**/*.ts",
69
+ "**/?(*.)+(spec|test).ts"
70
+ ],
71
+ "moduleFileExtensions": [
72
+ "ts",
73
+ "js",
74
+ "json",
75
+ "node"
76
+ ]
77
+ }
78
+ }