mcp-wordpress 1.5.2 → 2.0.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 +332 -61
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +4 -4
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/client/MockWordPressClient.d.ts +55 -0
- package/dist/client/MockWordPressClient.d.ts.map +1 -0
- package/dist/client/MockWordPressClient.js +369 -0
- package/dist/client/MockWordPressClient.js.map +1 -0
- package/dist/client/api.d.ts +1 -0
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +26 -60
- package/dist/client/api.js.map +1 -1
- package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +4 -3
- package/dist/client/managers/AuthenticationManager.js.map +1 -1
- package/dist/config/ConfigurationSchema.d.ts +3 -3
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +7 -24
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +8 -0
- package/dist/config/ServerConfiguration.d.ts.map +1 -1
- package/dist/config/ServerConfiguration.js +80 -31
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
- package/dist/docs/DocumentationGenerator.js +5 -7
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -29
- package/dist/index.js.map +1 -1
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +3 -11
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/server/ToolRegistry.d.ts +4 -0
- package/dist/server/ToolRegistry.d.ts.map +1 -1
- package/dist/server/ToolRegistry.js +71 -8
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +8 -3
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +287 -20
- package/dist/tools/posts.js.map +1 -1
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +47 -9
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +113 -10
- package/dist/tools/users.js.map +1 -1
- package/dist/utils/enhancedError.d.ts +61 -0
- package/dist/utils/enhancedError.d.ts.map +1 -0
- package/dist/utils/enhancedError.js +221 -0
- package/dist/utils/enhancedError.js.map +1 -0
- package/dist/utils/streaming.d.ts +104 -0
- package/dist/utils/streaming.d.ts.map +1 -0
- package/dist/utils/streaming.js +312 -0
- package/dist/utils/streaming.js.map +1 -0
- package/dist/utils/validation.d.ts +19 -3
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +174 -24
- package/dist/utils/validation.js.map +1 -1
- package/docs/ARCHITECTURE.md +850 -0
- package/docs/CACHING.md +20 -17
- package/docs/CONFIGURATION.md +660 -0
- package/docs/DOCKER.md +61 -60
- package/docs/EVALUATION.md +397 -0
- package/docs/INSTALLATION.md +423 -0
- package/docs/PERFORMANCE_MONITORING.md +17 -15
- package/docs/SECURITY.md +621 -0
- package/docs/SECURITY_TESTING.md +22 -26
- package/docs/TEST_SITE_SETUP.md +136 -0
- package/docs/TROUBLESHOOTING.md +578 -0
- package/docs/api/README.md +76 -91
- package/docs/api/categories/auth.md +0 -2
- package/docs/api/categories/cache.md +0 -2
- package/docs/api/categories/comment.md +0 -2
- package/docs/api/categories/media.md +0 -2
- package/docs/api/categories/page.md +0 -2
- package/docs/api/categories/performance.md +0 -2
- package/docs/api/categories/post.md +0 -2
- package/docs/api/categories/site.md +0 -2
- package/docs/api/categories/taxonomy.md +0 -2
- package/docs/api/categories/user.md +0 -2
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_approve_comment.md +11 -3
- package/docs/api/tools/wp_cache_clear.md +14 -5
- package/docs/api/tools/wp_cache_info.md +14 -5
- package/docs/api/tools/wp_cache_stats.md +14 -5
- package/docs/api/tools/wp_cache_warm.md +14 -5
- package/docs/api/tools/wp_create_application_password.md +11 -3
- package/docs/api/tools/wp_create_category.md +11 -3
- package/docs/api/tools/wp_create_comment.md +14 -5
- package/docs/api/tools/wp_create_page.md +13 -5
- package/docs/api/tools/wp_create_post.md +14 -7
- package/docs/api/tools/wp_create_tag.md +11 -3
- package/docs/api/tools/wp_create_user.md +13 -5
- package/docs/api/tools/wp_delete_application_password.md +11 -3
- package/docs/api/tools/wp_delete_category.md +11 -3
- package/docs/api/tools/wp_delete_comment.md +11 -3
- package/docs/api/tools/wp_delete_media.md +10 -3
- package/docs/api/tools/wp_delete_page.md +10 -3
- package/docs/api/tools/wp_delete_post.md +11 -5
- package/docs/api/tools/wp_delete_tag.md +11 -3
- package/docs/api/tools/wp_delete_user.md +10 -3
- package/docs/api/tools/wp_get_application_passwords.md +11 -3
- package/docs/api/tools/wp_get_auth_status.md +11 -3
- package/docs/api/tools/wp_get_category.md +11 -3
- package/docs/api/tools/wp_get_comment.md +11 -3
- package/docs/api/tools/wp_get_current_user.md +11 -3
- package/docs/api/tools/wp_get_media.md +11 -3
- package/docs/api/tools/wp_get_page.md +11 -3
- package/docs/api/tools/wp_get_page_revisions.md +11 -3
- package/docs/api/tools/wp_get_post.md +12 -5
- package/docs/api/tools/wp_get_post_revisions.md +11 -3
- package/docs/api/tools/wp_get_site_settings.md +10 -3
- package/docs/api/tools/wp_get_tag.md +11 -3
- package/docs/api/tools/wp_get_user.md +11 -3
- package/docs/api/tools/wp_list_categories.md +11 -3
- package/docs/api/tools/wp_list_comments.md +11 -3
- package/docs/api/tools/wp_list_media.md +14 -5
- package/docs/api/tools/wp_list_pages.md +14 -5
- package/docs/api/tools/wp_list_posts.md +15 -7
- package/docs/api/tools/wp_list_tags.md +11 -3
- package/docs/api/tools/wp_list_users.md +11 -3
- package/docs/api/tools/wp_performance_alerts.md +17 -7
- package/docs/api/tools/wp_performance_benchmark.md +17 -7
- package/docs/api/tools/wp_performance_export.md +17 -7
- package/docs/api/tools/wp_performance_history.md +17 -7
- package/docs/api/tools/wp_performance_optimize.md +17 -7
- package/docs/api/tools/wp_performance_stats.md +17 -7
- package/docs/api/tools/wp_search_site.md +11 -3
- package/docs/api/tools/wp_spam_comment.md +11 -3
- package/docs/api/tools/wp_switch_auth_method.md +14 -5
- package/docs/api/tools/wp_test_auth.md +11 -3
- package/docs/api/tools/wp_update_category.md +11 -3
- package/docs/api/tools/wp_update_comment.md +14 -5
- package/docs/api/tools/wp_update_media.md +14 -5
- package/docs/api/tools/wp_update_page.md +13 -5
- package/docs/api/tools/wp_update_post.md +14 -7
- package/docs/api/tools/wp_update_site_settings.md +14 -5
- package/docs/api/tools/wp_update_tag.md +11 -3
- package/docs/api/tools/wp_update_user.md +13 -5
- package/docs/api/tools/wp_upload_media.md +13 -5
- package/docs/api/types/WordPressPost.md +2 -0
- package/docs/code-improvements.md +40 -0
- package/docs/contract-testing.md +1 -1
- package/docs/developer/API_REFERENCE.md +19 -59
- package/docs/developer/ARCHITECTURE.md +8 -11
- package/docs/developer/BUILD_SYSTEM.md +2 -2
- package/docs/developer/CONTRIBUTING.md +3 -5
- package/docs/developer/GITHUB_ACTIONS_SETUP.md +2 -2
- package/docs/developer/MIGRATION_GUIDE.md +5 -6
- package/docs/developer/README.md +2 -1
- package/docs/developer/REFACTORING.md +9 -15
- package/docs/developer/RELEASE_PROCESS.md +4 -3
- package/docs/developer/TESTING.md +2 -2
- package/docs/examples/claude-desktop-config.md +8 -0
- package/docs/integrations/claude-desktop.md +426 -0
- package/docs/integrations/cline.md +537 -0
- package/docs/integrations/vs-code.md +515 -0
- package/docs/releases/COMMUNITY_ANNOUNCEMENT_v1.1.2.md +30 -23
- package/docs/releases/RELEASE_NOTES_v1.1.2.md +7 -6
- package/docs/testing-configurations.md +11 -0
- package/docs/user-guides/DOCKER_NPM_DTX_SETUP.md +3 -2
- package/docs/user-guides/DOCKER_SETUP.md +3 -2
- package/docs/user-guides/DTX_SETUP.md +6 -5
- package/docs/user-guides/DXT_INSTALLATION.md +4 -4
- package/docs/user-guides/NPM_SETUP.md +4 -2
- package/docs/user-guides/NPX_SETUP.md +4 -2
- package/docs/user-guides/SMITHERY_SETUP.md +402 -0
- package/docs/wordpress-rest-api-authentication-troubleshooting.md +45 -42
- package/package.json +12 -2
- package/src/cache/CacheInvalidation.ts +7 -18
- package/src/client/MockWordPressClient.ts +398 -0
- package/src/client/api.ts +77 -237
- package/src/client/managers/AuthenticationManager.ts +19 -56
- package/src/config/ConfigurationSchema.ts +14 -45
- package/src/config/ServerConfiguration.ts +98 -71
- package/src/docs/DocumentationGenerator.ts +39 -123
- package/src/dxt-entry.cjs +4 -1
- package/src/index.ts +35 -54
- package/src/security/InputValidator.ts +15 -57
- package/src/server/ToolRegistry.ts +88 -17
- package/src/tools/auth.ts +15 -22
- package/src/tools/posts.ts +347 -64
- package/src/tools/site.ts +69 -46
- package/src/tools/users.ts +142 -44
- package/src/utils/enhancedError.ts +248 -0
- package/src/utils/streaming.ts +428 -0
- package/src/utils/validation.ts +253 -92
- package/dist/mcp-wordpress-1.5.2.tgz +0 -0
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
# Configuration Guide
|
|
2
|
+
|
|
3
|
+
Complete configuration reference for MCP WordPress Server supporting single-site and multi-site deployments.
|
|
4
|
+
|
|
5
|
+
## 🎯 Configuration Overview
|
|
6
|
+
|
|
7
|
+
The MCP WordPress Server supports flexible configuration through multiple methods:
|
|
8
|
+
|
|
9
|
+
| Method | Best For | Configuration File |
|
|
10
|
+
|--------|----------|--------------------|
|
|
11
|
+
| **Environment Variables** | Single site, development | `.env` |
|
|
12
|
+
| **Multi-Site JSON** | Multiple sites, production | `mcp-wordpress.config.json` |
|
|
13
|
+
| **Claude Desktop** | Desktop integration | `claude_desktop_config.json` |
|
|
14
|
+
| **DXT Extension** | Easy desktop setup | Built-in UI |
|
|
15
|
+
|
|
16
|
+
## 🌐 Single-Site Configuration
|
|
17
|
+
|
|
18
|
+
### Environment Variables
|
|
19
|
+
|
|
20
|
+
Create a `.env` file in your project root:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# WordPress Connection (Required)
|
|
24
|
+
WORDPRESS_SITE_URL=https://your-site.com
|
|
25
|
+
WORDPRESS_USERNAME=your-username
|
|
26
|
+
WORDPRESS_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx
|
|
27
|
+
|
|
28
|
+
# Authentication Method (Optional)
|
|
29
|
+
WORDPRESS_AUTH_METHOD=app-password
|
|
30
|
+
|
|
31
|
+
# Environment Settings (Optional)
|
|
32
|
+
NODE_ENV=production
|
|
33
|
+
DEBUG=false
|
|
34
|
+
LOG_LEVEL=info
|
|
35
|
+
|
|
36
|
+
# Performance Settings (Optional)
|
|
37
|
+
DISABLE_CACHE=false
|
|
38
|
+
CACHE_TTL=300
|
|
39
|
+
MAX_CACHE_SIZE=1000
|
|
40
|
+
|
|
41
|
+
# Security Settings (Optional)
|
|
42
|
+
RATE_LIMIT_REQUESTS=1000
|
|
43
|
+
RATE_LIMIT_WINDOW=60000
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Environment Variable Reference
|
|
47
|
+
|
|
48
|
+
#### Required Variables
|
|
49
|
+
|
|
50
|
+
| Variable | Required | Description | Example |
|
|
51
|
+
|----------|----------|-------------|---------|
|
|
52
|
+
| `WORDPRESS_SITE_URL` | Yes | Full WordPress site URL | `https://blog.example.com` |
|
|
53
|
+
| `WORDPRESS_USERNAME` | Yes | WordPress username | `admin` |
|
|
54
|
+
| `WORDPRESS_APP_PASSWORD` | Yes | WordPress application password | `AbCd EfGh IjKl MnOp QrSt UvWx` |
|
|
55
|
+
|
|
56
|
+
#### Authentication Variables
|
|
57
|
+
|
|
58
|
+
| Variable | Default | Description | Options |
|
|
59
|
+
|----------|---------|-------------|---------|
|
|
60
|
+
| `WORDPRESS_AUTH_METHOD` | `app-password` | Authentication method | `app-password`, `jwt`, `basic`, `api-key` |
|
|
61
|
+
|
|
62
|
+
#### Runtime Variables
|
|
63
|
+
|
|
64
|
+
| Variable | Default | Description | Options |
|
|
65
|
+
|----------|---------|-------------|---------|
|
|
66
|
+
| `NODE_ENV` | `production` | Runtime environment | `development`, `production`, `test`, `dxt` |
|
|
67
|
+
| `DEBUG` | `false` | Enable debug logging | `true`, `false` |
|
|
68
|
+
| `LOG_LEVEL` | `info` | Logging verbosity | `error`, `warn`, `info`, `debug` |
|
|
69
|
+
|
|
70
|
+
#### Performance Variables
|
|
71
|
+
|
|
72
|
+
| Variable | Default | Description | Range |
|
|
73
|
+
|----------|---------|-------------|-------|
|
|
74
|
+
| `DISABLE_CACHE` | `false` | Disable caching system | `true`, `false` |
|
|
75
|
+
| `CACHE_TTL` | `300` | Cache time-to-live (seconds) | `60-3600` |
|
|
76
|
+
| `MAX_CACHE_SIZE` | `1000` | Maximum cache entries | `100-10000` |
|
|
77
|
+
|
|
78
|
+
## 🏢 Multi-Site Configuration
|
|
79
|
+
|
|
80
|
+
### Configuration File Structure
|
|
81
|
+
|
|
82
|
+
Create `mcp-wordpress.config.json` in your project root:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"sites": [
|
|
87
|
+
{
|
|
88
|
+
"id": "main-site",
|
|
89
|
+
"name": "Main WordPress Site",
|
|
90
|
+
"config": {
|
|
91
|
+
"WORDPRESS_SITE_URL": "https://main-site.com",
|
|
92
|
+
"WORDPRESS_USERNAME": "admin",
|
|
93
|
+
"WORDPRESS_APP_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx",
|
|
94
|
+
"WORDPRESS_AUTH_METHOD": "app-password"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "client-blog",
|
|
99
|
+
"name": "Client Blog",
|
|
100
|
+
"config": {
|
|
101
|
+
"WORDPRESS_SITE_URL": "https://client-blog.com",
|
|
102
|
+
"WORDPRESS_USERNAME": "editor",
|
|
103
|
+
"WORDPRESS_APP_PASSWORD": "yyyy yyyy yyyy yyyy yyyy yyyy",
|
|
104
|
+
"WORDPRESS_AUTH_METHOD": "jwt"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "dev-site",
|
|
109
|
+
"name": "Development Site",
|
|
110
|
+
"config": {
|
|
111
|
+
"WORDPRESS_SITE_URL": "https://dev.example.com",
|
|
112
|
+
"WORDPRESS_USERNAME": "developer",
|
|
113
|
+
"WORDPRESS_APP_PASSWORD": "zzzz zzzz zzzz zzzz zzzz zzzz",
|
|
114
|
+
"WORDPRESS_AUTH_METHOD": "basic"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Multi-Site Configuration Rules
|
|
122
|
+
|
|
123
|
+
#### Site Identification
|
|
124
|
+
- **`id`**: Unique identifier (alphanumeric, hyphens, underscores only)
|
|
125
|
+
- **`name`**: Human-readable name for documentation
|
|
126
|
+
- **Maximum sites**: 50 sites per configuration
|
|
127
|
+
|
|
128
|
+
#### Uniqueness Requirements
|
|
129
|
+
All of these must be unique across all sites:
|
|
130
|
+
- Site IDs
|
|
131
|
+
- Site names
|
|
132
|
+
- WordPress site URLs
|
|
133
|
+
|
|
134
|
+
#### Site-Specific Usage
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Target specific site with --site parameter
|
|
138
|
+
wp_list_posts --site="main-site"
|
|
139
|
+
wp_create_post --site="client-blog" --title="New Post"
|
|
140
|
+
wp_get_site_settings --site="dev-site"
|
|
141
|
+
|
|
142
|
+
# If only one site configured, --site parameter is optional
|
|
143
|
+
# If multiple sites configured, --site parameter is required
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Multi-Site Example Configurations
|
|
147
|
+
|
|
148
|
+
#### Agency Setup
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"sites": [
|
|
152
|
+
{
|
|
153
|
+
"id": "agency-main",
|
|
154
|
+
"name": "Agency Main Website",
|
|
155
|
+
"config": {
|
|
156
|
+
"WORDPRESS_SITE_URL": "https://agency.com",
|
|
157
|
+
"WORDPRESS_USERNAME": "admin",
|
|
158
|
+
"WORDPRESS_APP_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "client-a",
|
|
163
|
+
"name": "Client A Blog",
|
|
164
|
+
"config": {
|
|
165
|
+
"WORDPRESS_SITE_URL": "https://clienta.com/blog",
|
|
166
|
+
"WORDPRESS_USERNAME": "editor",
|
|
167
|
+
"WORDPRESS_APP_PASSWORD": "yyyy yyyy yyyy yyyy yyyy yyyy"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"id": "client-b",
|
|
172
|
+
"name": "Client B E-commerce",
|
|
173
|
+
"config": {
|
|
174
|
+
"WORDPRESS_SITE_URL": "https://clientb-shop.com",
|
|
175
|
+
"WORDPRESS_USERNAME": "shop_manager",
|
|
176
|
+
"WORDPRESS_APP_PASSWORD": "zzzz zzzz zzzz zzzz zzzz zzzz"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Development Workflow
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"sites": [
|
|
187
|
+
{
|
|
188
|
+
"id": "production",
|
|
189
|
+
"name": "Production Site",
|
|
190
|
+
"config": {
|
|
191
|
+
"WORDPRESS_SITE_URL": "https://mysite.com",
|
|
192
|
+
"WORDPRESS_USERNAME": "admin",
|
|
193
|
+
"WORDPRESS_APP_PASSWORD": "prod prod prod prod prod prod"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"id": "staging",
|
|
198
|
+
"name": "Staging Environment",
|
|
199
|
+
"config": {
|
|
200
|
+
"WORDPRESS_SITE_URL": "https://staging.mysite.com",
|
|
201
|
+
"WORDPRESS_USERNAME": "admin",
|
|
202
|
+
"WORDPRESS_APP_PASSWORD": "stag stag stag stag stag stag"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"id": "local",
|
|
207
|
+
"name": "Local Development",
|
|
208
|
+
"config": {
|
|
209
|
+
"WORDPRESS_SITE_URL": "http://localhost:8080",
|
|
210
|
+
"WORDPRESS_USERNAME": "dev",
|
|
211
|
+
"WORDPRESS_APP_PASSWORD": "locl locl locl locl locl locl",
|
|
212
|
+
"WORDPRESS_AUTH_METHOD": "basic"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 🔐 Authentication Configuration
|
|
220
|
+
|
|
221
|
+
### Application Passwords (Recommended)
|
|
222
|
+
|
|
223
|
+
**WordPress Setup:**
|
|
224
|
+
1. **Enable Application Passwords** (WordPress 5.6+)
|
|
225
|
+
2. **Generate Password**: Users → Profile → Application Passwords
|
|
226
|
+
3. **Copy Password**: Exact format with spaces
|
|
227
|
+
|
|
228
|
+
**Configuration:**
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"WORDPRESS_AUTH_METHOD": "app-password",
|
|
232
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
233
|
+
"WORDPRESS_APP_PASSWORD": "AbCd EfGh IjKl MnOp QrSt UvWx"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Security Benefits:**
|
|
238
|
+
- ✅ Revocable without changing main password
|
|
239
|
+
- ✅ Scoped permissions
|
|
240
|
+
- ✅ Audit trail
|
|
241
|
+
- ✅ WordPress native support
|
|
242
|
+
|
|
243
|
+
### JWT Authentication
|
|
244
|
+
|
|
245
|
+
**WordPress Setup:**
|
|
246
|
+
1. **Install JWT Plugin**: JWT Authentication for WP-API
|
|
247
|
+
2. **Configure JWT Secret** in wp-config.php
|
|
248
|
+
3. **Get JWT Token** via login endpoint
|
|
249
|
+
|
|
250
|
+
**Configuration:**
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"WORDPRESS_AUTH_METHOD": "jwt",
|
|
254
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
255
|
+
"WORDPRESS_APP_PASSWORD": "your-jwt-token"
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**WordPress JWT Setup:**
|
|
260
|
+
```php
|
|
261
|
+
// wp-config.php
|
|
262
|
+
define('JWT_AUTH_SECRET_KEY', 'your-secret-key');
|
|
263
|
+
define('JWT_AUTH_CORS_ENABLE', true);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Basic Authentication
|
|
267
|
+
|
|
268
|
+
**⚠️ Development Only - Not recommended for production**
|
|
269
|
+
|
|
270
|
+
**Configuration:**
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"WORDPRESS_AUTH_METHOD": "basic",
|
|
274
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
275
|
+
"WORDPRESS_APP_PASSWORD": "your-regular-password"
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### API Key Authentication
|
|
280
|
+
|
|
281
|
+
**WordPress Setup:**
|
|
282
|
+
1. **Install API Key Plugin**
|
|
283
|
+
2. **Generate API Key** in WordPress admin
|
|
284
|
+
3. **Configure Key Permissions**
|
|
285
|
+
|
|
286
|
+
**Configuration:**
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"WORDPRESS_AUTH_METHOD": "api-key",
|
|
290
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
291
|
+
"WORDPRESS_APP_PASSWORD": "your-api-key"
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## ⚙️ Claude Desktop Configuration
|
|
296
|
+
|
|
297
|
+
### NPX Method
|
|
298
|
+
|
|
299
|
+
Add to `claude_desktop_config.json`:
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"mcpServers": {
|
|
304
|
+
"mcp-wordpress": {
|
|
305
|
+
"command": "npx",
|
|
306
|
+
"args": ["-y", "mcp-wordpress"],
|
|
307
|
+
"env": {
|
|
308
|
+
"WORDPRESS_SITE_URL": "https://your-site.com",
|
|
309
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
310
|
+
"WORDPRESS_APP_PASSWORD": "your-app-password",
|
|
311
|
+
"WORDPRESS_AUTH_METHOD": "app-password"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### NPM Global Method
|
|
319
|
+
|
|
320
|
+
```json
|
|
321
|
+
{
|
|
322
|
+
"mcpServers": {
|
|
323
|
+
"mcp-wordpress": {
|
|
324
|
+
"command": "mcp-wordpress",
|
|
325
|
+
"env": {
|
|
326
|
+
"WORDPRESS_SITE_URL": "https://your-site.com",
|
|
327
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
328
|
+
"WORDPRESS_APP_PASSWORD": "your-app-password"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Multi-Site in Claude Desktop
|
|
336
|
+
|
|
337
|
+
For multi-site setups, create a configuration file and reference it:
|
|
338
|
+
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"mcpServers": {
|
|
342
|
+
"mcp-wordpress": {
|
|
343
|
+
"command": "npx",
|
|
344
|
+
"args": ["-y", "mcp-wordpress"],
|
|
345
|
+
"cwd": "/path/to/your/config/directory"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## 🐳 Docker Configuration
|
|
352
|
+
|
|
353
|
+
### Docker Environment Setup
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
# Single site
|
|
357
|
+
docker run -d \
|
|
358
|
+
--name mcp-wordpress \
|
|
359
|
+
-e WORDPRESS_SITE_URL=https://your-site.com \
|
|
360
|
+
-e WORDPRESS_USERNAME=your-username \
|
|
361
|
+
-e WORDPRESS_APP_PASSWORD="your app password" \
|
|
362
|
+
docdyhr/mcp-wordpress:latest
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Docker Compose
|
|
366
|
+
|
|
367
|
+
```yaml
|
|
368
|
+
version: '3.8'
|
|
369
|
+
services:
|
|
370
|
+
mcp-wordpress:
|
|
371
|
+
image: docdyhr/mcp-wordpress:latest
|
|
372
|
+
environment:
|
|
373
|
+
WORDPRESS_SITE_URL: https://your-site.com
|
|
374
|
+
WORDPRESS_USERNAME: your-username
|
|
375
|
+
WORDPRESS_APP_PASSWORD: your app password
|
|
376
|
+
WORDPRESS_AUTH_METHOD: app-password
|
|
377
|
+
DEBUG: "false"
|
|
378
|
+
volumes:
|
|
379
|
+
- ./config:/app/config
|
|
380
|
+
restart: unless-stopped
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Multi-Site with Docker
|
|
384
|
+
|
|
385
|
+
```yaml
|
|
386
|
+
version: '3.8'
|
|
387
|
+
services:
|
|
388
|
+
mcp-wordpress:
|
|
389
|
+
image: docdyhr/mcp-wordpress:latest
|
|
390
|
+
volumes:
|
|
391
|
+
- ./mcp-wordpress.config.json:/app/mcp-wordpress.config.json:ro
|
|
392
|
+
restart: unless-stopped
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## 🔧 Advanced Configuration
|
|
396
|
+
|
|
397
|
+
### Performance Tuning
|
|
398
|
+
|
|
399
|
+
#### Cache Configuration
|
|
400
|
+
```bash
|
|
401
|
+
# Optimize for high-traffic sites
|
|
402
|
+
CACHE_TTL=600 # 10 minutes
|
|
403
|
+
MAX_CACHE_SIZE=5000 # 5000 entries
|
|
404
|
+
CACHE_CLEANUP_INTERVAL=300 # 5 minutes
|
|
405
|
+
|
|
406
|
+
# Optimize for low-memory environments
|
|
407
|
+
CACHE_TTL=120 # 2 minutes
|
|
408
|
+
MAX_CACHE_SIZE=100 # 100 entries
|
|
409
|
+
DISABLE_CACHE=false # Keep basic caching
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
#### Rate Limiting
|
|
413
|
+
```bash
|
|
414
|
+
# Conservative limits
|
|
415
|
+
RATE_LIMIT_REQUESTS=100 # 100 requests
|
|
416
|
+
RATE_LIMIT_WINDOW=60000 # per minute
|
|
417
|
+
|
|
418
|
+
# Aggressive limits
|
|
419
|
+
RATE_LIMIT_REQUESTS=1000 # 1000 requests
|
|
420
|
+
RATE_LIMIT_WINDOW=60000 # per minute
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Security Hardening
|
|
424
|
+
|
|
425
|
+
#### Network Security
|
|
426
|
+
```bash
|
|
427
|
+
# Bind to specific interface (Docker/production)
|
|
428
|
+
BIND_ADDRESS=127.0.0.1
|
|
429
|
+
PORT=3000
|
|
430
|
+
|
|
431
|
+
# SSL/TLS Configuration
|
|
432
|
+
SSL_CERT=/path/to/cert.pem
|
|
433
|
+
SSL_KEY=/path/to/key.pem
|
|
434
|
+
FORCE_HTTPS=true
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
#### Authentication Security
|
|
438
|
+
```bash
|
|
439
|
+
# Strengthen authentication
|
|
440
|
+
AUTH_TIMEOUT=300 # 5 minute auth timeout
|
|
441
|
+
MAX_AUTH_ATTEMPTS=3 # Max failed attempts
|
|
442
|
+
AUTH_LOCKOUT_DURATION=900 # 15 minute lockout
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Monitoring Configuration
|
|
446
|
+
|
|
447
|
+
#### Logging
|
|
448
|
+
```bash
|
|
449
|
+
# Development logging
|
|
450
|
+
NODE_ENV=development
|
|
451
|
+
DEBUG=true
|
|
452
|
+
LOG_LEVEL=debug
|
|
453
|
+
|
|
454
|
+
# Production logging
|
|
455
|
+
NODE_ENV=production
|
|
456
|
+
DEBUG=false
|
|
457
|
+
LOG_LEVEL=warn
|
|
458
|
+
LOG_FILE=/var/log/mcp-wordpress.log
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
#### Performance Monitoring
|
|
462
|
+
```bash
|
|
463
|
+
# Enable performance tracking
|
|
464
|
+
ENABLE_PERFORMANCE_MONITORING=true
|
|
465
|
+
PERFORMANCE_SAMPLE_RATE=0.1 # 10% sampling
|
|
466
|
+
METRICS_ENDPOINT=/metrics
|
|
467
|
+
|
|
468
|
+
# Disable in resource-constrained environments
|
|
469
|
+
ENABLE_PERFORMANCE_MONITORING=false
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
## ✅ Configuration Validation
|
|
473
|
+
|
|
474
|
+
### Validation Commands
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
# Validate current configuration
|
|
478
|
+
npm run config:validate
|
|
479
|
+
|
|
480
|
+
# Test specific site (multi-site)
|
|
481
|
+
npm run config:test --site="site-id"
|
|
482
|
+
|
|
483
|
+
# Validate and show configuration
|
|
484
|
+
npm run config:show
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Common Validation Errors
|
|
488
|
+
|
|
489
|
+
#### 1. Invalid URL Format
|
|
490
|
+
```bash
|
|
491
|
+
# ❌ Common mistakes
|
|
492
|
+
WORDPRESS_SITE_URL=mysite.com # Missing protocol
|
|
493
|
+
WORDPRESS_SITE_URL=https://mysite.com/ # Trailing slash
|
|
494
|
+
WORDPRESS_SITE_URL=http://localhost # Missing port for local
|
|
495
|
+
|
|
496
|
+
# ✅ Correct formats
|
|
497
|
+
WORDPRESS_SITE_URL=https://mysite.com
|
|
498
|
+
WORDPRESS_SITE_URL=http://localhost:8080
|
|
499
|
+
WORDPRESS_SITE_URL=https://blog.mysite.com
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
#### 2. Invalid Authentication Method
|
|
503
|
+
```bash
|
|
504
|
+
# ❌ Invalid
|
|
505
|
+
WORDPRESS_AUTH_METHOD=password # Not supported
|
|
506
|
+
|
|
507
|
+
# ✅ Valid options
|
|
508
|
+
WORDPRESS_AUTH_METHOD=app-password # Recommended
|
|
509
|
+
WORDPRESS_AUTH_METHOD=jwt # With plugin
|
|
510
|
+
WORDPRESS_AUTH_METHOD=basic # Development only
|
|
511
|
+
WORDPRESS_AUTH_METHOD=api-key # With plugin
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
#### 3. Multi-Site Configuration Errors
|
|
515
|
+
```bash
|
|
516
|
+
# ❌ Duplicate site IDs
|
|
517
|
+
{"id": "site1", ...}
|
|
518
|
+
{"id": "site1", ...} # Error: duplicate ID
|
|
519
|
+
|
|
520
|
+
# ❌ Invalid site ID characters
|
|
521
|
+
{"id": "site 1", ...} # Spaces not allowed
|
|
522
|
+
{"id": "site@1", ...} # Special chars not allowed
|
|
523
|
+
|
|
524
|
+
# ✅ Valid site IDs
|
|
525
|
+
{"id": "site-1", ...} # Hyphens OK
|
|
526
|
+
{"id": "site_1", ...} # Underscores OK
|
|
527
|
+
{"id": "site1", ...} # Alphanumeric OK
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
## 🔄 Configuration Migration
|
|
531
|
+
|
|
532
|
+
### From Single-Site to Multi-Site
|
|
533
|
+
|
|
534
|
+
1. **Backup Current Configuration**
|
|
535
|
+
```bash
|
|
536
|
+
cp .env .env.backup
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
2. **Create Multi-Site Config**
|
|
540
|
+
```json
|
|
541
|
+
{
|
|
542
|
+
"sites": [
|
|
543
|
+
{
|
|
544
|
+
"id": "default",
|
|
545
|
+
"name": "Main Site",
|
|
546
|
+
"config": {
|
|
547
|
+
"WORDPRESS_SITE_URL": "your-current-url",
|
|
548
|
+
"WORDPRESS_USERNAME": "your-current-username",
|
|
549
|
+
"WORDPRESS_APP_PASSWORD": "your-current-password"
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
3. **Update Claude Desktop Config**
|
|
557
|
+
```json
|
|
558
|
+
{
|
|
559
|
+
"mcpServers": {
|
|
560
|
+
"mcp-wordpress": {
|
|
561
|
+
"command": "npx",
|
|
562
|
+
"args": ["-y", "mcp-wordpress"],
|
|
563
|
+
"cwd": "/path/to/config/directory"
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### From Multi-Site to Single-Site
|
|
570
|
+
|
|
571
|
+
1. **Choose Primary Site** from multi-site config
|
|
572
|
+
2. **Extract Configuration**
|
|
573
|
+
```bash
|
|
574
|
+
# From mcp-wordpress.config.json site
|
|
575
|
+
WORDPRESS_SITE_URL=https://primary-site.com
|
|
576
|
+
WORDPRESS_USERNAME=primary-username
|
|
577
|
+
WORDPRESS_APP_PASSWORD=primary-password
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
3. **Update Environment** and remove config file
|
|
581
|
+
|
|
582
|
+
## 🛡️ Security Best Practices
|
|
583
|
+
|
|
584
|
+
### Credential Management
|
|
585
|
+
|
|
586
|
+
1. **Never commit credentials** to version control
|
|
587
|
+
```bash
|
|
588
|
+
# Add to .gitignore
|
|
589
|
+
.env
|
|
590
|
+
mcp-wordpress.config.json
|
|
591
|
+
claude_desktop_config.json
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
2. **Use Application Passwords** instead of main passwords
|
|
595
|
+
3. **Rotate credentials regularly**
|
|
596
|
+
4. **Use minimal permissions** for WordPress users
|
|
597
|
+
5. **Monitor authentication logs**
|
|
598
|
+
|
|
599
|
+
### Configuration Security
|
|
600
|
+
|
|
601
|
+
1. **File Permissions**
|
|
602
|
+
```bash
|
|
603
|
+
# Secure configuration files
|
|
604
|
+
chmod 600 .env
|
|
605
|
+
chmod 600 mcp-wordpress.config.json
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
2. **Environment Isolation**
|
|
609
|
+
```bash
|
|
610
|
+
# Separate configs for different environments
|
|
611
|
+
.env.development
|
|
612
|
+
.env.staging
|
|
613
|
+
.env.production
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
3. **Secrets Management**
|
|
617
|
+
```bash
|
|
618
|
+
# Use secrets management for production
|
|
619
|
+
# Examples: AWS Secrets Manager, HashiCorp Vault
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
## 📚 Configuration Examples
|
|
623
|
+
|
|
624
|
+
### Example Templates
|
|
625
|
+
|
|
626
|
+
Complete configuration examples are available in:
|
|
627
|
+
- **[Single-Site Template](../examples/basic-setup/.env.example)**
|
|
628
|
+
- **[Multi-Site Template](../examples/multi-site/mcp-wordpress.config.json.example)**
|
|
629
|
+
- **[Docker Template](../examples/docker/docker-compose.yml)**
|
|
630
|
+
- **[Claude Desktop Template](../examples/claude-desktop/config.json)**
|
|
631
|
+
|
|
632
|
+
### Production Configuration
|
|
633
|
+
|
|
634
|
+
```bash
|
|
635
|
+
# Production best practices
|
|
636
|
+
NODE_ENV=production
|
|
637
|
+
DEBUG=false
|
|
638
|
+
LOG_LEVEL=warn
|
|
639
|
+
WORDPRESS_AUTH_METHOD=app-password
|
|
640
|
+
DISABLE_CACHE=false
|
|
641
|
+
CACHE_TTL=600
|
|
642
|
+
RATE_LIMIT_REQUESTS=1000
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### Development Configuration
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
# Development best practices
|
|
649
|
+
NODE_ENV=development
|
|
650
|
+
DEBUG=true
|
|
651
|
+
LOG_LEVEL=debug
|
|
652
|
+
WORDPRESS_AUTH_METHOD=app-password
|
|
653
|
+
DISABLE_CACHE=false
|
|
654
|
+
CACHE_TTL=60
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
**Need help with configuration?** Check the [Troubleshooting Guide](TROUBLESHOOTING.md) or
|
|
660
|
+
[open an issue](https://github.com/docdyhr/mcp-wordpress/issues/new) for assistance.
|