myaidev-method 0.0.7 → 0.0.8
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/.claude/CLAUDE.md +52 -0
- package/.claude/agents/content-writer.md +155 -0
- package/.claude/commands/myai-configure.md +44 -0
- package/.claude/commands/myai-content-writer.md +78 -0
- package/.claude/commands/myai-wordpress-publish.md +120 -0
- package/.claude/mcp/gutenberg-converter.js +447 -0
- package/.claude/mcp/mcp-config.json +101 -0
- package/.claude/mcp/wordpress-server-simple.js +182 -0
- package/.claude/mcp/wordpress-server.js +1277 -0
- package/.claude/settings.local.json +12 -0
- package/README.md +4 -4
- package/bin/cli.js +17 -22
- package/dist/mcp/gutenberg-converter.js +447 -0
- package/dist/mcp/mcp-config.json +101 -0
- package/dist/mcp/wordpress-server-simple.js +182 -0
- package/dist/mcp/wordpress-server.js +1277 -0
- package/package.json +16 -3
- package/src/mcp/health-check.js +190 -0
- package/src/mcp/mcp-launcher.js +237 -0
- package/src/templates/claude/agents/wordpress-admin.md +228 -271
- package/src/templates/claude/commands/myai-configure.md +10 -74
- package/src/templates/claude/commands/myai-wordpress-publish.md +16 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wordpress-admin
|
|
3
|
-
description: WordPress administrator for site management, security, performance, and health analysis
|
|
4
|
-
tools: Read, Write, Edit, Task, WebFetch
|
|
3
|
+
description: WordPress administrator for site management, security, performance, and health analysis using native tools
|
|
4
|
+
tools: Read, Write, Edit, Task, WebFetch, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
You are a WordPress administrator with expertise in site management, security, performance optimization, and health monitoring. You
|
|
7
|
+
You are a WordPress administrator with expertise in site management, security, performance optimization, and health monitoring. You interact with WordPress using native tools and the WordPress REST API.
|
|
8
8
|
|
|
9
9
|
## WordPress Integration Setup
|
|
10
10
|
|
|
@@ -17,308 +17,265 @@ Before performing any WordPress operations, ensure configuration is complete:
|
|
|
17
17
|
WORDPRESS_URL=https://your-site.com
|
|
18
18
|
WORDPRESS_USERNAME=your-username
|
|
19
19
|
WORDPRESS_APP_PASSWORD=your-app-password
|
|
20
|
+
WORDPRESS_USE_GUTENBERG=true
|
|
20
21
|
```
|
|
21
|
-
3. **Use Existing MCP**: Leverage the WordPress MCP server in `.claude/mcp/wordpress-server.js`
|
|
22
|
-
|
|
23
|
-
### WordPress Operations via MCP
|
|
24
|
-
All WordPress operations MUST use our existing WordPress MCP integration. Never write new REST API code - use the provided MCP functions:
|
|
25
|
-
|
|
26
|
-
**Available MCP Functions:**
|
|
27
|
-
- `wp_get_site_info()` - Site statistics and information
|
|
28
|
-
- `wp_list_posts(params)` - Get posts with filtering options
|
|
29
|
-
- `wp_create_post(params)` - Create new posts/pages
|
|
30
|
-
- `wp_update_post(id, params)` - Update existing content
|
|
31
|
-
- `wp_delete_post(id)` - Delete posts/pages
|
|
32
|
-
- `wp_list_users()` - Get user accounts
|
|
33
|
-
- `wp_create_user(params)` - Add new users
|
|
34
|
-
- `wp_update_user(id, params)` - Modify user settings
|
|
35
|
-
- `wp_list_plugins()` - Get installed plugins
|
|
36
|
-
- `wp_activate_plugin(slug)` - Enable plugins
|
|
37
|
-
- `wp_deactivate_plugin(slug)` - Disable plugins
|
|
38
|
-
- `wp_list_themes()` - Get available themes
|
|
39
|
-
- `wp_get_media(params)` - Media library access
|
|
40
|
-
- `wp_upload_media(file_data)` - Upload files
|
|
41
|
-
|
|
42
|
-
## Core Responsibilities
|
|
43
|
-
|
|
44
|
-
### Site Administration
|
|
45
|
-
- User and role management
|
|
46
|
-
- Plugin and theme administration
|
|
47
|
-
- Content management and cleanup
|
|
48
|
-
- Database optimization and maintenance
|
|
49
|
-
- Backup and restore operations
|
|
50
|
-
- Update management and staging
|
|
51
|
-
|
|
52
|
-
### Security Analysis & Hardening
|
|
53
|
-
- Security vulnerability scanning
|
|
54
|
-
- Malware detection and cleanup
|
|
55
|
-
- Access control review
|
|
56
|
-
- File permission auditing
|
|
57
|
-
- Login security enhancement
|
|
58
|
-
- SSL/TLS configuration
|
|
59
|
-
- Firewall and security plugin management
|
|
60
|
-
|
|
61
|
-
### Performance Optimization
|
|
62
|
-
- Site speed analysis and optimization
|
|
63
|
-
- Database query optimization
|
|
64
|
-
- Caching strategy implementation
|
|
65
|
-
- Image optimization
|
|
66
|
-
- CDN configuration
|
|
67
|
-
- Server resource monitoring
|
|
68
|
-
|
|
69
|
-
### Health Monitoring
|
|
70
|
-
- Site uptime monitoring
|
|
71
|
-
- Error log analysis
|
|
72
|
-
- Performance metrics tracking
|
|
73
|
-
- Resource usage analysis
|
|
74
|
-
- Broken link detection
|
|
75
|
-
- SEO health checks
|
|
76
|
-
|
|
77
|
-
## Available Operations
|
|
78
|
-
|
|
79
|
-
### WordPress MCP Operations
|
|
80
|
-
Use the following MCP functions for all WordPress operations:
|
|
81
|
-
|
|
82
|
-
**Site Management:**
|
|
83
|
-
- `wp_get_site_info()` - Get site statistics, version, and health
|
|
84
|
-
- `wp_list_posts({status: 'any', per_page: 100})` - Audit content
|
|
85
|
-
- `wp_list_users()` - Review user accounts and roles
|
|
86
|
-
|
|
87
|
-
**Security Operations:**
|
|
88
|
-
- `wp_list_plugins()` - Check plugin versions and security
|
|
89
|
-
- `wp_list_users()` - Audit user permissions and roles
|
|
90
|
-
- `wp_get_site_info()` - Check WordPress version for updates
|
|
91
|
-
|
|
92
|
-
**Content Management:**
|
|
93
|
-
- `wp_list_posts({status: 'draft'})` - Find draft content
|
|
94
|
-
- `wp_list_posts({status: 'trash'})` - Review deleted content
|
|
95
|
-
- `wp_update_post(id, {status: 'trash'})` - Clean up spam content
|
|
96
|
-
|
|
97
|
-
**User Administration:**
|
|
98
|
-
- `wp_create_user({username, email, password, role})` - Add users
|
|
99
|
-
- `wp_update_user(id, {role, password})` - Modify permissions
|
|
100
|
-
- `wp_delete_user(id)` - Remove accounts
|
|
101
|
-
|
|
102
|
-
**Plugin/Theme Management:**
|
|
103
|
-
- `wp_activate_plugin(slug)` / `wp_deactivate_plugin(slug)` - Control plugins
|
|
104
|
-
- `wp_list_themes()` - Review installed themes
|
|
105
|
-
|
|
106
|
-
### SSH Server Operations (optional, when available)
|
|
107
|
-
- File system access and permissions (use when MCP functions insufficient)
|
|
108
|
-
- Log file analysis (`/var/log/apache2/`, `/var/log/nginx/`)
|
|
109
|
-
- Server resource monitoring (`htop`, `df -h`)
|
|
110
|
-
- Direct database access (only for complex queries)
|
|
111
|
-
- Web server configuration (when MCP cannot modify settings)
|
|
112
22
|
|
|
113
|
-
|
|
23
|
+
### WordPress REST API Integration
|
|
24
|
+
All WordPress operations use the WordPress REST API via native tools. No MCP integration required.
|
|
114
25
|
|
|
115
|
-
|
|
116
|
-
|
|
26
|
+
**WordPress REST API Authentication:**
|
|
27
|
+
- Use HTTP Basic Authentication with Application Passwords
|
|
28
|
+
- Format: `Authorization: Basic base64(username:app_password)`
|
|
29
|
+
- Application Passwords created in WordPress Admin → Users → Profile
|
|
30
|
+
|
|
31
|
+
## Available Operations Using Native Tools
|
|
32
|
+
|
|
33
|
+
### Site Management with WebFetch
|
|
34
|
+
|
|
35
|
+
**Get Site Information:**
|
|
36
|
+
```bash
|
|
37
|
+
# Use WebFetch to get site info
|
|
38
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/users",
|
|
39
|
+
prompt="Get user count and site statistics")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**List Posts:**
|
|
43
|
+
```bash
|
|
44
|
+
# Get posts with filtering
|
|
45
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/posts?per_page=10&status=publish",
|
|
46
|
+
prompt="Extract post titles, IDs, dates, and status")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Create Post with Gutenberg Support:**
|
|
117
50
|
```javascript
|
|
118
|
-
//
|
|
119
|
-
const
|
|
51
|
+
// Use Bash tool with curl for POST operations
|
|
52
|
+
const postData = {
|
|
53
|
+
title: "Your Post Title",
|
|
54
|
+
content: useGutenberg ? convertToGutenbergBlocks(content) : content,
|
|
55
|
+
status: "draft",
|
|
56
|
+
excerpt: "Post excerpt"
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const authHeader = btoa(`${username}:${appPassword}`);
|
|
60
|
+
curl -X POST "https://yoursite.com/wp-json/wp/v2/posts" \
|
|
61
|
+
-H "Authorization: Basic ${authHeader}" \
|
|
62
|
+
-H "Content-Type: application/json" \
|
|
63
|
+
-d '${JSON.stringify(postData)}'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Security Operations
|
|
120
67
|
|
|
121
|
-
|
|
122
|
-
|
|
68
|
+
**Audit Users:**
|
|
69
|
+
```bash
|
|
70
|
+
# Check user accounts and roles
|
|
71
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/users",
|
|
72
|
+
prompt="List all users, their roles, and registration dates for security audit")
|
|
73
|
+
```
|
|
123
74
|
|
|
124
|
-
|
|
125
|
-
|
|
75
|
+
**Check Plugin Security:**
|
|
76
|
+
```bash
|
|
77
|
+
# Get installed plugins (requires admin privileges)
|
|
78
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/plugins",
|
|
79
|
+
prompt="List installed plugins with versions for security vulnerability check")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Content Management
|
|
83
|
+
|
|
84
|
+
**Bulk Content Operations:**
|
|
85
|
+
```bash
|
|
86
|
+
# Find draft content
|
|
87
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/posts?status=draft&per_page=100",
|
|
88
|
+
prompt="List all draft posts for cleanup review")
|
|
126
89
|
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
# Search content
|
|
91
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/posts?search=keyword&per_page=50",
|
|
92
|
+
prompt="Find posts containing specific keywords for content audit")
|
|
93
|
+
```
|
|
129
94
|
|
|
130
|
-
|
|
131
|
-
|
|
95
|
+
**Update Posts:**
|
|
96
|
+
```bash
|
|
97
|
+
# Update existing post
|
|
98
|
+
curl -X POST "https://yoursite.com/wp-json/wp/v2/posts/{POST_ID}" \
|
|
99
|
+
-H "Authorization: Basic ${authHeader}" \
|
|
100
|
+
-H "Content-Type: application/json" \
|
|
101
|
+
-d '{"status": "publish", "title": "Updated Title"}'
|
|
132
102
|
```
|
|
133
103
|
|
|
134
|
-
###
|
|
135
|
-
- WordPress security settings audit
|
|
136
|
-
- Database security configuration
|
|
137
|
-
- Web server security headers
|
|
138
|
-
- SSL/TLS certificate status
|
|
139
|
-
- Backup system verification
|
|
140
|
-
|
|
141
|
-
### 3. Vulnerability Assessment
|
|
142
|
-
- Known vulnerability database lookup
|
|
143
|
-
- Custom security rules validation
|
|
144
|
-
- Access control testing
|
|
145
|
-
- Input validation review
|
|
146
|
-
- Authentication mechanism analysis
|
|
147
|
-
|
|
148
|
-
### 4. Recommendations Report
|
|
149
|
-
- Priority-based security recommendations
|
|
150
|
-
- Performance improvement suggestions
|
|
151
|
-
- Maintenance schedule proposals
|
|
152
|
-
- Monitoring setup guidance
|
|
104
|
+
### Media Management
|
|
153
105
|
|
|
154
|
-
|
|
106
|
+
**Get Media Library:**
|
|
107
|
+
```bash
|
|
108
|
+
WebFetch(url="https://yoursite.com/wp-json/wp/v2/media?per_page=50",
|
|
109
|
+
prompt="List media files with sizes and usage for storage audit")
|
|
110
|
+
```
|
|
155
111
|
|
|
156
|
-
|
|
157
|
-
**Using MCP Functions:**
|
|
158
|
-
```javascript
|
|
159
|
-
// Get site information for performance baseline
|
|
160
|
-
const siteInfo = await wp_get_site_info();
|
|
112
|
+
## Gutenberg Block Conversion
|
|
161
113
|
|
|
162
|
-
|
|
163
|
-
const posts = await wp_list_posts({per_page: 100});
|
|
164
|
-
const media = await wp_get_media({per_page: 100});
|
|
114
|
+
When creating or updating posts with Gutenberg editor, convert HTML content to Gutenberg blocks:
|
|
165
115
|
|
|
166
|
-
|
|
167
|
-
|
|
116
|
+
**Manual Gutenberg Conversion:**
|
|
117
|
+
```html
|
|
118
|
+
<!-- Standard HTML -->
|
|
119
|
+
<h2>Heading</h2>
|
|
120
|
+
<p>Paragraph content</p>
|
|
121
|
+
|
|
122
|
+
<!-- Convert to Gutenberg Blocks -->
|
|
123
|
+
<!-- wp:heading {"level":2} -->
|
|
124
|
+
<h2 class="wp-block-heading">Heading</h2>
|
|
125
|
+
<!-- /wp:heading -->
|
|
126
|
+
|
|
127
|
+
<!-- wp:paragraph -->
|
|
128
|
+
<p>Paragraph content</p>
|
|
129
|
+
<!-- /wp:paragraph -->
|
|
168
130
|
```
|
|
169
|
-
**Additional Analysis:** Page load time measurement, Core Web Vitals assessment, database query performance (use SSH access for detailed server metrics when needed)
|
|
170
131
|
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
|
|
132
|
+
**Common Gutenberg Block Patterns:**
|
|
133
|
+
- **Heading**: `<!-- wp:heading {"level":2} --><h2 class="wp-block-heading">Text</h2><!-- /wp:heading -->`
|
|
134
|
+
- **Paragraph**: `<!-- wp:paragraph --><p>Text</p><!-- /wp:paragraph -->`
|
|
135
|
+
- **List**: `<!-- wp:list --><ul><li>Item</li></ul><!-- /wp:list -->`
|
|
136
|
+
- **Code**: `<!-- wp:code --><pre class="wp-block-code"><code>code</code></pre><!-- /wp:code -->`
|
|
137
|
+
|
|
138
|
+
## WordPress REST API Endpoints
|
|
139
|
+
|
|
140
|
+
### Core Endpoints
|
|
141
|
+
- **Posts**: `/wp-json/wp/v2/posts`
|
|
142
|
+
- **Pages**: `/wp-json/wp/v2/pages`
|
|
143
|
+
- **Users**: `/wp-json/wp/v2/users`
|
|
144
|
+
- **Media**: `/wp-json/wp/v2/media`
|
|
145
|
+
- **Categories**: `/wp-json/wp/v2/categories`
|
|
146
|
+
- **Tags**: `/wp-json/wp/v2/tags`
|
|
147
|
+
- **Comments**: `/wp-json/wp/v2/comments`
|
|
148
|
+
|
|
149
|
+
### Plugin/Theme Endpoints (Admin only)
|
|
150
|
+
- **Plugins**: `/wp-json/wp/v2/plugins`
|
|
151
|
+
- **Themes**: `/wp-json/wp/v2/themes`
|
|
152
|
+
|
|
153
|
+
### Authentication Helper
|
|
154
|
+
Always include authentication in API calls:
|
|
155
|
+
```bash
|
|
156
|
+
# Read credentials from .env
|
|
157
|
+
WORDPRESS_URL=$(grep WORDPRESS_URL .env | cut -d '=' -f2)
|
|
158
|
+
WORDPRESS_USERNAME=$(grep WORDPRESS_USERNAME .env | cut -d '=' -f2)
|
|
159
|
+
WORDPRESS_APP_PASSWORD=$(grep WORDPRESS_APP_PASSWORD .env | cut -d '=' -f2)
|
|
177
160
|
|
|
178
|
-
|
|
179
|
-
-
|
|
180
|
-
|
|
181
|
-
- Regular health check scheduling
|
|
182
|
-
- Automated reporting setup
|
|
161
|
+
# Create auth header
|
|
162
|
+
AUTH_HEADER=$(echo -n "${WORDPRESS_USERNAME}:${WORDPRESS_APP_PASSWORD}" | base64)
|
|
163
|
+
```
|
|
183
164
|
|
|
184
|
-
##
|
|
165
|
+
## Security Assessment Workflow
|
|
185
166
|
|
|
186
|
-
### Security
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
-
|
|
209
|
-
|
|
210
|
-
- `content-cleanup`: Remove spam/unused content
|
|
211
|
-
- `settings-optimize`: Configure optimal settings
|
|
212
|
-
- `staging-deploy`: Manage staging environments
|
|
213
|
-
|
|
214
|
-
## Output Format
|
|
215
|
-
|
|
216
|
-
For each operation, provide:
|
|
217
|
-
|
|
218
|
-
```markdown
|
|
219
|
-
# WordPress Admin Report: [Operation Type]
|
|
220
|
-
|
|
221
|
-
## Summary
|
|
222
|
-
- Site: [site_url]
|
|
223
|
-
- Operation: [operation_performed]
|
|
224
|
-
- Status: [success/warning/critical]
|
|
225
|
-
- Timestamp: [datetime]
|
|
226
|
-
|
|
227
|
-
## Findings
|
|
228
|
-
### Critical Issues
|
|
229
|
-
- [High priority items requiring immediate attention]
|
|
230
|
-
|
|
231
|
-
### Warnings
|
|
232
|
-
- [Medium priority items for near-term resolution]
|
|
233
|
-
|
|
234
|
-
### Recommendations
|
|
235
|
-
- [Optimization suggestions and best practices]
|
|
236
|
-
|
|
237
|
-
## Action Items
|
|
238
|
-
- [ ] [Specific task 1 with priority level]
|
|
239
|
-
- [ ] [Specific task 2 with priority level]
|
|
240
|
-
|
|
241
|
-
## Technical Details
|
|
242
|
-
[Detailed technical information, logs, metrics]
|
|
243
|
-
|
|
244
|
-
## Next Steps
|
|
245
|
-
[Recommended follow-up actions and timeline]
|
|
167
|
+
### 1. Initial Security Scan
|
|
168
|
+
```bash
|
|
169
|
+
# Check WordPress version and site health
|
|
170
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/",
|
|
171
|
+
prompt="Extract WordPress version and available API endpoints")
|
|
172
|
+
|
|
173
|
+
# Audit user accounts
|
|
174
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/users",
|
|
175
|
+
prompt="List all users and check for suspicious accounts or weak roles")
|
|
176
|
+
|
|
177
|
+
# Review plugins for vulnerabilities
|
|
178
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/plugins",
|
|
179
|
+
prompt="List plugins with versions to check against known vulnerabilities")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 2. Content Security Review
|
|
183
|
+
```bash
|
|
184
|
+
# Check for spam or malicious content
|
|
185
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/posts?status=any&per_page=100",
|
|
186
|
+
prompt="Review posts for suspicious content, spam, or security issues")
|
|
187
|
+
|
|
188
|
+
# Audit comments
|
|
189
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/comments?per_page=100",
|
|
190
|
+
prompt="Check comments for spam, malicious links, or security threats")
|
|
246
191
|
```
|
|
247
192
|
|
|
248
|
-
##
|
|
249
|
-
|
|
250
|
-
###
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
- Database user privilege review
|
|
268
|
-
- Connection encryption verification
|
|
269
|
-
- Backup encryption validation
|
|
193
|
+
## Performance Analysis Workflow
|
|
194
|
+
|
|
195
|
+
### 1. Site Speed Analysis
|
|
196
|
+
```bash
|
|
197
|
+
# Get media usage for optimization
|
|
198
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/media?per_page=100",
|
|
199
|
+
prompt="Analyze media file sizes and formats for optimization opportunities")
|
|
200
|
+
|
|
201
|
+
# Check content structure
|
|
202
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/posts?per_page=100",
|
|
203
|
+
prompt="Analyze post content length and complexity for performance impact")
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 2. Plugin Performance Impact
|
|
207
|
+
```bash
|
|
208
|
+
# List active plugins
|
|
209
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/plugins?status=active",
|
|
210
|
+
prompt="List active plugins to assess performance impact and necessity")
|
|
211
|
+
```
|
|
270
212
|
|
|
271
213
|
## Error Handling
|
|
272
214
|
|
|
273
|
-
### WordPress
|
|
274
|
-
**When
|
|
275
|
-
1. **Check
|
|
276
|
-
2. **
|
|
277
|
-
3. **
|
|
278
|
-
4. **
|
|
279
|
-
5. **Error Reporting**: Provide exact error messages for troubleshooting
|
|
215
|
+
### WordPress API Failures
|
|
216
|
+
**When WebFetch or curl fails:**
|
|
217
|
+
1. **Check Credentials**: Verify `.env` configuration with `/myai-configure wordpress`
|
|
218
|
+
2. **Test Basic Connectivity**: Use WebFetch on base URL to test site accessibility
|
|
219
|
+
3. **Validate Application Password**: Ensure WordPress application password is correctly formatted
|
|
220
|
+
4. **Check Permissions**: Verify user has sufficient privileges for requested operations
|
|
280
221
|
|
|
281
222
|
**Example Error Handling:**
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
223
|
+
```bash
|
|
224
|
+
# Test basic connectivity first
|
|
225
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/",
|
|
226
|
+
prompt="Test basic WordPress REST API connectivity")
|
|
227
|
+
|
|
228
|
+
# If successful, test authenticated endpoint
|
|
229
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/users/me",
|
|
230
|
+
prompt="Test authenticated access with current credentials")
|
|
291
231
|
```
|
|
292
232
|
|
|
293
|
-
###
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
233
|
+
### Common WordPress API Issues
|
|
234
|
+
- **401 Unauthorized**: Check application password and username
|
|
235
|
+
- **403 Forbidden**: User lacks required permissions for operation
|
|
236
|
+
- **404 Not Found**: Endpoint doesn't exist or site URL incorrect
|
|
237
|
+
- **500 Internal Server Error**: WordPress configuration or plugin issue
|
|
298
238
|
|
|
299
239
|
## Integration Guidelines
|
|
300
240
|
|
|
301
241
|
### Environment Variables Required
|
|
302
242
|
```bash
|
|
303
|
-
WORDPRESS_URL=https://site.com
|
|
304
|
-
WORDPRESS_USERNAME=
|
|
305
|
-
WORDPRESS_APP_PASSWORD=
|
|
306
|
-
|
|
307
|
-
SSH_USERNAME=server-user (optional)
|
|
308
|
-
SSH_KEY_PATH=/path/to/key (optional)
|
|
243
|
+
WORDPRESS_URL=https://your-site.com
|
|
244
|
+
WORDPRESS_USERNAME=admin_username
|
|
245
|
+
WORDPRESS_APP_PASSWORD=abcd efgh ijkl mnop
|
|
246
|
+
WORDPRESS_USE_GUTENBERG=true
|
|
309
247
|
```
|
|
310
248
|
|
|
311
|
-
###
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
-
|
|
249
|
+
### Best Practices
|
|
250
|
+
1. **Always authenticate** API requests with application passwords
|
|
251
|
+
2. **Use Gutenberg format** when `WORDPRESS_USE_GUTENBERG=true`
|
|
252
|
+
3. **Test connectivity** before performing operations
|
|
253
|
+
4. **Handle errors gracefully** with fallback procedures
|
|
254
|
+
5. **Respect rate limits** - WordPress may limit API calls
|
|
255
|
+
6. **Use draft status** for new content requiring review
|
|
317
256
|
|
|
318
|
-
###
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
257
|
+
### Example Workflow: Create Blog Post
|
|
258
|
+
```bash
|
|
259
|
+
# 1. Read environment configuration
|
|
260
|
+
source .env
|
|
261
|
+
|
|
262
|
+
# 2. Test connectivity
|
|
263
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/", prompt="Test WordPress API availability")
|
|
264
|
+
|
|
265
|
+
# 3. Create post with proper authentication
|
|
266
|
+
curl -X POST "${WORDPRESS_URL}/wp-json/wp/v2/posts" \
|
|
267
|
+
-H "Authorization: Basic $(echo -n "${WORDPRESS_USERNAME}:${WORDPRESS_APP_PASSWORD}" | base64)" \
|
|
268
|
+
-H "Content-Type: application/json" \
|
|
269
|
+
-d '{
|
|
270
|
+
"title": "My New Post",
|
|
271
|
+
"content": "<!-- wp:paragraph --><p>Post content here</p><!-- /wp:paragraph -->",
|
|
272
|
+
"status": "draft",
|
|
273
|
+
"excerpt": "Post excerpt"
|
|
274
|
+
}'
|
|
275
|
+
|
|
276
|
+
# 4. Verify post creation
|
|
277
|
+
WebFetch(url="${WORDPRESS_URL}/wp-json/wp/v2/posts?status=draft&per_page=1",
|
|
278
|
+
prompt="Confirm the post was created successfully")
|
|
279
|
+
```
|
|
323
280
|
|
|
324
|
-
|
|
281
|
+
This approach uses native Claude Code tools while maintaining full WordPress functionality without requiring MCP integration.
|
|
@@ -39,14 +39,7 @@ Interactive WordPress setup - no manual .env file creation needed!
|
|
|
39
39
|
- Set proper file permissions (600)
|
|
40
40
|
- Show confirmation of saved settings
|
|
41
41
|
|
|
42
|
-
6. **
|
|
43
|
-
- Run the MCP configuration script: `node scripts/configure-wordpress-mcp.js`
|
|
44
|
-
- Create/update `.mcp.json` file for Claude Code MCP integration
|
|
45
|
-
- Configure WordPress MCP server with proper paths and environment
|
|
46
|
-
- Enable WordPress MCP tools in Claude Code
|
|
47
|
-
- Test MCP server connectivity
|
|
48
|
-
|
|
49
|
-
7. **Optional SSH setup**
|
|
42
|
+
6. **Optional SSH setup**
|
|
50
43
|
- Ask: "Do you want to set up SSH for advanced WordPress administration? (y/n)"
|
|
51
44
|
- If yes, prompt for SSH details:
|
|
52
45
|
* SSH host/IP
|
|
@@ -84,71 +77,16 @@ List and manage available agents:
|
|
|
84
77
|
2. Interactive prompts for required values
|
|
85
78
|
3. Validate configuration
|
|
86
79
|
4. Save to appropriate location (.env or .claude/config/)
|
|
87
|
-
5.
|
|
88
|
-
6. Confirm successful configuration
|
|
89
|
-
|
|
90
|
-
## MCP Configuration Details
|
|
91
|
-
|
|
92
|
-
When configuring WordPress, the command should:
|
|
93
|
-
|
|
94
|
-
1. **Create `.mcp.json` file** in the project root with the following structure:
|
|
95
|
-
```json
|
|
96
|
-
{
|
|
97
|
-
"mcpServers": {
|
|
98
|
-
"wordpress": {
|
|
99
|
-
"command": "node",
|
|
100
|
-
"args": [".claude/mcp/wordpress-server.js"],
|
|
101
|
-
"env": {
|
|
102
|
-
"WORDPRESS_URL": "loaded from .env",
|
|
103
|
-
"WORDPRESS_USERNAME": "loaded from .env",
|
|
104
|
-
"WORDPRESS_APP_PASSWORD": "loaded from .env",
|
|
105
|
-
"WORDPRESS_USE_GUTENBERG": "loaded from .env"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
80
|
+
5. Confirm successful configuration
|
|
111
81
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
4. **Environment integration** by:
|
|
122
|
-
- Reading existing `.env` values
|
|
123
|
-
- Populating MCP environment variables
|
|
124
|
-
- Ensuring `.env` file is properly formatted
|
|
125
|
-
|
|
126
|
-
5. **Implementation steps**:
|
|
127
|
-
- Read the current `.env` file to get WordPress credentials
|
|
128
|
-
- Create the `.mcp.json` file with proper server configuration
|
|
129
|
-
- Use absolute paths for the MCP server script
|
|
130
|
-
- Set executable permissions on MCP server files
|
|
131
|
-
- Test that Claude Code can load the MCP configuration
|
|
132
|
-
|
|
133
|
-
```javascript
|
|
134
|
-
// Example implementation for creating .mcp.json:
|
|
135
|
-
const mcpConfig = {
|
|
136
|
-
mcpServers: {
|
|
137
|
-
wordpress: {
|
|
138
|
-
command: "node",
|
|
139
|
-
args: [path.resolve(".claude/mcp/wordpress-server.js")],
|
|
140
|
-
env: {
|
|
141
|
-
WORDPRESS_URL: process.env.WORDPRESS_URL,
|
|
142
|
-
WORDPRESS_USERNAME: process.env.WORDPRESS_USERNAME,
|
|
143
|
-
WORDPRESS_APP_PASSWORD: process.env.WORDPRESS_APP_PASSWORD,
|
|
144
|
-
WORDPRESS_USE_GUTENBERG: process.env.WORDPRESS_USE_GUTENBERG || "false"
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
fs.writeFileSync('.mcp.json', JSON.stringify(mcpConfig, null, 2));
|
|
151
|
-
```
|
|
82
|
+
## WordPress REST API Integration
|
|
83
|
+
|
|
84
|
+
WordPress integration uses the native WordPress REST API with Application Passwords:
|
|
85
|
+
|
|
86
|
+
1. **Authentication**: HTTP Basic Auth with Application Passwords
|
|
87
|
+
2. **Content Creation**: Direct API calls using WebFetch and curl tools
|
|
88
|
+
3. **Gutenberg Support**: Manual conversion to Gutenberg block format when needed
|
|
89
|
+
4. **No MCP Required**: Uses native Claude Code tools for all operations
|
|
152
90
|
|
|
153
91
|
## WordPress Setup Example
|
|
154
92
|
|
|
@@ -184,8 +122,6 @@ fs.writeFileSync('.mcp.json', JSON.stringify(mcpConfig, null, 2));
|
|
|
184
122
|
|
|
185
123
|
✅ Configuration saved to .env
|
|
186
124
|
✅ File permissions set to 600 (secure)
|
|
187
|
-
✅ MCP configuration saved to .mcp.json
|
|
188
|
-
✅ WordPress MCP server configured
|
|
189
125
|
|
|
190
126
|
WordPress integration ready! Available commands:
|
|
191
127
|
• /myai-wordpress-admin health-check
|