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.
- package/dist/tools/auth.d.ts +2 -8
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +31 -25
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +35 -50
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +29 -65
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +2 -8
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +92 -86
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/media.d.ts +2 -8
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +98 -100
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts +2 -8
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +103 -91
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance/PerformanceTools.d.ts.map +1 -1
- package/dist/tools/performance/PerformanceTools.js +6 -2
- package/dist/tools/performance/PerformanceTools.js.map +1 -1
- package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -1
- package/dist/tools/seo/auditors/SiteAuditor.js +17 -3
- package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -1
- package/dist/tools/site.d.ts +2 -8
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +71 -65
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +2 -8
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +104 -88
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts +2 -8
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +83 -77
- package/dist/tools/users.js.map +1 -1
- package/package.json +4 -3
- package/src/tools/auth.ts +33 -33
- package/src/tools/cache.ts +29 -75
- package/src/tools/comments.ts +94 -94
- package/src/tools/media.ts +95 -103
- package/src/tools/pages.ts +110 -99
- package/src/tools/performance/PerformanceTools.ts +8 -2
- package/src/tools/seo/auditors/SiteAuditor.ts +16 -3
- package/src/tools/site.ts +75 -73
- package/src/tools/taxonomies.ts +106 -96
- package/src/tools/users.ts +85 -85
package/src/tools/taxonomies.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
];
|
package/src/tools/users.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
: "
|
|
211
|
+
: "Restricted (requires admin)";
|
|
212
212
|
|
|
213
|
-
const roles = u.roles?.join(", ")
|
|
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 || "
|
|
220
|
+
` 📧 Email: ${u.email || "Restricted (requires admin)"}\n` +
|
|
221
221
|
` 🎭 Roles: ${roles}\n` +
|
|
222
222
|
` 📅 Registered: ${registrationDate}\n` +
|
|
223
223
|
` 🔗 URL: ${userUrl}\n` +
|