mcp-wordpress 3.1.11 → 3.1.13

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 (49) hide show
  1. package/dist/tools/auth.d.ts +2 -8
  2. package/dist/tools/auth.d.ts.map +1 -1
  3. package/dist/tools/auth.js +31 -25
  4. package/dist/tools/auth.js.map +1 -1
  5. package/dist/tools/cache.d.ts +35 -50
  6. package/dist/tools/cache.d.ts.map +1 -1
  7. package/dist/tools/cache.js +29 -65
  8. package/dist/tools/cache.js.map +1 -1
  9. package/dist/tools/comments.d.ts +2 -8
  10. package/dist/tools/comments.d.ts.map +1 -1
  11. package/dist/tools/comments.js +92 -86
  12. package/dist/tools/comments.js.map +1 -1
  13. package/dist/tools/media.d.ts +2 -8
  14. package/dist/tools/media.d.ts.map +1 -1
  15. package/dist/tools/media.js +98 -100
  16. package/dist/tools/media.js.map +1 -1
  17. package/dist/tools/pages.d.ts +2 -8
  18. package/dist/tools/pages.d.ts.map +1 -1
  19. package/dist/tools/pages.js +103 -91
  20. package/dist/tools/pages.js.map +1 -1
  21. package/dist/tools/performance/PerformanceTools.d.ts.map +1 -1
  22. package/dist/tools/performance/PerformanceTools.js +6 -2
  23. package/dist/tools/performance/PerformanceTools.js.map +1 -1
  24. package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -1
  25. package/dist/tools/seo/auditors/SiteAuditor.js +17 -3
  26. package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -1
  27. package/dist/tools/site.d.ts +2 -8
  28. package/dist/tools/site.d.ts.map +1 -1
  29. package/dist/tools/site.js +71 -65
  30. package/dist/tools/site.js.map +1 -1
  31. package/dist/tools/taxonomies.d.ts +2 -8
  32. package/dist/tools/taxonomies.d.ts.map +1 -1
  33. package/dist/tools/taxonomies.js +104 -88
  34. package/dist/tools/taxonomies.js.map +1 -1
  35. package/dist/tools/users.d.ts +2 -8
  36. package/dist/tools/users.d.ts.map +1 -1
  37. package/dist/tools/users.js +83 -77
  38. package/dist/tools/users.js.map +1 -1
  39. package/package.json +4 -3
  40. package/src/tools/auth.ts +33 -33
  41. package/src/tools/cache.ts +29 -75
  42. package/src/tools/comments.ts +94 -94
  43. package/src/tools/media.ts +95 -103
  44. package/src/tools/pages.ts +110 -99
  45. package/src/tools/performance/PerformanceTools.ts +8 -2
  46. package/src/tools/seo/auditors/SiteAuditor.ts +16 -3
  47. package/src/tools/site.ts +75 -73
  48. package/src/tools/taxonomies.ts +106 -96
  49. package/src/tools/users.ts +85 -85
@@ -1,4 +1,5 @@
1
1
  import { WordPressClient } from "@/client/api.js";
2
+ import { MCPToolSchema } from "@/types/mcp.js";
2
3
  import { CommentQueryParams, CreateCommentRequest, UpdateCommentRequest } from "@/types/wordpress.js";
3
4
  import { getErrorMessage } from "@/utils/error.js";
4
5
  import { toolParams } from "./params.js";
@@ -15,143 +16,142 @@ export class CommentTools {
15
16
  public getTools(): Array<{
16
17
  name: string;
17
18
  description: string;
18
- parameters?: Array<{
19
- name: string;
20
- type?: string;
21
- description?: string;
22
- required?: boolean;
23
- enum?: string[];
24
- items?: unknown;
25
- }>;
19
+ inputSchema?: MCPToolSchema;
26
20
  handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
27
21
  }> {
28
22
  return [
29
23
  {
30
24
  name: "wp_list_comments",
31
25
  description: "Lists comments from a WordPress site, with filters.",
32
- parameters: [
33
- {
34
- name: "post",
35
- type: "number",
36
- description: "Limit results to comments assigned to a specific post ID.",
26
+ inputSchema: {
27
+ type: "object",
28
+ properties: {
29
+ post: {
30
+ type: "number",
31
+ description: "Limit results to comments assigned to a specific post ID.",
32
+ },
33
+ status: {
34
+ type: "string",
35
+ description: "Filter by comment status.",
36
+ enum: ["hold", "approve", "spam", "trash"],
37
+ },
37
38
  },
38
- {
39
- name: "status",
40
- type: "string",
41
- description: "Filter by comment status.",
42
- enum: ["hold", "approve", "spam", "trash"],
43
- },
44
- ],
39
+ },
45
40
  handler: this.handleListComments.bind(this),
46
41
  },
47
42
  {
48
43
  name: "wp_get_comment",
49
44
  description: "Retrieves a single comment by its ID.",
50
- parameters: [
51
- {
52
- name: "id",
53
- type: "number",
54
- required: true,
55
- description: "The unique identifier for the comment.",
45
+ inputSchema: {
46
+ type: "object",
47
+ properties: {
48
+ id: {
49
+ type: "number",
50
+ description: "The unique identifier for the comment.",
51
+ },
56
52
  },
57
- ],
53
+ required: ["id"],
54
+ },
58
55
  handler: this.handleGetComment.bind(this),
59
56
  },
60
57
  {
61
58
  name: "wp_create_comment",
62
59
  description: "Creates a new comment on a post.",
63
- parameters: [
64
- {
65
- name: "post",
66
- type: "number",
67
- required: true,
68
- description: "The ID of the post to comment on.",
69
- },
70
- {
71
- name: "content",
72
- type: "string",
73
- required: true,
74
- description: "The content of the comment.",
75
- },
76
- {
77
- name: "author_name",
78
- type: "string",
79
- description: "The name of the comment author.",
80
- },
81
- {
82
- name: "author_email",
83
- type: "string",
84
- description: "The email of the comment author.",
60
+ inputSchema: {
61
+ type: "object",
62
+ properties: {
63
+ post: {
64
+ type: "number",
65
+ description: "The ID of the post to comment on.",
66
+ },
67
+ content: {
68
+ type: "string",
69
+ description: "The content of the comment.",
70
+ },
71
+ author_name: {
72
+ type: "string",
73
+ description: "The name of the comment author.",
74
+ },
75
+ author_email: {
76
+ type: "string",
77
+ description: "The email of the comment author.",
78
+ },
85
79
  },
86
- ],
80
+ required: ["post", "content"],
81
+ },
87
82
  handler: this.handleCreateComment.bind(this),
88
83
  },
89
84
  {
90
85
  name: "wp_update_comment",
91
86
  description: "Updates an existing comment.",
92
- parameters: [
93
- {
94
- name: "id",
95
- type: "number",
96
- required: true,
97
- description: "The ID of the comment to update.",
87
+ inputSchema: {
88
+ type: "object",
89
+ properties: {
90
+ id: {
91
+ type: "number",
92
+ description: "The ID of the comment to update.",
93
+ },
94
+ content: {
95
+ type: "string",
96
+ description: "The updated content for the comment.",
97
+ },
98
+ status: {
99
+ type: "string",
100
+ description: "The new status for the comment.",
101
+ enum: ["hold", "approve", "spam", "trash"],
102
+ },
98
103
  },
99
- {
100
- name: "content",
101
- type: "string",
102
- description: "The updated content for the comment.",
103
- },
104
- {
105
- name: "status",
106
- type: "string",
107
- description: "The new status for the comment.",
108
- enum: ["hold", "approve", "spam", "trash"],
109
- },
110
- ],
104
+ required: ["id"],
105
+ },
111
106
  handler: this.handleUpdateComment.bind(this),
112
107
  },
113
108
  {
114
109
  name: "wp_delete_comment",
115
110
  description: "Deletes a comment.",
116
- parameters: [
117
- {
118
- name: "id",
119
- type: "number",
120
- required: true,
121
- description: "The ID of the comment to delete.",
122
- },
123
- {
124
- name: "force",
125
- type: "boolean",
126
- description: "If true, the comment will be permanently deleted. Defaults to false (moved to trash).",
111
+ inputSchema: {
112
+ type: "object",
113
+ properties: {
114
+ id: {
115
+ type: "number",
116
+ description: "The ID of the comment to delete.",
117
+ },
118
+ force: {
119
+ type: "boolean",
120
+ description: "If true, the comment will be permanently deleted. Defaults to false (moved to trash).",
121
+ },
127
122
  },
128
- ],
123
+ required: ["id"],
124
+ },
129
125
  handler: this.handleDeleteComment.bind(this),
130
126
  },
131
127
  {
132
128
  name: "wp_approve_comment",
133
129
  description: "Approves a pending comment.",
134
- parameters: [
135
- {
136
- name: "id",
137
- type: "number",
138
- required: true,
139
- description: "The ID of the comment to approve.",
130
+ inputSchema: {
131
+ type: "object",
132
+ properties: {
133
+ id: {
134
+ type: "number",
135
+ description: "The ID of the comment to approve.",
136
+ },
140
137
  },
141
- ],
138
+ required: ["id"],
139
+ },
142
140
  handler: this.handleApproveComment.bind(this),
143
141
  },
144
142
  {
145
143
  name: "wp_spam_comment",
146
144
  description: "Marks a comment as spam.",
147
- parameters: [
148
- {
149
- name: "id",
150
- type: "number",
151
- required: true,
152
- description: "The ID of the comment to mark as spam.",
145
+ inputSchema: {
146
+ type: "object",
147
+ properties: {
148
+ id: {
149
+ type: "number",
150
+ description: "The ID of the comment to mark as spam.",
151
+ },
153
152
  },
154
- ],
153
+ required: ["id"],
154
+ },
155
155
  handler: this.handleSpamComment.bind(this),
156
156
  },
157
157
  ];
@@ -1,5 +1,6 @@
1
1
  import * as fs from "fs";
2
2
  import { WordPressClient } from "@/client/api.js";
3
+ import type { MCPToolSchema } from "@/types/mcp.js";
3
4
  import { MediaQueryParams, UpdateMediaRequest, UploadMediaRequest } from "@/types/wordpress.js";
4
5
  import { getErrorMessage } from "@/utils/error.js";
5
6
  import { toolParams } from "./params.js";
@@ -55,140 +56,131 @@ export class MediaTools {
55
56
  public getTools(): Array<{
56
57
  name: string;
57
58
  description: string;
58
- parameters?: Array<{
59
- name: string;
60
- type?: string;
61
- description?: string;
62
- required?: boolean;
63
- enum?: string[];
64
- items?: unknown;
65
- }>;
59
+ inputSchema?: MCPToolSchema;
66
60
  handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
67
61
  }> {
68
62
  return [
69
63
  {
70
64
  name: "wp_list_media",
71
65
  description: "Lists media items from a WordPress site, with filters.",
72
- parameters: [
73
- {
74
- name: "per_page",
75
- type: "number",
76
- description: "Number of items to return per page (max 100).",
66
+ inputSchema: {
67
+ type: "object",
68
+ properties: {
69
+ per_page: {
70
+ type: "number",
71
+ description: "Number of items to return per page (max 100).",
72
+ },
73
+ search: {
74
+ type: "string",
75
+ description: "Limit results to those matching a search term.",
76
+ },
77
+ media_type: {
78
+ type: "string",
79
+ description: "Limit results to a specific media type.",
80
+ enum: ["image", "video", "audio", "application"],
81
+ },
77
82
  },
78
- {
79
- name: "search",
80
- type: "string",
81
- description: "Limit results to those matching a search term.",
82
- },
83
- {
84
- name: "media_type",
85
- type: "string",
86
- description: "Limit results to a specific media type.",
87
- enum: ["image", "video", "audio", "application"],
88
- },
89
- ],
83
+ },
90
84
  handler: this.handleListMedia.bind(this),
91
85
  },
92
86
  {
93
87
  name: "wp_get_media",
94
88
  description: "Retrieves a single media item by its ID.",
95
- parameters: [
96
- {
97
- name: "id",
98
- type: "number",
99
- required: true,
100
- description: "The unique identifier for the media item.",
89
+ inputSchema: {
90
+ type: "object",
91
+ properties: {
92
+ id: {
93
+ type: "number",
94
+ description: "The unique identifier for the media item.",
95
+ },
101
96
  },
102
- ],
97
+ required: ["id"],
98
+ },
103
99
  handler: this.handleGetMedia.bind(this),
104
100
  },
105
101
  {
106
102
  name: "wp_upload_media",
107
103
  description: "Uploads a file to the WordPress media library.",
108
- parameters: [
109
- {
110
- name: "file_path",
111
- type: "string",
112
- required: true,
113
- description: "The local, absolute path to the file to upload.",
114
- },
115
- {
116
- name: "title",
117
- type: "string",
118
- description: "The title for the media item.",
119
- },
120
- {
121
- name: "alt_text",
122
- type: "string",
123
- description: "Alternative text for the media item (for accessibility).",
124
- },
125
- {
126
- name: "caption",
127
- type: "string",
128
- description: "The caption for the media item.",
129
- },
130
- {
131
- name: "description",
132
- type: "string",
133
- description: "The description for the media item.",
104
+ inputSchema: {
105
+ type: "object",
106
+ properties: {
107
+ file_path: {
108
+ type: "string",
109
+ description: "The local, absolute path to the file to upload.",
110
+ },
111
+ title: {
112
+ type: "string",
113
+ description: "The title for the media item.",
114
+ },
115
+ alt_text: {
116
+ type: "string",
117
+ description: "Alternative text for the media item (for accessibility).",
118
+ },
119
+ caption: {
120
+ type: "string",
121
+ description: "The caption for the media item.",
122
+ },
123
+ description: {
124
+ type: "string",
125
+ description: "The description for the media item.",
126
+ },
127
+ post: {
128
+ type: "number",
129
+ description: "The ID of a post to attach this media to.",
130
+ },
134
131
  },
135
- {
136
- name: "post",
137
- type: "number",
138
- description: "The ID of a post to attach this media to.",
139
- },
140
- ],
132
+ required: ["file_path"],
133
+ },
141
134
  handler: this.handleUploadMedia.bind(this),
142
135
  },
143
136
  {
144
137
  name: "wp_update_media",
145
138
  description: "Updates the metadata of an existing media item.",
146
- parameters: [
147
- {
148
- name: "id",
149
- type: "number",
150
- required: true,
151
- description: "The ID of the media item to update.",
152
- },
153
- {
154
- name: "title",
155
- type: "string",
156
- description: "The new title for the media item.",
157
- },
158
- {
159
- name: "alt_text",
160
- type: "string",
161
- description: "The new alternative text.",
139
+ inputSchema: {
140
+ type: "object",
141
+ properties: {
142
+ id: {
143
+ type: "number",
144
+ description: "The ID of the media item to update.",
145
+ },
146
+ title: {
147
+ type: "string",
148
+ description: "The new title for the media item.",
149
+ },
150
+ alt_text: {
151
+ type: "string",
152
+ description: "The new alternative text.",
153
+ },
154
+ caption: {
155
+ type: "string",
156
+ description: "The new caption.",
157
+ },
158
+ description: {
159
+ type: "string",
160
+ description: "The new description.",
161
+ },
162
162
  },
163
- {
164
- name: "caption",
165
- type: "string",
166
- description: "The new caption.",
167
- },
168
- {
169
- name: "description",
170
- type: "string",
171
- description: "The new description.",
172
- },
173
- ],
163
+ required: ["id"],
164
+ },
174
165
  handler: this.handleUpdateMedia.bind(this),
175
166
  },
176
167
  {
177
168
  name: "wp_delete_media",
178
169
  description: "Deletes a media item.",
179
- parameters: [
180
- {
181
- name: "id",
182
- type: "number",
183
- required: true,
184
- description: "The ID of the media item to delete.",
185
- },
186
- {
187
- name: "force",
188
- type: "boolean",
189
- description: "If true, permanently delete. If false, move to trash. Defaults to false.",
170
+ inputSchema: {
171
+ type: "object",
172
+ properties: {
173
+ id: {
174
+ type: "number",
175
+ description: "The ID of the media item to delete.",
176
+ },
177
+ force: {
178
+ type: "boolean",
179
+ description: "If true, permanently delete. If false, move to trash. Defaults to false.",
180
+ },
190
181
  },
191
- ],
182
+ required: ["id"],
183
+ },
192
184
  handler: this.handleDeleteMedia.bind(this),
193
185
  },
194
186
  ];