mcp-wordpress 1.3.0 → 1.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.
Files changed (95) hide show
  1. package/README.md +149 -789
  2. package/dist/mcp-wordpress-1.4.0.tgz +0 -0
  3. package/docs/DOCKER.md +8 -1
  4. package/docs/api/README.md +82 -75
  5. package/docs/api/categories/auth.md +2 -0
  6. package/docs/api/categories/cache.md +2 -0
  7. package/docs/api/categories/comment.md +2 -0
  8. package/docs/api/categories/media.md +2 -0
  9. package/docs/api/categories/page.md +2 -0
  10. package/docs/api/categories/performance.md +2 -0
  11. package/docs/api/categories/post.md +2 -0
  12. package/docs/api/categories/site.md +2 -0
  13. package/docs/api/categories/taxonomy.md +2 -0
  14. package/docs/api/categories/user.md +2 -0
  15. package/docs/api/tools/wp_approve_comment.md +3 -11
  16. package/docs/api/tools/wp_cache_clear.md +5 -14
  17. package/docs/api/tools/wp_cache_info.md +5 -14
  18. package/docs/api/tools/wp_cache_stats.md +5 -14
  19. package/docs/api/tools/wp_cache_warm.md +5 -14
  20. package/docs/api/tools/wp_create_application_password.md +3 -11
  21. package/docs/api/tools/wp_create_category.md +3 -11
  22. package/docs/api/tools/wp_create_comment.md +5 -14
  23. package/docs/api/tools/wp_create_page.md +5 -13
  24. package/docs/api/tools/wp_create_post.md +6 -12
  25. package/docs/api/tools/wp_create_tag.md +3 -11
  26. package/docs/api/tools/wp_create_user.md +5 -13
  27. package/docs/api/tools/wp_delete_application_password.md +3 -11
  28. package/docs/api/tools/wp_delete_category.md +3 -11
  29. package/docs/api/tools/wp_delete_comment.md +3 -11
  30. package/docs/api/tools/wp_delete_media.md +3 -10
  31. package/docs/api/tools/wp_delete_page.md +3 -10
  32. package/docs/api/tools/wp_delete_post.md +4 -9
  33. package/docs/api/tools/wp_delete_tag.md +3 -11
  34. package/docs/api/tools/wp_delete_user.md +3 -10
  35. package/docs/api/tools/wp_get_application_passwords.md +3 -11
  36. package/docs/api/tools/wp_get_auth_status.md +3 -11
  37. package/docs/api/tools/wp_get_category.md +3 -11
  38. package/docs/api/tools/wp_get_comment.md +3 -11
  39. package/docs/api/tools/wp_get_current_user.md +3 -11
  40. package/docs/api/tools/wp_get_media.md +3 -11
  41. package/docs/api/tools/wp_get_page.md +3 -11
  42. package/docs/api/tools/wp_get_page_revisions.md +3 -11
  43. package/docs/api/tools/wp_get_post.md +4 -10
  44. package/docs/api/tools/wp_get_post_revisions.md +3 -11
  45. package/docs/api/tools/wp_get_site_settings.md +3 -10
  46. package/docs/api/tools/wp_get_tag.md +3 -11
  47. package/docs/api/tools/wp_get_user.md +3 -11
  48. package/docs/api/tools/wp_list_categories.md +3 -11
  49. package/docs/api/tools/wp_list_comments.md +3 -11
  50. package/docs/api/tools/wp_list_media.md +5 -14
  51. package/docs/api/tools/wp_list_pages.md +5 -14
  52. package/docs/api/tools/wp_list_posts.md +6 -13
  53. package/docs/api/tools/wp_list_tags.md +3 -11
  54. package/docs/api/tools/wp_list_users.md +3 -11
  55. package/docs/api/tools/wp_performance_alerts.md +7 -17
  56. package/docs/api/tools/wp_performance_benchmark.md +7 -17
  57. package/docs/api/tools/wp_performance_export.md +7 -17
  58. package/docs/api/tools/wp_performance_history.md +7 -17
  59. package/docs/api/tools/wp_performance_optimize.md +7 -17
  60. package/docs/api/tools/wp_performance_stats.md +7 -17
  61. package/docs/api/tools/wp_search_site.md +3 -11
  62. package/docs/api/tools/wp_spam_comment.md +3 -11
  63. package/docs/api/tools/wp_switch_auth_method.md +5 -14
  64. package/docs/api/tools/wp_test_auth.md +3 -11
  65. package/docs/api/tools/wp_update_category.md +3 -11
  66. package/docs/api/tools/wp_update_comment.md +5 -14
  67. package/docs/api/tools/wp_update_media.md +5 -14
  68. package/docs/api/tools/wp_update_page.md +5 -13
  69. package/docs/api/tools/wp_update_post.md +6 -12
  70. package/docs/api/tools/wp_update_site_settings.md +5 -14
  71. package/docs/api/tools/wp_update_tag.md +3 -11
  72. package/docs/api/tools/wp_update_user.md +5 -13
  73. package/docs/api/tools/wp_upload_media.md +5 -13
  74. package/docs/api/types/WordPressPost.md +0 -2
  75. package/docs/developer/API_REFERENCE.md +628 -0
  76. package/docs/developer/ARCHITECTURE.md +374 -0
  77. package/docs/developer/BUILD_SYSTEM.md +465 -0
  78. package/docs/developer/CONTRIBUTING.md +463 -0
  79. package/docs/developer/DEVELOPMENT_SETUP.md +463 -0
  80. package/docs/developer/GITHUB_ACTIONS_SETUP.md +2 -1
  81. package/docs/developer/MAINTENANCE.md +5 -5
  82. package/docs/developer/MIGRATION_GUIDE.md +7 -5
  83. package/docs/developer/NPM_AUTH_SETUP.md +4 -4
  84. package/docs/developer/README.md +219 -0
  85. package/docs/developer/REFACTORING.md +15 -10
  86. package/docs/developer/RELEASE_PROCESS.md +523 -0
  87. package/docs/developer/TESTING.md +730 -0
  88. package/docs/releases/COMMUNITY_ANNOUNCEMENT_v1.1.2.md +9 -3
  89. package/docs/releases/RELEASE_NOTES_v1.1.2.md +4 -4
  90. package/docs/user-guides/DOCKER_NPM_DTX_SETUP.md +217 -0
  91. package/docs/user-guides/DOCKER_SETUP.md +3 -3
  92. package/docs/user-guides/DTX_SETUP.md +5 -5
  93. package/docs/user-guides/NPX_SETUP.md +2 -2
  94. package/package.json +2 -2
  95. package/dist/mcp-wordpress-1.3.0.tgz +0 -0
@@ -0,0 +1,628 @@
1
+ # API Reference
2
+
3
+ Complete technical reference for the MCP WordPress Server API, tools, and interfaces.
4
+
5
+ ## 🔧 Core API Classes
6
+
7
+ ### WordPressClient
8
+
9
+ Primary interface for WordPress REST API communication.
10
+
11
+ ```typescript
12
+ class WordPressClient {
13
+ constructor(config: ClientConfig);
14
+
15
+ // Core managers
16
+ auth: AuthenticationManager;
17
+ request: RequestManager;
18
+ cache: CacheManager;
19
+
20
+ // Content APIs
21
+ posts: PostsAPI;
22
+ pages: PagesAPI;
23
+ media: MediaAPI;
24
+ users: UsersAPI;
25
+ comments: CommentsAPI;
26
+ taxonomies: TaxonomiesAPI;
27
+
28
+ // Site management
29
+ settings: SettingsAPI;
30
+ plugins: PluginsAPI;
31
+ themes: ThemesAPI;
32
+ }
33
+ ```
34
+
35
+ **Configuration Interface**:
36
+
37
+ ```typescript
38
+ interface ClientConfig {
39
+ siteUrl: string;
40
+ username: string;
41
+ password?: string;
42
+ appPassword?: string;
43
+ authMethod?: 'app-password' | 'jwt' | 'basic' | 'api-key';
44
+ timeout?: number;
45
+ retryAttempts?: number;
46
+ cacheEnabled?: boolean;
47
+ debug?: boolean;
48
+ }
49
+ ```
50
+
51
+ ### AuthenticationManager
52
+
53
+ Handles multiple WordPress authentication methods.
54
+
55
+ ```typescript
56
+ class AuthenticationManager {
57
+ // Authentication methods
58
+ async authenticateWithAppPassword(username: string, password: string): Promise<AuthResult>;
59
+ async authenticateWithJWT(username: string, password: string): Promise<AuthResult>;
60
+ async authenticateWithBasic(username: string, password: string): Promise<AuthResult>;
61
+ async authenticateWithApiKey(apiKey: string): Promise<AuthResult>;
62
+
63
+ // Token management
64
+ async refreshToken(): Promise<string>;
65
+ async validateToken(token: string): Promise<boolean>;
66
+ async revokeToken(token: string): Promise<void>;
67
+
68
+ // Headers
69
+ getAuthHeaders(): Record<string, string>;
70
+ isAuthenticated(): boolean;
71
+ }
72
+ ```
73
+
74
+ ### RequestManager
75
+
76
+ HTTP request handling with retry logic and rate limiting.
77
+
78
+ ```typescript
79
+ class RequestManager {
80
+ // HTTP methods
81
+ async get<T>(endpoint: string, params?: QueryParams): Promise<T>;
82
+ async post<T>(endpoint: string, data?: any): Promise<T>;
83
+ async put<T>(endpoint: string, data?: any): Promise<T>;
84
+ async patch<T>(endpoint: string, data?: any): Promise<T>;
85
+ async delete<T>(endpoint: string): Promise<T>;
86
+
87
+ // Batch operations
88
+ async batchRequest<T>(requests: BatchRequest[]): Promise<T[]>;
89
+
90
+ // File uploads
91
+ async uploadFile(file: File, options?: UploadOptions): Promise<MediaItem>;
92
+
93
+ // Rate limiting
94
+ async waitForRateLimit(): Promise<void>;
95
+ getRateLimitStatus(): RateLimitStatus;
96
+ }
97
+ ```
98
+
99
+ ## 📝 MCP Tools API
100
+
101
+ ### Tool Categories
102
+
103
+ #### Posts Tools (PostTools)
104
+
105
+ ```typescript
106
+ class PostTools {
107
+ // Content management
108
+ async createPost(params: CreatePostParams): Promise<PostResult>;
109
+ async updatePost(params: UpdatePostParams): Promise<PostResult>;
110
+ async deletePost(params: DeletePostParams): Promise<DeleteResult>;
111
+ async getPost(params: GetPostParams): Promise<PostResult>;
112
+ async listPosts(params: ListPostsParams): Promise<PostListResult>;
113
+ async getPostRevisions(params: GetPostRevisionsParams): Promise<PostRevisionsResult>;
114
+ }
115
+ ```
116
+
117
+ **Parameter Interfaces**:
118
+
119
+ ```typescript
120
+ interface CreatePostParams {
121
+ title: string;
122
+ content?: string;
123
+ excerpt?: string;
124
+ status?: 'draft' | 'publish' | 'private' | 'pending';
125
+ author?: number;
126
+ categories?: number[];
127
+ tags?: number[];
128
+ featured_media?: number;
129
+ meta?: Record<string, any>;
130
+ site?: string; // Multi-site support
131
+ }
132
+
133
+ interface PostResult {
134
+ id: number;
135
+ title: string;
136
+ content: string;
137
+ excerpt: string;
138
+ status: string;
139
+ author: number;
140
+ date: string;
141
+ modified: string;
142
+ link: string;
143
+ slug: string;
144
+ categories: number[];
145
+ tags: number[];
146
+ featured_media: number;
147
+ meta: Record<string, any>;
148
+ }
149
+ ```
150
+
151
+ #### Pages Tools (PageTools)
152
+
153
+ ```typescript
154
+ class PageTools {
155
+ async createPage(params: CreatePageParams): Promise<PageResult>;
156
+ async updatePage(params: UpdatePageParams): Promise<PageResult>;
157
+ async deletePage(params: DeletePageParams): Promise<DeleteResult>;
158
+ async getPage(params: GetPageParams): Promise<PageResult>;
159
+ async listPages(params: ListPagesParams): Promise<PageListResult>;
160
+ async getPageRevisions(params: GetPageRevisionsParams): Promise<PageRevisionsResult>;
161
+ }
162
+ ```
163
+
164
+ #### Media Tools (MediaTools)
165
+
166
+ ```typescript
167
+ class MediaTools {
168
+ async uploadMedia(params: UploadMediaParams): Promise<MediaResult>;
169
+ async updateMedia(params: UpdateMediaParams): Promise<MediaResult>;
170
+ async deleteMedia(params: DeleteMediaParams): Promise<DeleteResult>;
171
+ async getMedia(params: GetMediaParams): Promise<MediaResult>;
172
+ async listMedia(params: ListMediaParams): Promise<MediaListResult>;
173
+ }
174
+ ```
175
+
176
+ **Upload Parameters**:
177
+
178
+ ```typescript
179
+ interface UploadMediaParams {
180
+ file: string | Buffer; // File path or buffer
181
+ filename?: string;
182
+ title?: string;
183
+ alt_text?: string;
184
+ caption?: string;
185
+ description?: string;
186
+ post?: number; // Attach to specific post
187
+ site?: string;
188
+ }
189
+ ```
190
+
191
+ #### Users Tools (UserTools)
192
+
193
+ ```typescript
194
+ class UserTools {
195
+ async createUser(params: CreateUserParams): Promise<UserResult>;
196
+ async updateUser(params: UpdateUserParams): Promise<UserResult>;
197
+ async deleteUser(params: DeleteUserParams): Promise<DeleteResult>;
198
+ async getUser(params: GetUserParams): Promise<UserResult>;
199
+ async listUsers(params: ListUsersParams): Promise<UserListResult>;
200
+ async getCurrentUser(params: GetCurrentUserParams): Promise<UserResult>;
201
+ }
202
+ ```
203
+
204
+ #### Comments Tools (CommentTools)
205
+
206
+ ```typescript
207
+ class CommentTools {
208
+ async createComment(params: CreateCommentParams): Promise<CommentResult>;
209
+ async updateComment(params: UpdateCommentParams): Promise<CommentResult>;
210
+ async deleteComment(params: DeleteCommentParams): Promise<DeleteResult>;
211
+ async getComment(params: GetCommentParams): Promise<CommentResult>;
212
+ async listComments(params: ListCommentsParams): Promise<CommentListResult>;
213
+ async moderateComment(params: ModerateCommentParams): Promise<CommentResult>;
214
+ async bulkModerateComments(params: BulkModerateCommentsParams): Promise<BulkResult>;
215
+ }
216
+ ```
217
+
218
+ #### Taxonomies Tools (TaxonomyTools)
219
+
220
+ ```typescript
221
+ class TaxonomyTools {
222
+ // Categories
223
+ async createCategory(params: CreateCategoryParams): Promise<CategoryResult>;
224
+ async updateCategory(params: UpdateCategoryParams): Promise<CategoryResult>;
225
+ async deleteCategory(params: DeleteCategoryParams): Promise<DeleteResult>;
226
+ async getCategory(params: GetCategoryParams): Promise<CategoryResult>;
227
+ async listCategories(params: ListCategoriesParams): Promise<CategoryListResult>;
228
+
229
+ // Tags
230
+ async createTag(params: CreateTagParams): Promise<TagResult>;
231
+ async updateTag(params: UpdateTagParams): Promise<TagResult>;
232
+ async deleteTag(params: DeleteTagParams): Promise<DeleteResult>;
233
+ async getTag(params: GetTagParams): Promise<TagResult>;
234
+ async listTags(params: ListTagsParams): Promise<TagListResult>;
235
+ }
236
+ ```
237
+
238
+ #### Site Tools (SiteTools)
239
+
240
+ ```typescript
241
+ class SiteTools {
242
+ async getSiteInfo(params: GetSiteInfoParams): Promise<SiteInfoResult>;
243
+ async updateSiteSettings(params: UpdateSiteSettingsParams): Promise<SiteSettingsResult>;
244
+ async getSiteStats(params: GetSiteStatsParams): Promise<SiteStatsResult>;
245
+ async getPlugins(params: GetPluginsParams): Promise<PluginsResult>;
246
+ async getThemes(params: GetThemesParams): Promise<ThemesResult>;
247
+ async searchContent(params: SearchContentParams): Promise<SearchResult>;
248
+ }
249
+ ```
250
+
251
+ #### Authentication Tools (AuthTools)
252
+
253
+ ```typescript
254
+ class AuthTools {
255
+ async testAuth(params: TestAuthParams): Promise<AuthTestResult>;
256
+ async refreshToken(params: RefreshTokenParams): Promise<TokenResult>;
257
+ async validatePermissions(params: ValidatePermissionsParams): Promise<PermissionsResult>;
258
+ }
259
+ ```
260
+
261
+ #### Cache Tools (CacheTools)
262
+
263
+ ```typescript
264
+ class CacheTools {
265
+ async getCacheStats(params: GetCacheStatsParams): Promise<CacheStatsResult>;
266
+ async clearCache(params: ClearCacheParams): Promise<ClearCacheResult>;
267
+ async warmCache(params: WarmCacheParams): Promise<WarmCacheResult>;
268
+ async setCacheConfig(params: SetCacheConfigParams): Promise<CacheConfigResult>;
269
+ }
270
+ ```
271
+
272
+ #### Performance Tools (PerformanceTools)
273
+
274
+ ```typescript
275
+ class PerformanceTools {
276
+ async getPerformanceMetrics(params: GetPerformanceMetricsParams): Promise<PerformanceMetricsResult>;
277
+ async runPerformanceTest(params: RunPerformanceTestParams): Promise<PerformanceTestResult>;
278
+ async getSystemHealth(params: GetSystemHealthParams): Promise<SystemHealthResult>;
279
+ async benchmarkOperations(params: BenchmarkOperationsParams): Promise<BenchmarkResult>;
280
+ async getOptimizationSuggestions(params: GetOptimizationSuggestionsParams): Promise<OptimizationResult>;
281
+ async monitorRealTimeMetrics(params: MonitorRealTimeMetricsParams): Promise<RealTimeMetricsResult>;
282
+ }
283
+ ```
284
+
285
+ ## 🔒 Security API
286
+
287
+ ### Input Validation
288
+
289
+ All tools use Zod schemas for parameter validation:
290
+
291
+ ```typescript
292
+ const createPostSchema = z.object({
293
+ title: z.string().min(1).max(200),
294
+ content: z.string().optional(),
295
+ status: z.enum(['draft', 'publish', 'private', 'pending']).optional(),
296
+ author: z.number().positive().optional(),
297
+ categories: z.array(z.number().positive()).optional(),
298
+ tags: z.array(z.number().positive()).optional(),
299
+ site: z.string().optional()
300
+ });
301
+ ```
302
+
303
+ ### Error Handling
304
+
305
+ ```typescript
306
+ interface APIError {
307
+ code: string;
308
+ message: string;
309
+ details?: any;
310
+ statusCode?: number;
311
+ }
312
+
313
+ class WordPressAPIError extends Error {
314
+ constructor(
315
+ public code: string,
316
+ message: string,
317
+ public statusCode?: number,
318
+ public details?: any
319
+ ) {
320
+ super(message);
321
+ this.name = 'WordPressAPIError';
322
+ }
323
+ }
324
+ ```
325
+
326
+ ### Rate Limiting
327
+
328
+ ```typescript
329
+ interface RateLimitStatus {
330
+ limit: number;
331
+ remaining: number;
332
+ reset: Date;
333
+ retryAfter?: number;
334
+ }
335
+
336
+ class RateLimitManager {
337
+ async checkRateLimit(endpoint: string): Promise<RateLimitStatus>;
338
+ async waitForRateLimit(endpoint: string): Promise<void>;
339
+ isRateLimited(endpoint: string): boolean;
340
+ }
341
+ ```
342
+
343
+ ## 📊 Performance API
344
+
345
+ ### Metrics Collection
346
+
347
+ ```typescript
348
+ interface PerformanceMetric {
349
+ timestamp: Date;
350
+ operation: string;
351
+ duration: number;
352
+ endpoint: string;
353
+ success: boolean;
354
+ cacheHit?: boolean;
355
+ error?: string;
356
+ }
357
+
358
+ class MetricsCollector {
359
+ collect(metric: PerformanceMetric): void;
360
+ getMetrics(filter?: MetricFilter): PerformanceMetric[];
361
+ getAggregatedMetrics(period: TimePeriod): AggregatedMetrics;
362
+ }
363
+ ```
364
+
365
+ ### Cache Management
366
+
367
+ ```typescript
368
+ interface CacheEntry<T> {
369
+ key: string;
370
+ value: T;
371
+ timestamp: Date;
372
+ ttl: number;
373
+ size: number;
374
+ }
375
+
376
+ class CacheManager {
377
+ async get<T>(key: string): Promise<T | null>;
378
+ async set<T>(key: string, value: T, ttl?: number): Promise<void>;
379
+ async del(key: string): Promise<void>;
380
+ async clear(pattern?: string): Promise<void>;
381
+
382
+ // Cache statistics
383
+ getStats(): CacheStats;
384
+ getSize(): number;
385
+ getHitRate(): number;
386
+ }
387
+ ```
388
+
389
+ ## 🛠️ Configuration API
390
+
391
+ ### Multi-Site Configuration
392
+
393
+ ```typescript
394
+ interface MultiSiteConfig {
395
+ sites: SiteConfig[];
396
+ }
397
+
398
+ interface SiteConfig {
399
+ id: string;
400
+ name: string;
401
+ config: {
402
+ WORDPRESS_SITE_URL: string;
403
+ WORDPRESS_USERNAME: string;
404
+ WORDPRESS_APP_PASSWORD: string;
405
+ WORDPRESS_AUTH_METHOD?: AuthMethod;
406
+ };
407
+ }
408
+ ```
409
+
410
+ ### Environment Configuration
411
+
412
+ ```typescript
413
+ interface EnvironmentConfig {
414
+ WORDPRESS_SITE_URL: string;
415
+ WORDPRESS_USERNAME: string;
416
+ WORDPRESS_APP_PASSWORD?: string;
417
+ WORDPRESS_AUTH_METHOD?: AuthMethod;
418
+ DEBUG?: boolean;
419
+ CACHE_ENABLED?: boolean;
420
+ CACHE_TTL?: number;
421
+ REQUEST_TIMEOUT?: number;
422
+ RETRY_ATTEMPTS?: number;
423
+ }
424
+ ```
425
+
426
+ ## 🧪 Testing API
427
+
428
+ ### Test Utilities
429
+
430
+ ```typescript
431
+ class TestUtils {
432
+ static createMockClient(config?: Partial<ClientConfig>): WordPressClient;
433
+ static createMockPost(overrides?: Partial<Post>): Post;
434
+ static createMockUser(overrides?: Partial<User>): User;
435
+ static generateTestData<T>(schema: ZodSchema<T>): T;
436
+ }
437
+ ```
438
+
439
+ ### Test Fixtures
440
+
441
+ ```typescript
442
+ interface TestFixtures {
443
+ posts: Post[];
444
+ users: User[];
445
+ comments: Comment[];
446
+ categories: Category[];
447
+ tags: Tag[];
448
+ media: MediaItem[];
449
+ }
450
+
451
+ class FixtureManager {
452
+ static loadFixtures(): TestFixtures;
453
+ static createTestSite(): Promise<TestSite>;
454
+ static cleanupTestSite(site: TestSite): Promise<void>;
455
+ }
456
+ ```
457
+
458
+ ## 📚 Type Definitions
459
+
460
+ ### WordPress Types
461
+
462
+ ```typescript
463
+ interface Post {
464
+ id: number;
465
+ title: string;
466
+ content: string;
467
+ excerpt: string;
468
+ status: PostStatus;
469
+ author: number;
470
+ date: string;
471
+ modified: string;
472
+ link: string;
473
+ slug: string;
474
+ categories: number[];
475
+ tags: number[];
476
+ featured_media: number;
477
+ meta: Record<string, any>;
478
+ }
479
+
480
+ interface User {
481
+ id: number;
482
+ username: string;
483
+ email: string;
484
+ first_name: string;
485
+ last_name: string;
486
+ nickname: string;
487
+ description: string;
488
+ link: string;
489
+ avatar_urls: Record<string, string>;
490
+ roles: string[];
491
+ capabilities: Record<string, boolean>;
492
+ meta: Record<string, any>;
493
+ }
494
+
495
+ interface Comment {
496
+ id: number;
497
+ post: number;
498
+ parent: number;
499
+ author: number;
500
+ author_name: string;
501
+ author_email: string;
502
+ author_url: string;
503
+ content: string;
504
+ date: string;
505
+ status: CommentStatus;
506
+ meta: Record<string, any>;
507
+ }
508
+ ```
509
+
510
+ ### MCP Types
511
+
512
+ ```typescript
513
+ interface MCPTool {
514
+ name: string;
515
+ description: string;
516
+ inputSchema: JSONSchema;
517
+ handler: ToolHandler;
518
+ }
519
+
520
+ interface ToolHandler {
521
+ (params: any): Promise<ToolResult>;
522
+ }
523
+
524
+ interface ToolResult {
525
+ success: boolean;
526
+ data?: any;
527
+ error?: string;
528
+ metadata?: Record<string, any>;
529
+ }
530
+ ```
531
+
532
+ ## 🔍 Debugging API
533
+
534
+ ### Debug Utilities
535
+
536
+ ```typescript
537
+ class DebugLogger {
538
+ static log(level: LogLevel, message: string, context?: any): void;
539
+ static error(error: Error, context?: any): void;
540
+ static performance(operation: string, duration: number): void;
541
+ static http(method: string, url: string, status: number, duration: number): void;
542
+ }
543
+ ```
544
+
545
+ ### Health Check API
546
+
547
+ ```typescript
548
+ interface HealthCheck {
549
+ status: 'healthy' | 'degraded' | 'unhealthy';
550
+ checks: {
551
+ database: HealthStatus;
552
+ cache: HealthStatus;
553
+ authentication: HealthStatus;
554
+ performance: HealthStatus;
555
+ };
556
+ timestamp: Date;
557
+ }
558
+
559
+ class HealthChecker {
560
+ async checkHealth(): Promise<HealthCheck>;
561
+ async checkDatabase(): Promise<HealthStatus>;
562
+ async checkCache(): Promise<HealthStatus>;
563
+ async checkAuthentication(): Promise<HealthStatus>;
564
+ }
565
+ ```
566
+
567
+ ## 📖 Usage Examples
568
+
569
+ ### Basic Client Usage
570
+
571
+ ```typescript
572
+ import { WordPressClient } from 'mcp-wordpress';
573
+
574
+ const client = new WordPressClient({
575
+ siteUrl: 'https://your-site.com',
576
+ username: 'admin',
577
+ appPassword: 'xxxx xxxx xxxx xxxx xxxx xxxx',
578
+ authMethod: 'app-password'
579
+ });
580
+
581
+ // Create a post
582
+ const post = await client.posts.create({
583
+ title: 'My New Post',
584
+ content: 'This is the post content',
585
+ status: 'publish'
586
+ });
587
+ ```
588
+
589
+ ### Multi-Site Usage
590
+
591
+ ```typescript
592
+ import { MCPWordPressServer } from 'mcp-wordpress';
593
+
594
+ const server = new MCPWordPressServer({
595
+ sites: [
596
+ {
597
+ id: 'site1',
598
+ name: 'Main Site',
599
+ config: {
600
+ WORDPRESS_SITE_URL: 'https://site1.com',
601
+ WORDPRESS_USERNAME: 'admin',
602
+ WORDPRESS_APP_PASSWORD: 'password1'
603
+ }
604
+ },
605
+ {
606
+ id: 'site2',
607
+ name: 'Blog Site',
608
+ config: {
609
+ WORDPRESS_SITE_URL: 'https://site2.com',
610
+ WORDPRESS_USERNAME: 'editor',
611
+ WORDPRESS_APP_PASSWORD: 'password2'
612
+ }
613
+ }
614
+ ]
615
+ });
616
+ ```
617
+
618
+ ## 📚 Further Reading
619
+
620
+ - **[Architecture Guide](ARCHITECTURE.md)** - System design and patterns
621
+ - **[Testing Guide](TESTING.md)** - Test suite and best practices
622
+ - **[Security Guidelines](SECURITY_DEVELOPMENT.md)** - Security best practices
623
+ - **[Performance Guide](PERFORMANCE_DEVELOPMENT.md)** - Performance optimization
624
+
625
+ ---
626
+
627
+ **Need more details?** This API reference covers the complete technical interface. For implementation
628
+ examples, see the source code in `src/` directory.