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 type { MCPToolSchema } from "@/types/mcp.js";
2
3
  import { CreateCategoryRequest, CreateTagRequest, UpdateCategoryRequest, UpdateTagRequest } from "@/types/wordpress.js";
3
4
  import { getErrorMessage } from "@/utils/error.js";
4
5
  import { toolParams } from "./params.js";
@@ -15,14 +16,7 @@ export class TaxonomyTools {
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 [
@@ -30,150 +24,166 @@ export class TaxonomyTools {
30
24
  {
31
25
  name: "wp_list_categories",
32
26
  description: "Lists categories from a WordPress site.",
33
- parameters: [
34
- {
35
- name: "search",
36
- type: "string",
37
- description: "Limit results to those matching a search term.",
27
+ inputSchema: {
28
+ type: "object",
29
+ properties: {
30
+ search: {
31
+ type: "string",
32
+ description: "Limit results to those matching a search term.",
33
+ },
34
+ hide_empty: {
35
+ type: "boolean",
36
+ description: "Whether to hide categories with no posts.",
37
+ },
38
38
  },
39
- {
40
- name: "hide_empty",
41
- type: "boolean",
42
- description: "Whether to hide categories with no posts.",
43
- },
44
- ],
39
+ },
45
40
  handler: this.handleListCategories.bind(this),
46
41
  },
47
42
  {
48
43
  name: "wp_get_category",
49
44
  description: "Retrieves a single category by its ID.",
50
- parameters: [
51
- {
52
- name: "id",
53
- type: "number",
54
- required: true,
55
- description: "The unique identifier for the category.",
45
+ inputSchema: {
46
+ type: "object",
47
+ properties: {
48
+ id: {
49
+ type: "number",
50
+ description: "The unique identifier for the category.",
51
+ },
56
52
  },
57
- ],
53
+ required: ["id"],
54
+ },
58
55
  handler: this.handleGetCategory.bind(this),
59
56
  },
60
57
  {
61
58
  name: "wp_create_category",
62
59
  description: "Creates a new category.",
63
- parameters: [
64
- {
65
- name: "name",
66
- type: "string",
67
- required: true,
68
- description: "The name of the category.",
69
- },
70
- {
71
- name: "description",
72
- type: "string",
73
- description: "The description for the category.",
60
+ inputSchema: {
61
+ type: "object",
62
+ properties: {
63
+ name: {
64
+ type: "string",
65
+ description: "The name of the category.",
66
+ },
67
+ description: {
68
+ type: "string",
69
+ description: "The description for the category.",
70
+ },
74
71
  },
75
- ],
72
+ required: ["name"],
73
+ },
76
74
  handler: this.handleCreateCategory.bind(this),
77
75
  },
78
76
  {
79
77
  name: "wp_update_category",
80
78
  description: "Updates an existing category.",
81
- parameters: [
82
- {
83
- name: "id",
84
- type: "number",
85
- required: true,
86
- description: "The ID of the category to update.",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ id: {
83
+ type: "number",
84
+ description: "The ID of the category to update.",
85
+ },
86
+ name: {
87
+ type: "string",
88
+ description: "The new name for the category.",
89
+ },
87
90
  },
88
- {
89
- name: "name",
90
- type: "string",
91
- description: "The new name for the category.",
92
- },
93
- ],
91
+ required: ["id"],
92
+ },
94
93
  handler: this.handleUpdateCategory.bind(this),
95
94
  },
96
95
  {
97
96
  name: "wp_delete_category",
98
97
  description: "Deletes a category.",
99
- parameters: [
100
- {
101
- name: "id",
102
- type: "number",
103
- required: true,
104
- description: "The ID of the category to delete.",
98
+ inputSchema: {
99
+ type: "object",
100
+ properties: {
101
+ id: {
102
+ type: "number",
103
+ description: "The ID of the category to delete.",
104
+ },
105
105
  },
106
- ],
106
+ required: ["id"],
107
+ },
107
108
  handler: this.handleDeleteCategory.bind(this),
108
109
  },
109
110
  // Tags
110
111
  {
111
112
  name: "wp_list_tags",
112
113
  description: "Lists tags from a WordPress site.",
113
- parameters: [
114
- {
115
- name: "search",
116
- type: "string",
117
- description: "Limit results to those matching a search term.",
114
+ inputSchema: {
115
+ type: "object",
116
+ properties: {
117
+ search: {
118
+ type: "string",
119
+ description: "Limit results to those matching a search term.",
120
+ },
118
121
  },
119
- ],
122
+ },
120
123
  handler: this.handleListTags.bind(this),
121
124
  },
122
125
  {
123
126
  name: "wp_get_tag",
124
127
  description: "Retrieves a single tag by its ID.",
125
- parameters: [
126
- {
127
- name: "id",
128
- type: "number",
129
- required: true,
130
- description: "The unique identifier for the tag.",
128
+ inputSchema: {
129
+ type: "object",
130
+ properties: {
131
+ id: {
132
+ type: "number",
133
+ description: "The unique identifier for the tag.",
134
+ },
131
135
  },
132
- ],
136
+ required: ["id"],
137
+ },
133
138
  handler: this.handleGetTag.bind(this),
134
139
  },
135
140
  {
136
141
  name: "wp_create_tag",
137
142
  description: "Creates a new tag.",
138
- parameters: [
139
- {
140
- name: "name",
141
- type: "string",
142
- required: true,
143
- description: "The name of the tag.",
143
+ inputSchema: {
144
+ type: "object",
145
+ properties: {
146
+ name: {
147
+ type: "string",
148
+ description: "The name of the tag.",
149
+ },
144
150
  },
145
- ],
151
+ required: ["name"],
152
+ },
146
153
  handler: this.handleCreateTag.bind(this),
147
154
  },
148
155
  {
149
156
  name: "wp_update_tag",
150
157
  description: "Updates an existing tag.",
151
- parameters: [
152
- {
153
- name: "id",
154
- type: "number",
155
- required: true,
156
- description: "The ID of the tag to update.",
157
- },
158
- {
159
- name: "name",
160
- type: "string",
161
- description: "The new name for the tag.",
158
+ inputSchema: {
159
+ type: "object",
160
+ properties: {
161
+ id: {
162
+ type: "number",
163
+ description: "The ID of the tag to update.",
164
+ },
165
+ name: {
166
+ type: "string",
167
+ description: "The new name for the tag.",
168
+ },
162
169
  },
163
- ],
170
+ required: ["id"],
171
+ },
164
172
  handler: this.handleUpdateTag.bind(this),
165
173
  },
166
174
  {
167
175
  name: "wp_delete_tag",
168
176
  description: "Deletes a tag.",
169
- parameters: [
170
- {
171
- name: "id",
172
- type: "number",
173
- required: true,
174
- description: "The ID of the tag to delete.",
177
+ inputSchema: {
178
+ type: "object",
179
+ properties: {
180
+ id: {
181
+ type: "number",
182
+ description: "The ID of the tag to delete.",
183
+ },
175
184
  },
176
- ],
185
+ required: ["id"],
186
+ },
177
187
  handler: this.handleDeleteTag.bind(this),
178
188
  },
179
189
  ];
@@ -1,4 +1,5 @@
1
1
  import { WordPressClient } from "@/client/api.js";
2
+ import type { MCPToolSchema } from "@/types/mcp.js";
2
3
  import { CreateUserRequest, UpdateUserRequest, UserQueryParams } from "@/types/wordpress.js";
3
4
  import { getErrorMessage } from "@/utils/error.js";
4
5
  import { WordPressDataStreamer, StreamingUtils, StreamingResult } from "@/utils/streaming.js";
@@ -16,14 +17,7 @@ export class UserTools {
16
17
  public getTools(): Array<{
17
18
  name: string;
18
19
  description: string;
19
- parameters?: Array<{
20
- name: string;
21
- type?: string;
22
- description?: string;
23
- required?: boolean;
24
- enum?: string[];
25
- items?: unknown;
26
- }>;
20
+ inputSchema?: MCPToolSchema;
27
21
  handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
28
22
  }> {
29
23
  return [
@@ -31,38 +25,43 @@ export class UserTools {
31
25
  name: "wp_list_users",
32
26
  description:
33
27
  "Lists users from a WordPress site with comprehensive filtering and detailed user information including roles, registration dates, and activity status.\n\n" +
28
+ "**Note:** Role, email, and registration date fields require **administrator** privileges. " +
29
+ "Non-admin users will see limited metadata due to WordPress REST API restrictions.\n\n" +
34
30
  "**Usage Examples:**\n" +
35
31
  "• List all users: `wp_list_users`\n" +
36
32
  '• Search users: `wp_list_users --search="john"`\n' +
37
33
  '• Filter by role: `wp_list_users --roles=["editor","author"]`\n' +
38
34
  '• Find admins: `wp_list_users --roles=["administrator"]`\n' +
39
35
  '• Combined search: `wp_list_users --search="smith" --roles=["subscriber"]`',
40
- parameters: [
41
- {
42
- name: "search",
43
- type: "string",
44
- description: "Limit results to those matching a search term.",
36
+ inputSchema: {
37
+ type: "object",
38
+ properties: {
39
+ search: {
40
+ type: "string",
41
+ description: "Limit results to those matching a search term.",
42
+ },
43
+ roles: {
44
+ type: "array",
45
+ items: { type: "string" },
46
+ description: "Limit results to users with specific roles.",
47
+ },
45
48
  },
46
- {
47
- name: "roles",
48
- type: "array",
49
- items: { type: "string" },
50
- description: "Limit results to users with specific roles.",
51
- },
52
- ],
49
+ },
53
50
  handler: this.handleListUsers.bind(this),
54
51
  },
55
52
  {
56
53
  name: "wp_get_user",
57
54
  description: "Retrieves a single user by their ID.",
58
- parameters: [
59
- {
60
- name: "id",
61
- type: "number",
62
- required: true,
63
- description: "The unique identifier for the user.",
55
+ inputSchema: {
56
+ type: "object",
57
+ properties: {
58
+ id: {
59
+ type: "number",
60
+ description: "The unique identifier for the user.",
61
+ },
64
62
  },
65
- ],
63
+ required: ["id"],
64
+ },
66
65
  handler: this.handleGetUser.bind(this),
67
66
  },
68
67
  {
@@ -74,79 +73,80 @@ export class UserTools {
74
73
  "• Check permissions: Use this to verify your current user's capabilities and roles\n" +
75
74
  "• Account verification: Confirm you're authenticated with the correct account\n" +
76
75
  "• Profile details: View registration date, email, and user metadata",
77
- parameters: [],
76
+ inputSchema: {
77
+ type: "object",
78
+ properties: {},
79
+ },
78
80
  handler: this.handleGetCurrentUser.bind(this),
79
81
  },
80
82
  {
81
83
  name: "wp_create_user",
82
84
  description: "Creates a new user.",
83
- parameters: [
84
- {
85
- name: "username",
86
- type: "string",
87
- required: true,
88
- description: "The username for the new user.",
89
- },
90
- {
91
- name: "email",
92
- type: "string",
93
- required: true,
94
- description: "The email address for the new user.",
95
- },
96
- {
97
- name: "password",
98
- type: "string",
99
- required: true,
100
- description: "The password for the new user.",
101
- },
102
- {
103
- name: "roles",
104
- type: "array",
105
- items: { type: "string" },
106
- description: "An array of roles to assign to the user.",
85
+ inputSchema: {
86
+ type: "object",
87
+ properties: {
88
+ username: {
89
+ type: "string",
90
+ description: "The username for the new user.",
91
+ },
92
+ email: {
93
+ type: "string",
94
+ description: "The email address for the new user.",
95
+ },
96
+ password: {
97
+ type: "string",
98
+ description: "The password for the new user.",
99
+ },
100
+ roles: {
101
+ type: "array",
102
+ items: { type: "string" },
103
+ description: "An array of roles to assign to the user.",
104
+ },
107
105
  },
108
- ],
106
+ required: ["username", "email", "password"],
107
+ },
109
108
  handler: this.handleCreateUser.bind(this),
110
109
  },
111
110
  {
112
111
  name: "wp_update_user",
113
112
  description: "Updates an existing user.",
114
- parameters: [
115
- {
116
- name: "id",
117
- type: "number",
118
- required: true,
119
- description: "The ID of the user to update.",
120
- },
121
- {
122
- name: "email",
123
- type: "string",
124
- description: "The new email address for the user.",
125
- },
126
- {
127
- name: "name",
128
- type: "string",
129
- description: "The new display name for the user.",
113
+ inputSchema: {
114
+ type: "object",
115
+ properties: {
116
+ id: {
117
+ type: "number",
118
+ description: "The ID of the user to update.",
119
+ },
120
+ email: {
121
+ type: "string",
122
+ description: "The new email address for the user.",
123
+ },
124
+ name: {
125
+ type: "string",
126
+ description: "The new display name for the user.",
127
+ },
130
128
  },
131
- ],
129
+ required: ["id"],
130
+ },
132
131
  handler: this.handleUpdateUser.bind(this),
133
132
  },
134
133
  {
135
134
  name: "wp_delete_user",
136
135
  description: "Deletes a user.",
137
- parameters: [
138
- {
139
- name: "id",
140
- type: "number",
141
- required: true,
142
- description: "The ID of the user to delete.",
143
- },
144
- {
145
- name: "reassign",
146
- type: "number",
147
- description: "The ID of a user to reassign the deleted user's content to.",
136
+ inputSchema: {
137
+ type: "object",
138
+ properties: {
139
+ id: {
140
+ type: "number",
141
+ description: "The ID of the user to delete.",
142
+ },
143
+ reassign: {
144
+ type: "number",
145
+ description: "The ID of a user to reassign the deleted user's content to.",
146
+ },
148
147
  },
149
- ],
148
+ required: ["id"],
149
+ },
150
150
  handler: this.handleDeleteUser.bind(this),
151
151
  },
152
152
  ];
@@ -208,16 +208,16 @@ export class UserTools {
208
208
  month: "short",
209
209
  day: "numeric",
210
210
  })
211
- : "Unknown";
211
+ : "Restricted (requires admin)";
212
212
 
213
- const roles = u.roles?.join(", ") || "No roles";
213
+ const roles = u.roles?.length ? u.roles.join(", ") : "Restricted (requires admin)";
214
214
  const description = u.description || "No description";
215
215
  const displayName = u.name || "No display name";
216
216
  const userUrl = u.url || "No URL";
217
217
 
218
218
  return (
219
219
  `- **ID ${u.id}**: ${displayName} (@${u.slug})\n` +
220
- ` 📧 Email: ${u.email || "No email"}\n` +
220
+ ` 📧 Email: ${u.email || "Restricted (requires admin)"}\n` +
221
221
  ` 🎭 Roles: ${roles}\n` +
222
222
  ` 📅 Registered: ${registrationDate}\n` +
223
223
  ` 🔗 URL: ${userUrl}\n` +