mcp-wordpress 2.3.0 → 2.4.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 +503 -0
- package/dist/client/api.d.ts +90 -0
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +90 -0
- package/dist/client/api.js.map +1 -1
- package/dist/tools/media.d.ts +43 -4
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +43 -4
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/posts.d.ts +225 -4
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +225 -4
- package/dist/tools/posts.js.map +1 -1
- package/docs/DOCKER_PUBLISHING_TROUBLESHOOTING.md +233 -0
- package/docs/PUBLISHING-TROUBLESHOOTING.md +227 -0
- package/docs/api/README.md +53 -11
- package/docs/api/openapi.json +10 -10
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_create_post.md +9 -3
- package/docs/api/tools/wp_delete_post.md +2 -3
- package/docs/api/tools/wp_get_current_user.md +7 -1
- package/docs/api/tools/wp_get_post.md +2 -3
- package/docs/api/tools/wp_get_post_revisions.md +1 -1
- package/docs/api/tools/wp_list_posts.md +10 -3
- package/docs/api/tools/wp_list_users.md +8 -1
- package/docs/api/tools/wp_search_site.md +8 -1
- package/docs/api/tools/wp_test_auth.md +8 -1
- package/docs/api/tools/wp_update_post.md +2 -3
- package/docs/examples/docker-production.md +801 -0
- package/docs/examples/multi-site-setup.md +575 -0
- package/docs/examples/single-site-setup.md +390 -0
- package/docs/examples/use-case-workflows.md +469 -0
- package/package.json +4 -1
- package/src/client/api.ts +90 -0
- package/src/tools/media.ts +43 -4
- package/src/tools/posts.ts +225 -4
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
# Real-World Use Case Workflows
|
|
2
|
+
|
|
3
|
+
Comprehensive examples of how different types of users can leverage MCP WordPress for their specific needs.
|
|
4
|
+
|
|
5
|
+
## Content Creator Workflows
|
|
6
|
+
|
|
7
|
+
### Daily Content Creation Routine
|
|
8
|
+
|
|
9
|
+
**Morning Content Planning**
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
💬 "Analyze my WordPress analytics from last week and suggest 3 trending topics for new blog posts"
|
|
13
|
+
|
|
14
|
+
💬 "Create a content calendar for the next two weeks based on seasonal trends and my top-performing content categories"
|
|
15
|
+
|
|
16
|
+
💬 "List all draft posts and prioritize them based on SEO potential and trending keywords"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Content Production**
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
💬 "Create a comprehensive blog post about 'Remote Work Productivity Tips' with:
|
|
23
|
+
- 2000+ words
|
|
24
|
+
- SEO-optimized title and meta description
|
|
25
|
+
- Proper heading structure (H1, H2, H3)
|
|
26
|
+
- Focus keyword: 'remote work productivity'
|
|
27
|
+
- Include call-to-action for newsletter signup"
|
|
28
|
+
|
|
29
|
+
💬 "Upload these 5 product images and create an optimized gallery with alt text and captions"
|
|
30
|
+
|
|
31
|
+
💬 "Generate social media snippets from my latest blog post for Twitter, LinkedIn, and Facebook"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Content Optimization**
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
💬 "Review all posts from the last month and update any with broken internal links"
|
|
38
|
+
|
|
39
|
+
💬 "Find all posts with missing featured images and suggest relevant stock photos"
|
|
40
|
+
|
|
41
|
+
💬 "Optimize my top 10 posts for better SEO by improving meta descriptions and adding internal links"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Performance Review**
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
💬 "Show me performance metrics for all posts published this month"
|
|
48
|
+
|
|
49
|
+
💬 "Identify my top 5 performing posts and create similar content ideas"
|
|
50
|
+
|
|
51
|
+
💬 "Generate a weekly performance report with engagement metrics and optimization recommendations"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## E-commerce Site Management
|
|
55
|
+
|
|
56
|
+
### Product Launch Workflow
|
|
57
|
+
|
|
58
|
+
**Pre-Launch Preparation**
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
💬 "Create a product launch landing page for the new iPhone 15 case with:
|
|
62
|
+
- Product specifications and features
|
|
63
|
+
- High-quality image gallery
|
|
64
|
+
- Pricing and availability information
|
|
65
|
+
- Pre-order form integration"
|
|
66
|
+
|
|
67
|
+
💬 "Set up product category 'Mobile Accessories' and add relevant tags"
|
|
68
|
+
|
|
69
|
+
💬 "Create an email campaign announcement page with signup form"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Launch Day Execution**
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
💬 "Publish the iPhone 15 case product page and announce it on all social media channels"
|
|
76
|
+
|
|
77
|
+
💬 "Create a limited-time promotion page with countdown timer and special pricing"
|
|
78
|
+
|
|
79
|
+
💬 "Monitor and respond to customer questions in the comments section"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Post-Launch Management**
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
💬 "Update inventory status for all iPhone cases and mark out-of-stock items"
|
|
86
|
+
|
|
87
|
+
💬 "Create customer testimonial posts from recent reviews"
|
|
88
|
+
|
|
89
|
+
💬 "Generate sales performance report for the first week after launch"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Seasonal Campaign Management
|
|
93
|
+
|
|
94
|
+
**Holiday Preparation**
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
💬 "Create a Black Friday landing page with:
|
|
98
|
+
- Featured product showcase
|
|
99
|
+
- Countdown timer to sale start
|
|
100
|
+
- Special discount codes
|
|
101
|
+
- Gift guide categories"
|
|
102
|
+
|
|
103
|
+
💬 "Update all product pages with holiday-themed descriptions and gift suggestions"
|
|
104
|
+
|
|
105
|
+
💬 "Create holiday shipping information page with cutoff dates and delivery options"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Inventory Management**
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
💬 "Generate a report of all products that are low in stock (less than 10 units)"
|
|
112
|
+
|
|
113
|
+
💬 "Create restock notification signup forms for popular out-of-stock items"
|
|
114
|
+
|
|
115
|
+
💬 "Update all product pages to show estimated restock dates"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## News Website Operations
|
|
119
|
+
|
|
120
|
+
### Breaking News Workflow
|
|
121
|
+
|
|
122
|
+
**Rapid Content Publishing**
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
💬 "Create a breaking news post about the tech merger announcement with:
|
|
126
|
+
- SEO-optimized headline
|
|
127
|
+
- Key facts and timeline
|
|
128
|
+
- Related article links
|
|
129
|
+
- Social media integration"
|
|
130
|
+
|
|
131
|
+
💬 "Add breaking news banner to homepage and category pages"
|
|
132
|
+
|
|
133
|
+
💬 "Create follow-up article outline based on developing story angles"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Story Development**
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
💬 "Research and create background articles related to today's breaking news"
|
|
140
|
+
|
|
141
|
+
💬 "Update the main story with new developments and quotes from press conference"
|
|
142
|
+
|
|
143
|
+
💬 "Create an analysis piece connecting this news to broader industry trends"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Content Moderation**
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
💬 "Review all comments on controversial articles from today and approve legitimate discussion while flagging inappropriate content"
|
|
150
|
+
|
|
151
|
+
💬 "Create community guidelines reminder post for highly engaged articles"
|
|
152
|
+
|
|
153
|
+
💬 "Moderate reader submissions and feature the best user-generated content"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Editorial Calendar Management
|
|
157
|
+
|
|
158
|
+
**Weekly Planning**
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
💬 "Create editorial calendar for next week with:
|
|
162
|
+
- 5 main news articles
|
|
163
|
+
- 2 opinion pieces
|
|
164
|
+
- 3 feature stories
|
|
165
|
+
- Daily news roundups"
|
|
166
|
+
|
|
167
|
+
💬 "Assign categories and tags to planned articles for better organization"
|
|
168
|
+
|
|
169
|
+
💬 "Schedule social media promotion posts for each planned article"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Content Gap Analysis**
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
💬 "Analyze our coverage compared to competing news sites and identify missing story angles"
|
|
176
|
+
|
|
177
|
+
💬 "Review trending topics in our industry and suggest 3 urgent articles to publish"
|
|
178
|
+
|
|
179
|
+
💬 "Find evergreen content opportunities that can drive consistent traffic"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Agency Client Management
|
|
183
|
+
|
|
184
|
+
### Multi-Client Campaign Coordination
|
|
185
|
+
|
|
186
|
+
**Client Onboarding**
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
💬 "Create a new client website section for Law Firm XYZ with:
|
|
190
|
+
- Practice area pages (Personal Injury, Family Law, Criminal Defense)
|
|
191
|
+
- Attorney profile pages with photos and credentials
|
|
192
|
+
- Client testimonial showcase
|
|
193
|
+
- Contact and consultation booking forms"
|
|
194
|
+
|
|
195
|
+
💬 "Set up content categories specific to legal topics and local SEO"
|
|
196
|
+
|
|
197
|
+
💬 "Create editorial calendar focused on legal advice and local community involvement"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Monthly Reporting**
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
💬 "Generate performance reports for all 5 agency clients showing:
|
|
204
|
+
- Website traffic growth
|
|
205
|
+
- Content engagement metrics
|
|
206
|
+
- Lead generation performance
|
|
207
|
+
- SEO ranking improvements"
|
|
208
|
+
|
|
209
|
+
💬 "Create client-specific improvement recommendations based on performance data"
|
|
210
|
+
|
|
211
|
+
💬 "Schedule quarterly strategy review meetings and prepare agenda items"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Bulk Content Operations**
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
💬 "Update privacy policies across all client sites to comply with new regulations"
|
|
218
|
+
|
|
219
|
+
💬 "Add holiday closure notices to all restaurant client websites"
|
|
220
|
+
|
|
221
|
+
💬 "Create coronavirus safety protocol pages for all healthcare practice clients"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Campaign Management
|
|
225
|
+
|
|
226
|
+
**Seasonal Campaigns**
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
💬 "Launch summer promotion campaigns for all retail clients with:
|
|
230
|
+
- Seasonal landing pages
|
|
231
|
+
- Special offer showcases
|
|
232
|
+
- Email signup incentives
|
|
233
|
+
- Social media integration"
|
|
234
|
+
|
|
235
|
+
💬 "Create back-to-school content for educational clients including:
|
|
236
|
+
- Course enrollment pages
|
|
237
|
+
- Academic calendar updates
|
|
238
|
+
- Student resource guides"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Educational Institution Management
|
|
242
|
+
|
|
243
|
+
### Course and Program Management
|
|
244
|
+
|
|
245
|
+
**Semester Preparation**
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
💬 "Create course catalog pages for Fall 2024 semester with:
|
|
249
|
+
- Course descriptions and prerequisites
|
|
250
|
+
- Faculty information and credentials
|
|
251
|
+
- Enrollment deadlines and procedures
|
|
252
|
+
- Tuition and fee information"
|
|
253
|
+
|
|
254
|
+
💬 "Update academic calendar with important dates and deadlines"
|
|
255
|
+
|
|
256
|
+
💬 "Create student orientation information pages and FAQ sections"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Student Engagement**
|
|
260
|
+
|
|
261
|
+
```text
|
|
262
|
+
💬 "Create weekly newsletter content highlighting:
|
|
263
|
+
- Upcoming campus events
|
|
264
|
+
- Academic deadlines and important dates
|
|
265
|
+
- Student achievement spotlights
|
|
266
|
+
- Faculty research news"
|
|
267
|
+
|
|
268
|
+
💬 "Moderate student discussion forums and highlight valuable contributions"
|
|
269
|
+
|
|
270
|
+
💬 "Create study resource pages for final exam period"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Alumni Relations**
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
💬 "Create alumni success story features from recent graduate achievements"
|
|
277
|
+
|
|
278
|
+
💬 "Set up reunion event pages with registration and information"
|
|
279
|
+
|
|
280
|
+
💬 "Generate annual giving campaign pages with donation tracking"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Research and Publications
|
|
284
|
+
|
|
285
|
+
**Faculty Research Showcase**
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
💬 "Create research spotlight pages featuring:
|
|
289
|
+
- Faculty research projects and findings
|
|
290
|
+
- Publication listings and abstracts
|
|
291
|
+
- Grant funding acknowledgments
|
|
292
|
+
- Collaboration opportunities"
|
|
293
|
+
|
|
294
|
+
💬 "Update faculty profile pages with latest publications and achievements"
|
|
295
|
+
|
|
296
|
+
💬 "Create research news section highlighting breakthrough discoveries"
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Healthcare Practice Management
|
|
300
|
+
|
|
301
|
+
### Patient Information and Education
|
|
302
|
+
|
|
303
|
+
**Health Education Content**
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
💬 "Create patient education pages about common conditions with:
|
|
307
|
+
- Symptoms and causes explanations
|
|
308
|
+
- Treatment options and procedures
|
|
309
|
+
- Prevention and self-care tips
|
|
310
|
+
- When to seek medical attention guidelines"
|
|
311
|
+
|
|
312
|
+
💬 "Develop seasonal health tips (flu prevention, allergy management, sun safety)"
|
|
313
|
+
|
|
314
|
+
💬 "Create FAQ sections addressing common patient concerns"
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Practice Management**
|
|
318
|
+
|
|
319
|
+
```text
|
|
320
|
+
💬 "Update doctor availability schedules and appointment booking information"
|
|
321
|
+
|
|
322
|
+
💬 "Create new patient welcome pages with:
|
|
323
|
+
- Registration forms and required documents
|
|
324
|
+
- Insurance information and billing policies
|
|
325
|
+
- Office policies and procedures
|
|
326
|
+
- Contact information and directions"
|
|
327
|
+
|
|
328
|
+
💬 "Generate monthly health newsletter with practice updates and health tips"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Compliance and Updates**
|
|
332
|
+
|
|
333
|
+
```text
|
|
334
|
+
💬 "Update all patient privacy notices to comply with HIPAA requirements"
|
|
335
|
+
|
|
336
|
+
💬 "Create COVID-19 safety protocol pages with current guidelines"
|
|
337
|
+
|
|
338
|
+
💬 "Add telehealth service information and booking procedures"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Non-Profit Organization Workflows
|
|
342
|
+
|
|
343
|
+
### Fundraising Campaigns
|
|
344
|
+
|
|
345
|
+
**Campaign Launch**
|
|
346
|
+
|
|
347
|
+
```text
|
|
348
|
+
💬 "Create fundraising campaign page for disaster relief with:
|
|
349
|
+
- Compelling story and impact statistics
|
|
350
|
+
- Donation progress tracker and goals
|
|
351
|
+
- Multiple giving level options
|
|
352
|
+
- Volunteer signup opportunities"
|
|
353
|
+
|
|
354
|
+
💬 "Design thank you pages with donation impact explanations"
|
|
355
|
+
|
|
356
|
+
💬 "Create corporate sponsorship information packages"
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Volunteer Coordination**
|
|
360
|
+
|
|
361
|
+
```text
|
|
362
|
+
💬 "Create volunteer opportunity listings with:
|
|
363
|
+
- Role descriptions and time commitments
|
|
364
|
+
- Required skills and training information
|
|
365
|
+
- Application forms and background check procedures
|
|
366
|
+
- Volunteer appreciation showcase"
|
|
367
|
+
|
|
368
|
+
💬 "Update volunteer handbook and training resource pages"
|
|
369
|
+
|
|
370
|
+
💬 "Create volunteer appreciation event pages and photo galleries"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**Impact Reporting**
|
|
374
|
+
|
|
375
|
+
```text
|
|
376
|
+
💬 "Generate quarterly impact reports showing:
|
|
377
|
+
- Funds raised and allocation breakdown
|
|
378
|
+
- Programs served and beneficiaries helped
|
|
379
|
+
- Volunteer hours contributed
|
|
380
|
+
- Success stories and testimonials"
|
|
381
|
+
|
|
382
|
+
💬 "Create annual report pages with downloadable PDF versions"
|
|
383
|
+
|
|
384
|
+
💬 "Update donor recognition pages with latest contributors"
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Community Outreach
|
|
388
|
+
|
|
389
|
+
**Event Management**
|
|
390
|
+
|
|
391
|
+
```text
|
|
392
|
+
💬 "Create community event pages for annual charity run with:
|
|
393
|
+
- Registration forms and fee information
|
|
394
|
+
- Route maps and safety guidelines
|
|
395
|
+
- Sponsorship opportunities
|
|
396
|
+
- Volunteer role signups"
|
|
397
|
+
|
|
398
|
+
💬 "Update events calendar with monthly community activities"
|
|
399
|
+
|
|
400
|
+
💬 "Create post-event recap pages with photos and impact measurements"
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Small Business Operations
|
|
404
|
+
|
|
405
|
+
### Local Business Optimization
|
|
406
|
+
|
|
407
|
+
**Local SEO Enhancement**
|
|
408
|
+
|
|
409
|
+
```text
|
|
410
|
+
💬 "Optimize all pages for local search with:
|
|
411
|
+
- Location-specific keywords and content
|
|
412
|
+
- Local business schema markup
|
|
413
|
+
- Customer review integration
|
|
414
|
+
- Community involvement highlights"
|
|
415
|
+
|
|
416
|
+
💬 "Create location-specific landing pages for multiple business locations"
|
|
417
|
+
|
|
418
|
+
💬 "Update business hours, contact information, and service area descriptions"
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Customer Engagement**
|
|
422
|
+
|
|
423
|
+
```text
|
|
424
|
+
💬 "Create customer loyalty program information pages"
|
|
425
|
+
|
|
426
|
+
💬 "Develop email newsletter signup incentives and welcome series"
|
|
427
|
+
|
|
428
|
+
💬 "Generate customer testimonial showcase pages"
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**Service Promotion**
|
|
432
|
+
|
|
433
|
+
```text
|
|
434
|
+
💬 "Create seasonal service promotion pages (spring cleaning, holiday catering, tax preparation)"
|
|
435
|
+
|
|
436
|
+
💬 "Update service pricing and package information"
|
|
437
|
+
|
|
438
|
+
💬 "Create before/after project galleries for visual services"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## Integration with Business Tools
|
|
442
|
+
|
|
443
|
+
### CRM Integration Workflows
|
|
444
|
+
|
|
445
|
+
**Lead Management**
|
|
446
|
+
|
|
447
|
+
```text
|
|
448
|
+
💬 "Create contact forms that integrate with our CRM system"
|
|
449
|
+
|
|
450
|
+
💬 "Set up automated email sequences for new lead nurturing"
|
|
451
|
+
|
|
452
|
+
💬 "Generate lead magnet landing pages with downloadable resources"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Analytics Integration
|
|
456
|
+
|
|
457
|
+
**Performance Monitoring**
|
|
458
|
+
|
|
459
|
+
```text
|
|
460
|
+
💬 "Set up conversion tracking for all important business goals"
|
|
461
|
+
|
|
462
|
+
💬 "Create custom dashboards showing key performance indicators"
|
|
463
|
+
|
|
464
|
+
💬 "Generate automated monthly performance reports for stakeholders"
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
These workflows demonstrate how MCP WordPress can streamline complex business processes
|
|
468
|
+
across different industries and use cases, making WordPress management more efficient
|
|
469
|
+
and effective through natural language interactions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-wordpress",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Comprehensive Model Context Protocol server for WordPress management with 59 tools, performance monitoring, intelligent caching, auto-generated documentation, Docker support, TypeScript, and production-ready authentication",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"check:ignore": "node scripts/sync-ignore-files.js",
|
|
45
45
|
"check:npm": "node scripts/test-npm-config.js",
|
|
46
46
|
"dev": "npm run build && DEBUG=true node dist/index.js",
|
|
47
|
+
"docker:build": "docker build -t docdyhr/mcp-wordpress:latest .",
|
|
48
|
+
"docker:publish": "./scripts/manual-docker-publish.sh",
|
|
49
|
+
"docker:publish:version": "./scripts/manual-docker-publish.sh",
|
|
47
50
|
"docs:check": "node scripts/validate-docs.js",
|
|
48
51
|
"docs:generate": "npm run build && node scripts/generate-docs.js",
|
|
49
52
|
"docs:serve": "npm run docs:generate && node scripts/serve-docs.js",
|
package/src/client/api.ts
CHANGED
|
@@ -48,6 +48,53 @@ import type {
|
|
|
48
48
|
} from "../types/wordpress.js";
|
|
49
49
|
import { debug, logError, startTimer } from "../utils/debug.js";
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* WordPress REST API Client
|
|
53
|
+
*
|
|
54
|
+
* A comprehensive client for interacting with the WordPress REST API v2.
|
|
55
|
+
* Provides full CRUD operations for posts, pages, media, users, comments,
|
|
56
|
+
* categories, tags, and site settings with robust error handling and performance optimization.
|
|
57
|
+
*
|
|
58
|
+
* Features:
|
|
59
|
+
* - Multiple authentication methods (App Passwords, JWT, Basic Auth, API Key)
|
|
60
|
+
* - Automatic retry logic with exponential backoff
|
|
61
|
+
* - Request rate limiting and queue management
|
|
62
|
+
* - Comprehensive error handling with detailed messages
|
|
63
|
+
* - Performance monitoring and request statistics
|
|
64
|
+
* - Caching support for improved performance
|
|
65
|
+
* - Multi-site configuration support
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // Initialize with app password authentication
|
|
70
|
+
* const client = new WordPressClient({
|
|
71
|
+
* baseUrl: 'https://mysite.com',
|
|
72
|
+
* auth: {
|
|
73
|
+
* method: 'app-password',
|
|
74
|
+
* username: 'admin',
|
|
75
|
+
* password: 'xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
76
|
+
* }
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* // Create a new post
|
|
80
|
+
* const post = await client.createPost({
|
|
81
|
+
* title: 'My New Post',
|
|
82
|
+
* content: '<p>This is the content</p>',
|
|
83
|
+
* status: 'publish'
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // List posts with filtering
|
|
87
|
+
* const posts = await client.getPosts({
|
|
88
|
+
* search: 'WordPress',
|
|
89
|
+
* status: 'publish',
|
|
90
|
+
* per_page: 10
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @since 1.0.0
|
|
95
|
+
* @author MCP WordPress Team
|
|
96
|
+
* @implements {IWordPressClient}
|
|
97
|
+
*/
|
|
51
98
|
export class WordPressClient implements IWordPressClient {
|
|
52
99
|
private baseUrl: string;
|
|
53
100
|
private apiUrl: string;
|
|
@@ -61,6 +108,49 @@ export class WordPressClient implements IWordPressClient {
|
|
|
61
108
|
private jwtToken: string | null = null;
|
|
62
109
|
private _stats: ClientStats;
|
|
63
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Creates a new WordPress API client instance.
|
|
113
|
+
*
|
|
114
|
+
* Initializes the client with configuration options for connecting to a WordPress site.
|
|
115
|
+
* Supports multiple authentication methods and automatic environment variable detection.
|
|
116
|
+
*
|
|
117
|
+
* @param {Partial<WordPressClientConfig>} [options={}] - Configuration options for the client
|
|
118
|
+
* @param {string} [options.baseUrl] - WordPress site URL (falls back to WORDPRESS_SITE_URL env var)
|
|
119
|
+
* @param {number} [options.timeout=30000] - Request timeout in milliseconds
|
|
120
|
+
* @param {number} [options.maxRetries=3] - Maximum number of retry attempts for failed requests
|
|
121
|
+
* @param {AuthConfig} [options.auth] - Authentication configuration (auto-detected from env if not provided)
|
|
122
|
+
* @param {boolean} [options.enableCache=true] - Whether to enable response caching
|
|
123
|
+
* @param {number} [options.cacheMaxAge=300000] - Cache max age in milliseconds (5 minutes default)
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // Basic configuration with app password
|
|
128
|
+
* const client = new WordPressClient({
|
|
129
|
+
* baseUrl: 'https://mysite.com',
|
|
130
|
+
* auth: {
|
|
131
|
+
* method: 'app-password',
|
|
132
|
+
* username: 'admin',
|
|
133
|
+
* password: 'xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
134
|
+
* }
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // Configuration with environment variables
|
|
138
|
+
* // Set WORDPRESS_SITE_URL, WORDPRESS_USERNAME, WORDPRESS_APP_PASSWORD
|
|
139
|
+
* const client = new WordPressClient(); // Auto-detects from env
|
|
140
|
+
*
|
|
141
|
+
* // Custom timeout and retry settings
|
|
142
|
+
* const client = new WordPressClient({
|
|
143
|
+
* baseUrl: 'https://mysite.com',
|
|
144
|
+
* timeout: 60000, // 60 seconds
|
|
145
|
+
* maxRetries: 5, // 5 retry attempts
|
|
146
|
+
* auth: { method: 'app-password', username: 'user', password: 'pass' }
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @throws {Error} When required configuration is missing or invalid
|
|
151
|
+
*
|
|
152
|
+
* @since 1.0.0
|
|
153
|
+
*/
|
|
64
154
|
constructor(options: Partial<WordPressClientConfig> = {}) {
|
|
65
155
|
this.baseUrl = options.baseUrl || process.env.WORDPRESS_SITE_URL || "";
|
|
66
156
|
this.apiUrl = "";
|
package/src/tools/media.ts
CHANGED
|
@@ -8,13 +8,52 @@ import {
|
|
|
8
8
|
import { getErrorMessage } from "../utils/error.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Comprehensive media management tools for WordPress sites.
|
|
12
|
+
*
|
|
13
|
+
* This class provides complete media library functionality including:
|
|
14
|
+
* - Listing media items with advanced filtering and search
|
|
15
|
+
* - Uploading new media files with validation and optimization
|
|
16
|
+
* - Retrieving detailed media information and metadata
|
|
17
|
+
* - Updating media properties like title, description, and alt text
|
|
18
|
+
* - Deleting media items with safety checks
|
|
19
|
+
*
|
|
20
|
+
* Supports all WordPress media types including images, videos, audio files,
|
|
21
|
+
* and documents with proper MIME type validation and security checks.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const mediaTools = new MediaTools();
|
|
26
|
+
* const tools = mediaTools.getTools();
|
|
27
|
+
*
|
|
28
|
+
* // Upload an image
|
|
29
|
+
* const client = new WordPressClient(config);
|
|
30
|
+
* const result = await mediaTools.handleUploadMedia(client, {
|
|
31
|
+
* file_path: "/path/to/image.jpg",
|
|
32
|
+
* title: "My Image",
|
|
33
|
+
* alt_text: "Description of the image"
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @since 1.0.0
|
|
38
|
+
* @author MCP WordPress Team
|
|
13
39
|
*/
|
|
14
40
|
export class MediaTools {
|
|
15
41
|
/**
|
|
16
|
-
* Retrieves the list of media management tools.
|
|
17
|
-
*
|
|
42
|
+
* Retrieves the complete list of media management tools available for MCP.
|
|
43
|
+
*
|
|
44
|
+
* Returns an array of tool definitions for comprehensive media library management.
|
|
45
|
+
* Each tool includes parameter validation, security checks, and detailed error handling.
|
|
46
|
+
*
|
|
47
|
+
* @returns {Array<MCPTool>} Array of MCPTool definitions for media management
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const mediaTools = new MediaTools();
|
|
52
|
+
* const tools = mediaTools.getTools();
|
|
53
|
+
* console.log(tools.length); // 5 tools: list, get, upload, update, delete
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @since 1.0.0
|
|
18
57
|
*/
|
|
19
58
|
public getTools(): any[] {
|
|
20
59
|
return [
|