mcp-wordpress 2.10.0 ā 2.10.2
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 -19
- package/bin/mcp-wordpress.js +3 -3
- package/bin/setup.js +140 -141
- package/bin/status.js +112 -114
- package/dist/client/MockWordPressClient.d.ts.map +1 -1
- package/dist/client/MockWordPressClient.js.map +1 -1
- package/dist/client/SEOWordPressClient.d.ts.map +1 -1
- package/dist/client/SEOWordPressClient.js +16 -14
- package/dist/client/SEOWordPressClient.js.map +1 -1
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +6 -6
- package/dist/client/managers/AuthManager.d.ts.map +1 -1
- package/dist/client/managers/AuthManager.js +2 -2
- package/dist/client/managers/AuthManager.js.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +1 -1
- package/dist/client/managers/JWTAuthImplementation.d.ts.map +1 -1
- package/dist/client/managers/JWTAuthImplementation.js +7 -7
- package/dist/client/managers/JWTAuthImplementation.js.map +1 -1
- package/dist/client/managers/composed/MigrationAdapter.js +1 -1
- package/dist/client/managers/composed/index.d.ts +2 -2
- package/dist/client/managers/composed/index.d.ts.map +1 -1
- package/dist/client/managers/composed/index.js +1 -1
- package/dist/client/managers/composed/index.js.map +1 -1
- package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts.map +1 -1
- package/dist/client/managers/implementations/ErrorHandlerImpl.js +2 -4
- package/dist/client/managers/implementations/ErrorHandlerImpl.js.map +1 -1
- package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts.map +1 -1
- package/dist/client/managers/implementations/ParameterValidatorImpl.js +1 -1
- package/dist/client/managers/implementations/ParameterValidatorImpl.js.map +1 -1
- package/dist/client/managers/interfaces/ManagerInterfaces.d.ts.map +1 -1
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +3 -3
- package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
- package/dist/docs/MarkdownFormatter.js +7 -7
- package/dist/docs/MarkdownFormatter.js.map +1 -1
- package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
- package/dist/performance/PerformanceAnalytics.js +3 -1
- package/dist/performance/PerformanceAnalytics.js.map +1 -1
- package/dist/security/InputValidator.js +1 -1
- package/dist/security/SecurityCIPipeline.js +1 -1
- package/dist/security/SecurityCIPipeline.js.map +1 -1
- package/dist/security/SecurityConfig.d.ts.map +1 -1
- package/dist/security/SecurityConfig.js +6 -2
- package/dist/security/SecurityConfig.js.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts/PostHandlers.d.ts.map +1 -1
- package/dist/tools/posts/PostHandlers.js.map +1 -1
- package/dist/tools/seo/SEOTools.d.ts.map +1 -1
- package/dist/tools/seo/SEOTools.js.map +1 -1
- package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts.map +1 -1
- package/dist/tools/seo/analyzers/ContentAnalyzer.js.map +1 -1
- package/dist/types/enhanced.d.ts +17 -17
- package/dist/types/enhanced.d.ts.map +1 -1
- package/dist/types/enhanced.js +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/requests.d.ts +16 -16
- package/dist/types/tools.d.ts +46 -46
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +7 -7
- package/docs/ARCHITECTURE.md +17 -17
- package/docs/BADGE_UPDATES.md +11 -11
- package/docs/CACHING.md +2 -0
- package/docs/CI_CD_IMPROVEMENTS.md +8 -5
- package/docs/CONFIGURATION.md +76 -46
- package/docs/DOCKER_PUBLISHING_TROUBLESHOOTING.md +11 -2
- package/docs/EVALUATION.md +16 -21
- package/docs/INCREMENTAL_COVERAGE.md +7 -3
- package/docs/INSTALLATION.md +33 -19
- package/docs/PUBLISHING-TROUBLESHOOTING.md +3 -2
- package/docs/SECURITY.md +17 -15
- package/docs/SECURITY_TESTING.md +3 -0
- package/docs/TROUBLESHOOTING.md +85 -36
- package/docs/api/README.md +118 -125
- package/docs/api/categories/auth.md +3 -1
- package/docs/api/categories/cache.md +3 -1
- package/docs/api/categories/comment.md +3 -1
- package/docs/api/categories/media.md +3 -1
- package/docs/api/categories/page.md +3 -1
- package/docs/api/categories/performance.md +3 -1
- package/docs/api/categories/post.md +3 -1
- package/docs/api/categories/site.md +3 -1
- package/docs/api/categories/taxonomy.md +3 -1
- package/docs/api/categories/user.md +3 -1
- package/docs/api/openapi.json +114 -410
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_approve_comment.md +13 -25
- package/docs/api/tools/wp_cache_clear.md +17 -30
- package/docs/api/tools/wp_cache_info.md +16 -29
- package/docs/api/tools/wp_cache_stats.md +16 -29
- package/docs/api/tools/wp_cache_warm.md +16 -29
- package/docs/api/tools/wp_create_application_password.md +14 -26
- package/docs/api/tools/wp_create_category.md +14 -26
- package/docs/api/tools/wp_create_comment.md +18 -31
- package/docs/api/tools/wp_create_page.md +17 -29
- package/docs/api/tools/wp_create_post.md +25 -30
- package/docs/api/tools/wp_create_tag.md +13 -25
- package/docs/api/tools/wp_create_user.md +18 -30
- package/docs/api/tools/wp_delete_application_password.md +14 -26
- package/docs/api/tools/wp_delete_category.md +13 -25
- package/docs/api/tools/wp_delete_comment.md +14 -26
- package/docs/api/tools/wp_delete_media.md +14 -25
- package/docs/api/tools/wp_delete_page.md +14 -25
- package/docs/api/tools/wp_delete_post.md +17 -25
- package/docs/api/tools/wp_delete_tag.md +13 -25
- package/docs/api/tools/wp_delete_user.md +14 -25
- package/docs/api/tools/wp_get_application_passwords.md +13 -25
- package/docs/api/tools/wp_get_auth_status.md +12 -24
- package/docs/api/tools/wp_get_category.md +13 -25
- package/docs/api/tools/wp_get_comment.md +13 -25
- package/docs/api/tools/wp_get_current_user.md +17 -30
- package/docs/api/tools/wp_get_media.md +13 -25
- package/docs/api/tools/wp_get_page.md +13 -25
- package/docs/api/tools/wp_get_page_revisions.md +13 -25
- package/docs/api/tools/wp_get_post.md +16 -25
- package/docs/api/tools/wp_get_post_revisions.md +13 -25
- package/docs/api/tools/wp_get_site_settings.md +12 -23
- package/docs/api/tools/wp_get_tag.md +13 -25
- package/docs/api/tools/wp_get_user.md +13 -25
- package/docs/api/tools/wp_list_categories.md +15 -27
- package/docs/api/tools/wp_list_comments.md +15 -27
- package/docs/api/tools/wp_list_media.md +18 -31
- package/docs/api/tools/wp_list_pages.md +18 -31
- package/docs/api/tools/wp_list_posts.md +29 -41
- package/docs/api/tools/wp_list_tags.md +14 -26
- package/docs/api/tools/wp_list_users.md +20 -34
- package/docs/api/tools/wp_performance_alerts.md +22 -36
- package/docs/api/tools/wp_performance_benchmark.md +20 -34
- package/docs/api/tools/wp_performance_export.md +22 -36
- package/docs/api/tools/wp_performance_history.md +21 -35
- package/docs/api/tools/wp_performance_optimize.md +22 -36
- package/docs/api/tools/wp_performance_stats.md +20 -34
- package/docs/api/tools/wp_search_site.md +18 -32
- package/docs/api/tools/wp_spam_comment.md +13 -25
- package/docs/api/tools/wp_switch_auth_method.md +18 -31
- package/docs/api/tools/wp_test_auth.md +15 -30
- package/docs/api/tools/wp_update_category.md +14 -26
- package/docs/api/tools/wp_update_comment.md +17 -30
- package/docs/api/tools/wp_update_media.md +19 -32
- package/docs/api/tools/wp_update_page.md +18 -30
- package/docs/api/tools/wp_update_post.md +21 -30
- package/docs/api/tools/wp_update_site_settings.md +18 -31
- package/docs/api/tools/wp_update_tag.md +14 -26
- package/docs/api/tools/wp_update_user.md +17 -29
- package/docs/api/tools/wp_upload_media.md +20 -32
- package/docs/api/types/WordPressPost.md +8 -15
- package/docs/code-improvements.md +1 -0
- package/docs/developer/GITHUB_ACTIONS_SETUP.md +2 -2
- package/docs/developer/MAINTENANCE.md +4 -0
- package/docs/developer/NPM_AUTH_SETUP.md +3 -0
- package/docs/developer/RELEASE_PROCESS.md +1 -0
- package/docs/examples/multi-site-setup.md +2 -0
- package/docs/integrations/claude-desktop.md +14 -5
- package/docs/integrations/cline.md +1 -0
- package/docs/user-guides/DTX_SETUP.md +9 -8
- package/docs/user-guides/NPX_SETUP.md +5 -9
- package/docs/user-guides/SMITHERY_SETUP.md +5 -0
- package/docs/v2.2.0-resolution-demo.md +17 -2
- package/package.json +2 -1
- package/src/cache/__tests__/CacheManager.test.ts +4 -8
- package/src/client/MockWordPressClient.ts +5 -1
- package/src/client/SEOWordPressClient.ts +30 -26
- package/src/client/index.ts +6 -6
- package/src/client/managers/AuthManager.ts +16 -8
- package/src/client/managers/AuthenticationManager.ts +2 -2
- package/src/client/managers/JWTAuthImplementation.ts +24 -27
- package/src/client/managers/ManagersIndex.ts +1 -1
- package/src/client/managers/composed/MigrationAdapter.ts +1 -1
- package/src/client/managers/composed/index.ts +7 -7
- package/src/client/managers/implementations/ErrorHandlerImpl.ts +12 -26
- package/src/client/managers/implementations/ParameterValidatorImpl.ts +49 -49
- package/src/client/managers/interfaces/ManagerInterfaces.ts +13 -9
- package/src/config/index.ts +3 -3
- package/src/docs/MarkdownFormatter.ts +13 -9
- package/src/performance/PerformanceAnalytics.ts +9 -3
- package/src/security/InputValidator.ts +1 -1
- package/src/security/SecurityCIPipeline.ts +1 -1
- package/src/security/SecurityConfig.ts +9 -3
- package/src/server/index.ts +2 -2
- package/src/tools/cache.ts +3 -1
- package/src/tools/comments.ts +3 -1
- package/src/tools/performance.ts +7 -3
- package/src/tools/posts/PostHandlers.ts +3 -1
- package/src/tools/seo/SEOTools.ts +6 -2
- package/src/tools/seo/analyzers/ContentAnalyzer.ts +9 -3
- package/src/types/enhanced.ts +34 -34
- package/src/types/index.ts +13 -11
- package/src/types/requests.ts +19 -19
- package/src/types/tools.ts +137 -84
- 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**:
|
|
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
|
|
346
|
-
| -------------------------- |
|
|
347
|
-
| **Tools Available** | 59 tools
|
|
348
|
-
| **Claude Desktop DXT** | ā
2-click install
|
|
349
|
-
| **Multi-Site Support** | ā
Unlimited sites
|
|
350
|
-
| **TypeScript** | ā
100% coverage
|
|
351
|
-
| **Performance Monitoring** | ā
Real-time analytics
|
|
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
|
|
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. **š
|
|
1123
|
-
|
|
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
|
package/bin/mcp-wordpress.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// NPX wrapper for MCP WordPress Server
|
|
4
|
-
import path from
|
|
5
|
-
import { fileURLToPath } from
|
|
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,
|
|
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
|
|
4
|
-
import { createInterface } from
|
|
5
|
-
import { fileURLToPath } from
|
|
6
|
-
import { dirname, join } from
|
|
7
|
-
import { execSync } from
|
|
8
|
-
import open from
|
|
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,
|
|
21
|
+
this.envPath = join(rootDir, ".env");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async run() {
|
|
25
25
|
try {
|
|
26
|
-
console.log(
|
|
27
|
-
console.log(
|
|
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(
|
|
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(
|
|
46
|
-
if (answer.toLowerCase() !==
|
|
47
|
-
console.log(
|
|
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(
|
|
53
|
+
console.log("š WordPress Site Configuration\n");
|
|
55
54
|
|
|
56
55
|
// WordPress URL
|
|
57
|
-
this.config.WORDPRESS_URL = await this.rl.question(
|
|
58
|
-
if (!this.config.WORDPRESS_URL.startsWith(
|
|
59
|
-
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(
|
|
65
|
-
console.log(
|
|
66
|
-
console.log(
|
|
67
|
-
console.log(
|
|
68
|
-
console.log(
|
|
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(
|
|
69
|
+
const authChoice = await this.rl.question("Choose authentication method (1-4): ");
|
|
71
70
|
|
|
72
71
|
switch (authChoice) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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(
|
|
92
|
-
|
|
93
|
-
const debugAnswer = await this.rl.question(
|
|
94
|
-
this.config.DEBUG = debugAnswer.toLowerCase() ===
|
|
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(
|
|
97
|
-
this.config.ENABLE_CACHE = cacheAnswer.toLowerCase() ===
|
|
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(
|
|
100
|
-
this.config.RATE_LIMIT = rateLimit ||
|
|
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 =
|
|
105
|
-
this.config.USERNAME = await this.rl.question(
|
|
106
|
-
|
|
107
|
-
console.log(
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
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(
|
|
114
|
-
|
|
115
|
-
const openBrowser = await this.rl.question(
|
|
116
|
-
if (openBrowser.toLowerCase() !==
|
|
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(
|
|
119
|
+
console.log("Could not open browser automatically");
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
this.config.APPLICATION_PASSWORD = await this.rl.question(
|
|
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 =
|
|
129
|
-
this.config.USERNAME = await this.rl.question(
|
|
130
|
-
this.config.PASSWORD = await this.rl.question(
|
|
131
|
-
|
|
132
|
-
console.log(
|
|
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 =
|
|
137
|
-
this.config.JWT_SECRET = await this.rl.question(
|
|
138
|
-
this.config.USERNAME = await this.rl.question(
|
|
139
|
-
this.config.PASSWORD = await this.rl.question(
|
|
140
|
-
|
|
141
|
-
console.log(
|
|
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 =
|
|
146
|
-
this.config.API_KEY = await this.rl.question(
|
|
147
|
-
this.config.API_SECRET = await this.rl.question(
|
|
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(
|
|
150
|
+
console.log("šØ Building TypeScript project...");
|
|
152
151
|
try {
|
|
153
|
-
execSync(
|
|
154
|
-
console.log(
|
|
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(
|
|
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(
|
|
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(
|
|
176
|
-
|
|
177
|
-
console.log(
|
|
178
|
-
console.log(` Site: ${sites.name ||
|
|
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(
|
|
183
|
-
const retry = await this.rl.question(
|
|
184
|
-
if (retry.toLowerCase() ===
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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(
|
|
223
|
+
console.log("\nš¾ Saving configuration...");
|
|
226
224
|
|
|
227
225
|
// Map config keys to environment variable names
|
|
228
226
|
const envVars = {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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[
|
|
233
|
+
envVars["WORDPRESS_APP_PASSWORD"] = this.config.APPLICATION_PASSWORD;
|
|
236
234
|
}
|
|
237
235
|
if (this.config.PASSWORD) {
|
|
238
|
-
envVars[
|
|
236
|
+
envVars["WORDPRESS_PASSWORD"] = this.config.PASSWORD;
|
|
239
237
|
}
|
|
240
238
|
if (this.config.JWT_SECRET) {
|
|
241
|
-
envVars[
|
|
239
|
+
envVars["WORDPRESS_JWT_SECRET"] = this.config.JWT_SECRET;
|
|
242
240
|
}
|
|
243
241
|
if (this.config.API_KEY) {
|
|
244
|
-
envVars[
|
|
242
|
+
envVars["WORDPRESS_API_KEY"] = this.config.API_KEY;
|
|
245
243
|
}
|
|
246
244
|
if (this.config.API_SECRET) {
|
|
247
|
-
envVars[
|
|
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(
|
|
250
|
+
.join("\n");
|
|
253
251
|
|
|
254
252
|
writeFileSync(this.envPath, envContent);
|
|
255
|
-
console.log(
|
|
253
|
+
console.log("ā
Configuration saved to .env file");
|
|
256
254
|
}
|
|
257
255
|
|
|
258
256
|
async showNextSteps() {
|
|
259
|
-
console.log(
|
|
260
|
-
console.log(
|
|
261
|
-
console.log(
|
|
262
|
-
console.log(
|
|
263
|
-
console.log(
|
|
264
|
-
console.log(
|
|
265
|
-
console.log(
|
|
266
|
-
console.log(
|
|
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,
|
|
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)
|
|
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(
|
|
291
|
+
return envVars.join(",\n ");
|
|
293
292
|
}
|
|
294
293
|
}
|
|
295
294
|
|