mcp-wordpress 2.10.1 → 2.10.3

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 (198) hide show
  1. package/README.md +17 -19
  2. package/bin/mcp-wordpress.js +3 -3
  3. package/bin/setup.js +140 -141
  4. package/bin/status.js +112 -114
  5. package/dist/client/MockWordPressClient.d.ts.map +1 -1
  6. package/dist/client/MockWordPressClient.js.map +1 -1
  7. package/dist/client/SEOWordPressClient.d.ts.map +1 -1
  8. package/dist/client/SEOWordPressClient.js +16 -14
  9. package/dist/client/SEOWordPressClient.js.map +1 -1
  10. package/dist/client/index.d.ts +6 -6
  11. package/dist/client/index.js +6 -6
  12. package/dist/client/managers/AuthManager.d.ts.map +1 -1
  13. package/dist/client/managers/AuthManager.js +2 -2
  14. package/dist/client/managers/AuthManager.js.map +1 -1
  15. package/dist/client/managers/AuthenticationManager.js +1 -1
  16. package/dist/client/managers/JWTAuthImplementation.d.ts.map +1 -1
  17. package/dist/client/managers/JWTAuthImplementation.js +7 -7
  18. package/dist/client/managers/JWTAuthImplementation.js.map +1 -1
  19. package/dist/client/managers/composed/MigrationAdapter.js +1 -1
  20. package/dist/client/managers/composed/index.d.ts +2 -2
  21. package/dist/client/managers/composed/index.d.ts.map +1 -1
  22. package/dist/client/managers/composed/index.js +1 -1
  23. package/dist/client/managers/composed/index.js.map +1 -1
  24. package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts.map +1 -1
  25. package/dist/client/managers/implementations/ErrorHandlerImpl.js +2 -4
  26. package/dist/client/managers/implementations/ErrorHandlerImpl.js.map +1 -1
  27. package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts.map +1 -1
  28. package/dist/client/managers/implementations/ParameterValidatorImpl.js +1 -1
  29. package/dist/client/managers/implementations/ParameterValidatorImpl.js.map +1 -1
  30. package/dist/client/managers/interfaces/ManagerInterfaces.d.ts.map +1 -1
  31. package/dist/config/index.d.ts +3 -3
  32. package/dist/config/index.js +3 -3
  33. package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
  34. package/dist/docs/MarkdownFormatter.js +7 -7
  35. package/dist/docs/MarkdownFormatter.js.map +1 -1
  36. package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
  37. package/dist/performance/PerformanceAnalytics.js +3 -1
  38. package/dist/performance/PerformanceAnalytics.js.map +1 -1
  39. package/dist/security/InputValidator.js +1 -1
  40. package/dist/security/SecurityCIPipeline.js +1 -1
  41. package/dist/security/SecurityCIPipeline.js.map +1 -1
  42. package/dist/security/SecurityConfig.d.ts.map +1 -1
  43. package/dist/security/SecurityConfig.js +6 -2
  44. package/dist/security/SecurityConfig.js.map +1 -1
  45. package/dist/server/index.d.ts +2 -2
  46. package/dist/server/index.js +2 -2
  47. package/dist/tools/cache.d.ts.map +1 -1
  48. package/dist/tools/cache.js.map +1 -1
  49. package/dist/tools/comments.d.ts.map +1 -1
  50. package/dist/tools/comments.js.map +1 -1
  51. package/dist/tools/performance.d.ts.map +1 -1
  52. package/dist/tools/performance.js.map +1 -1
  53. package/dist/tools/posts/PostHandlers.d.ts.map +1 -1
  54. package/dist/tools/posts/PostHandlers.js.map +1 -1
  55. package/dist/tools/seo/SEOTools.d.ts.map +1 -1
  56. package/dist/tools/seo/SEOTools.js.map +1 -1
  57. package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts.map +1 -1
  58. package/dist/tools/seo/analyzers/ContentAnalyzer.js.map +1 -1
  59. package/dist/types/enhanced.d.ts +17 -17
  60. package/dist/types/enhanced.d.ts.map +1 -1
  61. package/dist/types/enhanced.js +2 -2
  62. package/dist/types/index.d.ts +2 -2
  63. package/dist/types/index.d.ts.map +1 -1
  64. package/dist/types/requests.d.ts +16 -16
  65. package/dist/types/tools.d.ts +46 -46
  66. package/dist/types/tools.d.ts.map +1 -1
  67. package/dist/utils/index.d.ts +7 -7
  68. package/dist/utils/index.js +7 -7
  69. package/docs/ARCHITECTURE.md +17 -17
  70. package/docs/BADGE_UPDATES.md +11 -11
  71. package/docs/CACHING.md +2 -0
  72. package/docs/CI_CD_IMPROVEMENTS.md +8 -5
  73. package/docs/CONFIGURATION.md +76 -46
  74. package/docs/DOCKER_PUBLISHING_TROUBLESHOOTING.md +11 -2
  75. package/docs/EVALUATION.md +16 -21
  76. package/docs/INCREMENTAL_COVERAGE.md +7 -3
  77. package/docs/INSTALLATION.md +33 -19
  78. package/docs/PUBLISHING-TROUBLESHOOTING.md +3 -2
  79. package/docs/SECURITY.md +17 -15
  80. package/docs/SECURITY_TESTING.md +3 -0
  81. package/docs/TROUBLESHOOTING.md +85 -36
  82. package/docs/api/README.md +118 -125
  83. package/docs/api/categories/auth.md +3 -1
  84. package/docs/api/categories/cache.md +3 -1
  85. package/docs/api/categories/comment.md +3 -1
  86. package/docs/api/categories/media.md +3 -1
  87. package/docs/api/categories/page.md +3 -1
  88. package/docs/api/categories/performance.md +3 -1
  89. package/docs/api/categories/post.md +3 -1
  90. package/docs/api/categories/site.md +3 -1
  91. package/docs/api/categories/taxonomy.md +3 -1
  92. package/docs/api/categories/user.md +3 -1
  93. package/docs/api/openapi.json +114 -410
  94. package/docs/api/summary.json +1 -1
  95. package/docs/api/tools/wp_approve_comment.md +13 -25
  96. package/docs/api/tools/wp_cache_clear.md +17 -30
  97. package/docs/api/tools/wp_cache_info.md +16 -29
  98. package/docs/api/tools/wp_cache_stats.md +16 -29
  99. package/docs/api/tools/wp_cache_warm.md +16 -29
  100. package/docs/api/tools/wp_create_application_password.md +14 -26
  101. package/docs/api/tools/wp_create_category.md +14 -26
  102. package/docs/api/tools/wp_create_comment.md +18 -31
  103. package/docs/api/tools/wp_create_page.md +17 -29
  104. package/docs/api/tools/wp_create_post.md +25 -30
  105. package/docs/api/tools/wp_create_tag.md +13 -25
  106. package/docs/api/tools/wp_create_user.md +18 -30
  107. package/docs/api/tools/wp_delete_application_password.md +14 -26
  108. package/docs/api/tools/wp_delete_category.md +13 -25
  109. package/docs/api/tools/wp_delete_comment.md +14 -26
  110. package/docs/api/tools/wp_delete_media.md +14 -25
  111. package/docs/api/tools/wp_delete_page.md +14 -25
  112. package/docs/api/tools/wp_delete_post.md +17 -25
  113. package/docs/api/tools/wp_delete_tag.md +13 -25
  114. package/docs/api/tools/wp_delete_user.md +14 -25
  115. package/docs/api/tools/wp_get_application_passwords.md +13 -25
  116. package/docs/api/tools/wp_get_auth_status.md +12 -24
  117. package/docs/api/tools/wp_get_category.md +13 -25
  118. package/docs/api/tools/wp_get_comment.md +13 -25
  119. package/docs/api/tools/wp_get_current_user.md +17 -30
  120. package/docs/api/tools/wp_get_media.md +13 -25
  121. package/docs/api/tools/wp_get_page.md +13 -25
  122. package/docs/api/tools/wp_get_page_revisions.md +13 -25
  123. package/docs/api/tools/wp_get_post.md +16 -25
  124. package/docs/api/tools/wp_get_post_revisions.md +13 -25
  125. package/docs/api/tools/wp_get_site_settings.md +12 -23
  126. package/docs/api/tools/wp_get_tag.md +13 -25
  127. package/docs/api/tools/wp_get_user.md +13 -25
  128. package/docs/api/tools/wp_list_categories.md +15 -27
  129. package/docs/api/tools/wp_list_comments.md +15 -27
  130. package/docs/api/tools/wp_list_media.md +18 -31
  131. package/docs/api/tools/wp_list_pages.md +18 -31
  132. package/docs/api/tools/wp_list_posts.md +29 -41
  133. package/docs/api/tools/wp_list_tags.md +14 -26
  134. package/docs/api/tools/wp_list_users.md +20 -34
  135. package/docs/api/tools/wp_performance_alerts.md +22 -36
  136. package/docs/api/tools/wp_performance_benchmark.md +20 -34
  137. package/docs/api/tools/wp_performance_export.md +22 -36
  138. package/docs/api/tools/wp_performance_history.md +21 -35
  139. package/docs/api/tools/wp_performance_optimize.md +22 -36
  140. package/docs/api/tools/wp_performance_stats.md +20 -34
  141. package/docs/api/tools/wp_search_site.md +18 -32
  142. package/docs/api/tools/wp_spam_comment.md +13 -25
  143. package/docs/api/tools/wp_switch_auth_method.md +18 -31
  144. package/docs/api/tools/wp_test_auth.md +15 -30
  145. package/docs/api/tools/wp_update_category.md +14 -26
  146. package/docs/api/tools/wp_update_comment.md +17 -30
  147. package/docs/api/tools/wp_update_media.md +19 -32
  148. package/docs/api/tools/wp_update_page.md +18 -30
  149. package/docs/api/tools/wp_update_post.md +21 -30
  150. package/docs/api/tools/wp_update_site_settings.md +18 -31
  151. package/docs/api/tools/wp_update_tag.md +14 -26
  152. package/docs/api/tools/wp_update_user.md +17 -29
  153. package/docs/api/tools/wp_upload_media.md +20 -32
  154. package/docs/api/types/WordPressPost.md +8 -15
  155. package/docs/code-improvements.md +1 -0
  156. package/docs/developer/GITHUB_ACTIONS_SETUP.md +2 -2
  157. package/docs/developer/MAINTENANCE.md +4 -0
  158. package/docs/developer/NPM_AUTH_SETUP.md +3 -0
  159. package/docs/developer/RELEASE_PROCESS.md +1 -0
  160. package/docs/examples/multi-site-setup.md +2 -0
  161. package/docs/integrations/claude-desktop.md +14 -5
  162. package/docs/integrations/cline.md +1 -0
  163. package/docs/user-guides/DTX_SETUP.md +9 -8
  164. package/docs/user-guides/NPX_SETUP.md +5 -9
  165. package/docs/user-guides/SMITHERY_SETUP.md +5 -0
  166. package/docs/v2.2.0-resolution-demo.md +17 -2
  167. package/package.json +7 -6
  168. package/src/cache/__tests__/CacheManager.test.ts +4 -8
  169. package/src/client/MockWordPressClient.ts +5 -1
  170. package/src/client/SEOWordPressClient.ts +30 -26
  171. package/src/client/index.ts +6 -6
  172. package/src/client/managers/AuthManager.ts +16 -8
  173. package/src/client/managers/AuthenticationManager.ts +2 -2
  174. package/src/client/managers/JWTAuthImplementation.ts +24 -27
  175. package/src/client/managers/ManagersIndex.ts +1 -1
  176. package/src/client/managers/composed/MigrationAdapter.ts +1 -1
  177. package/src/client/managers/composed/index.ts +7 -7
  178. package/src/client/managers/implementations/ErrorHandlerImpl.ts +12 -26
  179. package/src/client/managers/implementations/ParameterValidatorImpl.ts +49 -49
  180. package/src/client/managers/interfaces/ManagerInterfaces.ts +13 -9
  181. package/src/config/index.ts +3 -3
  182. package/src/docs/MarkdownFormatter.ts +13 -9
  183. package/src/performance/PerformanceAnalytics.ts +9 -3
  184. package/src/security/InputValidator.ts +1 -1
  185. package/src/security/SecurityCIPipeline.ts +1 -1
  186. package/src/security/SecurityConfig.ts +9 -3
  187. package/src/server/index.ts +2 -2
  188. package/src/tools/cache.ts +3 -1
  189. package/src/tools/comments.ts +3 -1
  190. package/src/tools/performance.ts +7 -3
  191. package/src/tools/posts/PostHandlers.ts +3 -1
  192. package/src/tools/seo/SEOTools.ts +6 -2
  193. package/src/tools/seo/analyzers/ContentAnalyzer.ts +9 -3
  194. package/src/types/enhanced.ts +34 -34
  195. package/src/types/index.ts +13 -11
  196. package/src/types/requests.ts +19 -19
  197. package/src/types/tools.ts +137 -84
  198. package/src/utils/index.ts +7 -7
package/README.md CHANGED
@@ -101,14 +101,12 @@ Response: "āœ… Authentication successful! Connected to: Your Site Name"
101
101
 
102
102
  **Easiest installation - just 2 clicks!**
103
103
 
104
- 1. **Download**: [`mcp-wordpress.dxt`](https://github.com/docdyhr/mcp-wordpress/releases/latest/download/mcp-wordpress.dxt)
105
- (3.4MB)
104
+ 1. **Download**:
105
+ [`mcp-wordpress.dxt`](https://github.com/docdyhr/mcp-wordpress/releases/latest/download/mcp-wordpress.dxt) (3.4MB)
106
106
  2. **Install**: Claude Desktop → Extensions → Install → Select DXT file
107
107
  3. **Configure**: Enter your WordPress site URL and credentials
108
108
 
109
- āœ… **Zero command line required**
110
- āœ… **Automatic updates**
111
- āœ… **Built-in security**
109
+ āœ… **Zero command line required** āœ… **Automatic updates** āœ… **Built-in security**
112
110
 
113
111
  **[šŸ“– Complete DXT Setup Guide →](docs/integrations/claude-desktop.md)**
114
112
 
@@ -132,9 +130,7 @@ smithery install mcp-wordpress
132
130
  smithery configure mcp-wordpress
133
131
  ```
134
132
 
135
- āœ… **Package management**
136
- āœ… **Version control**
137
- āœ… **Easy updates**
133
+ āœ… **Package management** āœ… **Version control** āœ… **Easy updates**
138
134
 
139
135
  ### Installing via Smithery
140
136
 
@@ -342,15 +338,15 @@ define('JWT_AUTH_CORS_ENABLE', true);
342
338
 
343
339
  ### šŸ† Feature Comparison
344
340
 
345
- | Feature | This Server | Competition |
346
- | -------------------------- | ---------------------- | --------------- |
347
- | **Tools Available** | 59 tools | 20-30 tools |
348
- | **Claude Desktop DXT** | āœ… 2-click install | āŒ Manual setup |
349
- | **Multi-Site Support** | āœ… Unlimited sites | āŒ Single site |
350
- | **TypeScript** | āœ… 100% coverage | āš ļø Partial/None |
351
- | **Performance Monitoring** | āœ… Real-time analytics | āŒ Basic only |
341
+ | Feature | This Server | Competition |
342
+ | -------------------------- | ------------------------------------ | --------------- |
343
+ | **Tools Available** | 59 tools | 20-30 tools |
344
+ | **Claude Desktop DXT** | āœ… 2-click install | āŒ Manual setup |
345
+ | **Multi-Site Support** | āœ… Unlimited sites | āŒ Single site |
346
+ | **TypeScript** | āœ… 100% coverage | āš ļø Partial/None |
347
+ | **Performance Monitoring** | āœ… Real-time analytics | āŒ Basic only |
352
348
  | **Test Coverage** | āœ… 404 tests (100% pass / 30% lines) | āš ļø Limited |
353
- | **Production Ready** | āœ… Security audited | āš ļø Unknown |
349
+ | **Production Ready** | āœ… Security audited | āš ļø Unknown |
354
350
 
355
351
  ### šŸš€ Core Capabilities
356
352
 
@@ -1007,10 +1003,12 @@ npm run security:full
1007
1003
  ### Common Issues
1008
1004
 
1009
1005
  1. **"Cannot connect to WordPress"**
1006
+
1010
1007
  - Verify `WORDPRESS_SITE_URL`
1011
1008
  - Test REST API: `curl https://your-site.com/wp-json/wp/v2/`
1012
1009
 
1013
1010
  2. **"Authentication failed"**
1011
+
1014
1012
  - Check username and application password
1015
1013
  - Ensure Application Passwords are enabled
1016
1014
  - Run `npm run setup` to reconfigure
@@ -1119,9 +1117,9 @@ docker pull docdyhr/mcp-wordpress:1.3.1
1119
1117
 
1120
1118
  **Ready to transform your WordPress management?**
1121
1119
 
1122
- 1. **šŸ† [Download DXT Extension](https://github.com/docdyhr/mcp-wordpress/releases/latest/download/mcp-wordpress.dxt)** -
1123
- Easiest setup
1124
- (2 minutes)
1120
+ 1. **šŸ†
1121
+ [Download DXT Extension](https://github.com/docdyhr/mcp-wordpress/releases/latest/download/mcp-wordpress.dxt)** -
1122
+ Easiest setup (2 minutes)
1125
1123
  2. **⚔ [Try NPX Method](docs/user-guides/NPX_SETUP.md)** - Power user setup (5 minutes)
1126
1124
  3. **šŸ“š [Explore All Tools](docs/api/README.md)** - See what's possible
1127
1125
  4. **šŸ’¬ [Join Discussions](https://github.com/docdyhr/mcp-wordpress/discussions)** - Get help and share ideas
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // NPX wrapper for MCP WordPress Server
4
- import path from 'path';
5
- import { fileURLToPath } from 'url';
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
6
 
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = path.dirname(__filename);
9
9
 
10
10
  // Import and run the main module from dist
11
- const mainModule = path.join(__dirname, '..', 'dist', 'index.js');
11
+ const mainModule = path.join(__dirname, "..", "dist", "index.js");
12
12
  import(mainModule);
package/bin/setup.js CHANGED
@@ -1,39 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { writeFileSync, existsSync } from 'fs';
4
- import { createInterface } from 'readline/promises';
5
- import { fileURLToPath } from 'url';
6
- import { dirname, join } from 'path';
7
- import { execSync } from 'child_process';
8
- import open from 'open';
3
+ import { writeFileSync, existsSync } from "fs";
4
+ import { createInterface } from "readline/promises";
5
+ import { fileURLToPath } from "url";
6
+ import { dirname, join } from "path";
7
+ import { execSync } from "child_process";
8
+ import open from "open";
9
9
 
10
10
  const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = dirname(__filename);
12
- const rootDir = join(__dirname, '..');
12
+ const rootDir = join(__dirname, "..");
13
13
 
14
14
  class WordPressSetup {
15
15
  constructor() {
16
16
  this.rl = createInterface({
17
17
  input: process.stdin,
18
- output: process.stdout
18
+ output: process.stdout,
19
19
  });
20
20
  this.config = {};
21
- this.envPath = join(rootDir, '.env');
21
+ this.envPath = join(rootDir, ".env");
22
22
  }
23
23
 
24
24
  async run() {
25
25
  try {
26
- console.log('šŸ”§ WordPress MCP Server Setup');
27
- console.log('==============================\n');
26
+ console.log("šŸ”§ WordPress MCP Server Setup");
27
+ console.log("==============================\n");
28
28
 
29
29
  await this.detectExistingConfig();
30
30
  await this.gatherConfiguration();
31
31
  await this.testConnection();
32
32
  await this.saveConfiguration();
33
33
  await this.showNextSteps();
34
-
35
34
  } catch (error) {
36
- console.error('āŒ Setup failed:', error.message);
35
+ console.error("āŒ Setup failed:", error.message);
37
36
  process.exit(1);
38
37
  } finally {
39
38
  this.rl.close();
@@ -42,146 +41,145 @@ class WordPressSetup {
42
41
 
43
42
  async detectExistingConfig() {
44
43
  if (existsSync(this.envPath)) {
45
- const answer = await this.rl.question('āš ļø Existing configuration found. Overwrite? (y/N): ');
46
- if (answer.toLowerCase() !== 'y') {
47
- console.log('Setup cancelled.');
44
+ const answer = await this.rl.question("āš ļø Existing configuration found. Overwrite? (y/N): ");
45
+ if (answer.toLowerCase() !== "y") {
46
+ console.log("Setup cancelled.");
48
47
  process.exit(0);
49
48
  }
50
49
  }
51
50
  }
52
51
 
53
52
  async gatherConfiguration() {
54
- console.log('šŸ“ WordPress Site Configuration\n');
53
+ console.log("šŸ“ WordPress Site Configuration\n");
55
54
 
56
55
  // WordPress URL
57
- this.config.WORDPRESS_URL = await this.rl.question('WordPress Site URL (e.g., https://example.com): ');
58
- if (!this.config.WORDPRESS_URL.startsWith('http')) {
59
- this.config.WORDPRESS_URL = 'https://' + this.config.WORDPRESS_URL;
56
+ this.config.WORDPRESS_URL = await this.rl.question("WordPress Site URL (e.g., https://example.com): ");
57
+ if (!this.config.WORDPRESS_URL.startsWith("http")) {
58
+ this.config.WORDPRESS_URL = "https://" + this.config.WORDPRESS_URL;
60
59
  }
61
- this.config.WORDPRESS_URL = this.config.WORDPRESS_URL.replace(/\/$/, '');
60
+ this.config.WORDPRESS_URL = this.config.WORDPRESS_URL.replace(/\/$/, "");
62
61
 
63
62
  // Authentication method
64
- console.log('\nšŸ” Authentication Method:');
65
- console.log('1. Application Password (Recommended)');
66
- console.log('2. Basic Authentication (Username/Password)');
67
- console.log('3. JWT Token');
68
- console.log('4. API Key');
63
+ console.log("\nšŸ” Authentication Method:");
64
+ console.log("1. Application Password (Recommended)");
65
+ console.log("2. Basic Authentication (Username/Password)");
66
+ console.log("3. JWT Token");
67
+ console.log("4. API Key");
69
68
 
70
- const authChoice = await this.rl.question('Choose authentication method (1-4): ');
69
+ const authChoice = await this.rl.question("Choose authentication method (1-4): ");
71
70
 
72
71
  switch (authChoice) {
73
- case '1':
74
- await this.setupApplicationPassword();
75
- break;
76
- case '2':
77
- await this.setupBasicAuth();
78
- break;
79
- case '3':
80
- await this.setupJWT();
81
- break;
82
- case '4':
83
- await this.setupAPIKey();
84
- break;
85
- default:
86
- console.log('Invalid choice, defaulting to Application Password');
87
- await this.setupApplicationPassword();
72
+ case "1":
73
+ await this.setupApplicationPassword();
74
+ break;
75
+ case "2":
76
+ await this.setupBasicAuth();
77
+ break;
78
+ case "3":
79
+ await this.setupJWT();
80
+ break;
81
+ case "4":
82
+ await this.setupAPIKey();
83
+ break;
84
+ default:
85
+ console.log("Invalid choice, defaulting to Application Password");
86
+ await this.setupApplicationPassword();
88
87
  }
89
88
 
90
89
  // Optional settings
91
- console.log('\nāš™ļø Optional Settings:');
92
-
93
- const debugAnswer = await this.rl.question('Enable debug logging? (y/N): ');
94
- this.config.DEBUG = debugAnswer.toLowerCase() === 'y' ? 'true' : 'false';
90
+ console.log("\nāš™ļø Optional Settings:");
91
+
92
+ const debugAnswer = await this.rl.question("Enable debug logging? (y/N): ");
93
+ this.config.DEBUG = debugAnswer.toLowerCase() === "y" ? "true" : "false";
95
94
 
96
- const cacheAnswer = await this.rl.question('Enable caching? (Y/n): ');
97
- this.config.ENABLE_CACHE = cacheAnswer.toLowerCase() === 'n' ? 'false' : 'true';
95
+ const cacheAnswer = await this.rl.question("Enable caching? (Y/n): ");
96
+ this.config.ENABLE_CACHE = cacheAnswer.toLowerCase() === "n" ? "false" : "true";
98
97
 
99
- const rateLimit = await this.rl.question('Rate limit (requests per minute, default 60): ');
100
- this.config.RATE_LIMIT = rateLimit || '60';
98
+ const rateLimit = await this.rl.question("Rate limit (requests per minute, default 60): ");
99
+ this.config.RATE_LIMIT = rateLimit || "60";
101
100
  }
102
101
 
103
102
  async setupApplicationPassword() {
104
- this.config.AUTH_METHOD = 'app-password';
105
- this.config.USERNAME = await this.rl.question('WordPress Username: ');
106
-
107
- console.log('\nšŸ“± Application Password Setup:');
108
- console.log('1. Go to your WordPress admin dashboard');
109
- console.log('2. Navigate to Users > Profile');
103
+ this.config.AUTH_METHOD = "app-password";
104
+ this.config.USERNAME = await this.rl.question("WordPress Username: ");
105
+
106
+ console.log("\nšŸ“± Application Password Setup:");
107
+ console.log("1. Go to your WordPress admin dashboard");
108
+ console.log("2. Navigate to Users > Profile");
110
109
  console.log('3. Scroll to "Application Passwords"');
111
110
  console.log('4. Enter "MCP WordPress Server" as the name');
112
111
  console.log('5. Click "Add New Application Password"');
113
- console.log('6. Copy the generated password (it will only be shown once)');
114
-
115
- const openBrowser = await this.rl.question('\nOpen WordPress admin in browser? (Y/n): ');
116
- if (openBrowser.toLowerCase() !== 'n') {
112
+ console.log("6. Copy the generated password (it will only be shown once)");
113
+
114
+ const openBrowser = await this.rl.question("\nOpen WordPress admin in browser? (Y/n): ");
115
+ if (openBrowser.toLowerCase() !== "n") {
117
116
  try {
118
117
  await open(`${this.config.WORDPRESS_URL}/wp-admin/profile.php#application-passwords-section`);
119
118
  } catch {
120
- console.log('Could not open browser automatically');
119
+ console.log("Could not open browser automatically");
121
120
  }
122
121
  }
123
122
 
124
- this.config.APPLICATION_PASSWORD = await this.rl.question('\nPaste Application Password: ');
123
+ this.config.APPLICATION_PASSWORD = await this.rl.question("\nPaste Application Password: ");
125
124
  }
126
125
 
127
126
  async setupBasicAuth() {
128
- this.config.AUTH_METHOD = 'basic';
129
- this.config.USERNAME = await this.rl.question('WordPress Username: ');
130
- this.config.PASSWORD = await this.rl.question('WordPress Password: ');
131
-
132
- console.log('\nāš ļø Note: Basic authentication may require additional plugin setup');
127
+ this.config.AUTH_METHOD = "basic";
128
+ this.config.USERNAME = await this.rl.question("WordPress Username: ");
129
+ this.config.PASSWORD = await this.rl.question("WordPress Password: ");
130
+
131
+ console.log("\nāš ļø Note: Basic authentication may require additional plugin setup");
133
132
  }
134
133
 
135
134
  async setupJWT() {
136
- this.config.AUTH_METHOD = 'jwt';
137
- this.config.JWT_SECRET = await this.rl.question('JWT Secret Key: ');
138
- this.config.USERNAME = await this.rl.question('WordPress Username: ');
139
- this.config.PASSWORD = await this.rl.question('WordPress Password: ');
140
-
141
- console.log('\nāš ļø Note: JWT authentication requires JWT Authentication plugin');
135
+ this.config.AUTH_METHOD = "jwt";
136
+ this.config.JWT_SECRET = await this.rl.question("JWT Secret Key: ");
137
+ this.config.USERNAME = await this.rl.question("WordPress Username: ");
138
+ this.config.PASSWORD = await this.rl.question("WordPress Password: ");
139
+
140
+ console.log("\nāš ļø Note: JWT authentication requires JWT Authentication plugin");
142
141
  }
143
142
 
144
143
  async setupAPIKey() {
145
- this.config.AUTH_METHOD = 'api-key';
146
- this.config.API_KEY = await this.rl.question('API Key: ');
147
- this.config.API_SECRET = await this.rl.question('API Secret (if required): ');
144
+ this.config.AUTH_METHOD = "api-key";
145
+ this.config.API_KEY = await this.rl.question("API Key: ");
146
+ this.config.API_SECRET = await this.rl.question("API Secret (if required): ");
148
147
  }
149
148
 
150
149
  async ensureBuild() {
151
- console.log('šŸ”Ø Building TypeScript project...');
150
+ console.log("šŸ”Ø Building TypeScript project...");
152
151
  try {
153
- execSync('npm run build', { cwd: rootDir, stdio: 'pipe' });
154
- console.log('āœ… Build successful!');
152
+ execSync("npm run build", { cwd: rootDir, stdio: "pipe" });
153
+ console.log("āœ… Build successful!");
155
154
  } catch (error) {
156
155
  throw new Error('TypeScript build failed. Please run "npm run build" manually.');
157
156
  }
158
157
  }
159
158
 
160
159
  async testConnection() {
161
- console.log('\nšŸ”„ Testing WordPress connection...');
162
-
160
+ console.log("\nšŸ”„ Testing WordPress connection...");
161
+
163
162
  // Ensure TypeScript is compiled
164
163
  await this.ensureBuild();
165
-
164
+
166
165
  try {
167
166
  // Create a temporary client to test connection
168
- const { WordPressClient } = await import('../dist/client/api.js');
167
+ const { WordPressClient } = await import("../dist/client/api.js");
169
168
  const client = new WordPressClient({
170
169
  baseUrl: this.config.WORDPRESS_URL,
171
- auth: this.getAuthConfig()
170
+ auth: this.getAuthConfig(),
172
171
  });
173
172
 
174
173
  await client.authenticate();
175
- const sites = await client.get('/wp/v2/');
176
-
177
- console.log('āœ… Connection successful!');
178
- console.log(` Site: ${sites.name || 'WordPress Site'}`);
174
+ const sites = await client.get("/wp/v2/");
175
+
176
+ console.log("āœ… Connection successful!");
177
+ console.log(` Site: ${sites.name || "WordPress Site"}`);
179
178
  console.log(` URL: ${this.config.WORDPRESS_URL}`);
180
-
181
179
  } catch (error) {
182
- console.log('āŒ Connection failed:', error.message);
183
- const retry = await this.rl.question('Retry with different settings? (y/N): ');
184
- if (retry.toLowerCase() === 'y') {
180
+ console.log("āŒ Connection failed:", error.message);
181
+ const retry = await this.rl.question("Retry with different settings? (y/N): ");
182
+ if (retry.toLowerCase() === "y") {
185
183
  await this.gatherConfiguration();
186
184
  return this.testConnection();
187
185
  }
@@ -191,85 +189,85 @@ class WordPressSetup {
191
189
 
192
190
  getAuthConfig() {
193
191
  switch (this.config.AUTH_METHOD) {
194
- case 'app-password':
195
- return {
196
- method: 'app-password',
197
- username: this.config.USERNAME,
198
- appPassword: this.config.APPLICATION_PASSWORD
199
- };
200
- case 'basic':
201
- return {
202
- method: 'basic',
203
- username: this.config.USERNAME,
204
- password: this.config.PASSWORD
205
- };
206
- case 'jwt':
207
- return {
208
- method: 'jwt',
209
- secret: this.config.JWT_SECRET,
210
- username: this.config.USERNAME,
211
- password: this.config.PASSWORD
212
- };
213
- case 'api-key':
214
- return {
215
- method: 'api-key',
216
- apiKey: this.config.API_KEY,
217
- secret: this.config.API_SECRET
218
- };
219
- default:
220
- throw new Error('Invalid authentication method');
192
+ case "app-password":
193
+ return {
194
+ method: "app-password",
195
+ username: this.config.USERNAME,
196
+ appPassword: this.config.APPLICATION_PASSWORD,
197
+ };
198
+ case "basic":
199
+ return {
200
+ method: "basic",
201
+ username: this.config.USERNAME,
202
+ password: this.config.PASSWORD,
203
+ };
204
+ case "jwt":
205
+ return {
206
+ method: "jwt",
207
+ secret: this.config.JWT_SECRET,
208
+ username: this.config.USERNAME,
209
+ password: this.config.PASSWORD,
210
+ };
211
+ case "api-key":
212
+ return {
213
+ method: "api-key",
214
+ apiKey: this.config.API_KEY,
215
+ secret: this.config.API_SECRET,
216
+ };
217
+ default:
218
+ throw new Error("Invalid authentication method");
221
219
  }
222
220
  }
223
221
 
224
222
  async saveConfiguration() {
225
- console.log('\nšŸ’¾ Saving configuration...');
223
+ console.log("\nšŸ’¾ Saving configuration...");
226
224
 
227
225
  // Map config keys to environment variable names
228
226
  const envVars = {
229
- 'WORDPRESS_SITE_URL': this.config.WORDPRESS_URL,
230
- 'WORDPRESS_USERNAME': this.config.USERNAME,
231
- 'WORDPRESS_AUTH_METHOD': this.config.AUTH_METHOD
227
+ WORDPRESS_SITE_URL: this.config.WORDPRESS_URL,
228
+ WORDPRESS_USERNAME: this.config.USERNAME,
229
+ WORDPRESS_AUTH_METHOD: this.config.AUTH_METHOD,
232
230
  };
233
231
 
234
232
  if (this.config.APPLICATION_PASSWORD) {
235
- envVars['WORDPRESS_APP_PASSWORD'] = this.config.APPLICATION_PASSWORD;
233
+ envVars["WORDPRESS_APP_PASSWORD"] = this.config.APPLICATION_PASSWORD;
236
234
  }
237
235
  if (this.config.PASSWORD) {
238
- envVars['WORDPRESS_PASSWORD'] = this.config.PASSWORD;
236
+ envVars["WORDPRESS_PASSWORD"] = this.config.PASSWORD;
239
237
  }
240
238
  if (this.config.JWT_SECRET) {
241
- envVars['WORDPRESS_JWT_SECRET'] = this.config.JWT_SECRET;
239
+ envVars["WORDPRESS_JWT_SECRET"] = this.config.JWT_SECRET;
242
240
  }
243
241
  if (this.config.API_KEY) {
244
- envVars['WORDPRESS_API_KEY'] = this.config.API_KEY;
242
+ envVars["WORDPRESS_API_KEY"] = this.config.API_KEY;
245
243
  }
246
244
  if (this.config.API_SECRET) {
247
- envVars['WORDPRESS_API_SECRET'] = this.config.API_SECRET;
245
+ envVars["WORDPRESS_API_SECRET"] = this.config.API_SECRET;
248
246
  }
249
247
 
250
248
  const envContent = Object.entries(envVars)
251
249
  .map(([key, value]) => `${key}=${value}`)
252
- .join('\n');
250
+ .join("\n");
253
251
 
254
252
  writeFileSync(this.envPath, envContent);
255
- console.log('āœ… Configuration saved to .env file');
253
+ console.log("āœ… Configuration saved to .env file");
256
254
  }
257
255
 
258
256
  async showNextSteps() {
259
- console.log('\nšŸŽ‰ Setup Complete!');
260
- console.log('==================');
261
- console.log('\nNext steps:');
262
- console.log('1. Test the server: npm run status');
263
- console.log('2. Run integration tests: npm test');
264
- console.log('3. Start the MCP server: npm start');
265
- console.log('\nFor Claude Desktop integration:');
266
- console.log('Add this to your Claude Desktop MCP settings:');
257
+ console.log("\nšŸŽ‰ Setup Complete!");
258
+ console.log("==================");
259
+ console.log("\nNext steps:");
260
+ console.log("1. Test the server: npm run status");
261
+ console.log("2. Run integration tests: npm test");
262
+ console.log("3. Start the MCP server: npm start");
263
+ console.log("\nFor Claude Desktop integration:");
264
+ console.log("Add this to your Claude Desktop MCP settings:");
267
265
  console.log(`
268
266
  {
269
267
  "mcpServers": {
270
268
  "wordpress": {
271
269
  "command": "node",
272
- "args": ["${join(rootDir, 'dist/index.js')}"],
270
+ "args": ["${join(rootDir, "dist/index.js")}"],
273
271
  "env": {
274
272
  "WORDPRESS_SITE_URL": "${this.config.WORDPRESS_URL}",
275
273
  "WORDPRESS_AUTH_METHOD": "${this.config.AUTH_METHOD}",
@@ -284,12 +282,13 @@ class WordPressSetup {
284
282
  getEnvVarsForClaudeConfig() {
285
283
  const envVars = [];
286
284
  if (this.config.USERNAME) envVars.push(`"WORDPRESS_USERNAME": "${this.config.USERNAME}"`);
287
- if (this.config.APPLICATION_PASSWORD) envVars.push(`"WORDPRESS_APP_PASSWORD": "${this.config.APPLICATION_PASSWORD}"`);
285
+ if (this.config.APPLICATION_PASSWORD)
286
+ envVars.push(`"WORDPRESS_APP_PASSWORD": "${this.config.APPLICATION_PASSWORD}"`);
288
287
  if (this.config.PASSWORD) envVars.push(`"WORDPRESS_PASSWORD": "${this.config.PASSWORD}"`);
289
288
  if (this.config.JWT_SECRET) envVars.push(`"WORDPRESS_JWT_SECRET": "${this.config.JWT_SECRET}"`);
290
289
  if (this.config.API_KEY) envVars.push(`"WORDPRESS_API_KEY": "${this.config.API_KEY}"`);
291
290
  if (this.config.API_SECRET) envVars.push(`"WORDPRESS_API_SECRET": "${this.config.API_SECRET}"`);
292
- return envVars.join(',\n ');
291
+ return envVars.join(",\n ");
293
292
  }
294
293
  }
295
294