mcp-wordpress 3.1.11 → 3.1.12
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/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 +93 -89
- package/dist/tools/pages.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 +69 -63
- 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 +78 -74
- package/dist/tools/users.js.map +1 -1
- package/package.json +1 -1
- package/src/tools/auth.ts +33 -33
- package/src/tools/comments.ts +94 -94
- package/src/tools/media.ts +95 -103
- package/src/tools/pages.ts +95 -97
- package/src/tools/site.ts +71 -71
- package/src/tools/taxonomies.ts +106 -96
- package/src/tools/users.ts +80 -82
package/src/tools/media.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
];
|
package/src/tools/pages.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 { CreatePageRequest, PostQueryParams as PageQueryParams, UpdatePageRequest } from "@/types/wordpress.js";
|
|
3
4
|
import { getErrorMessage } from "@/utils/error.js";
|
|
4
5
|
import { toolParams } from "./params.js";
|
|
@@ -15,140 +16,137 @@ export class PageTools {
|
|
|
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 [
|
|
29
23
|
{
|
|
30
24
|
name: "wp_list_pages",
|
|
31
25
|
description: "Lists pages from a WordPress site, with filters.",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
per_page: {
|
|
30
|
+
type: "number",
|
|
31
|
+
description: "Number of items to return per page (max 100).",
|
|
32
|
+
},
|
|
33
|
+
search: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Limit results to those matching a search term.",
|
|
36
|
+
},
|
|
37
|
+
status: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Filter by page status.",
|
|
40
|
+
enum: ["publish", "future", "draft", "pending", "private"],
|
|
41
|
+
},
|
|
37
42
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type: "string",
|
|
41
|
-
description: "Limit results to those matching a search term.",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "status",
|
|
45
|
-
type: "string",
|
|
46
|
-
description: "Filter by page status.",
|
|
47
|
-
enum: ["publish", "future", "draft", "pending", "private"],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
43
|
+
required: [],
|
|
44
|
+
},
|
|
50
45
|
handler: this.handleListPages.bind(this),
|
|
51
46
|
},
|
|
52
47
|
{
|
|
53
48
|
name: "wp_get_page",
|
|
54
49
|
description: "Retrieves a single page by its ID, optionally including full content for editing.",
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
id: {
|
|
54
|
+
type: "number",
|
|
55
|
+
description: "The unique identifier for the page.",
|
|
56
|
+
},
|
|
57
|
+
include_content: {
|
|
58
|
+
type: "boolean",
|
|
59
|
+
description: "If true, includes the full HTML content of the page. Default: false",
|
|
60
|
+
},
|
|
66
61
|
},
|
|
67
|
-
|
|
62
|
+
required: ["id"],
|
|
63
|
+
},
|
|
68
64
|
handler: this.handleGetPage.bind(this),
|
|
69
65
|
},
|
|
70
66
|
{
|
|
71
67
|
name: "wp_create_page",
|
|
72
68
|
description: "Creates a new page.",
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
enum: ["publish", "draft", "pending", "private"],
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
title: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "The title for the page.",
|
|
75
|
+
},
|
|
76
|
+
content: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "The content for the page, in HTML format.",
|
|
79
|
+
},
|
|
80
|
+
status: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "The publishing status for the page.",
|
|
83
|
+
enum: ["publish", "draft", "pending", "private"],
|
|
84
|
+
},
|
|
90
85
|
},
|
|
91
|
-
|
|
86
|
+
required: ["title"],
|
|
87
|
+
},
|
|
92
88
|
handler: this.handleCreatePage.bind(this),
|
|
93
89
|
},
|
|
94
90
|
{
|
|
95
91
|
name: "wp_update_page",
|
|
96
92
|
description: "Updates an existing page.",
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
id: {
|
|
97
|
+
type: "number",
|
|
98
|
+
description: "The ID of the page to update.",
|
|
99
|
+
},
|
|
100
|
+
title: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "The new title for the page.",
|
|
103
|
+
},
|
|
104
|
+
content: {
|
|
105
|
+
type: "string",
|
|
106
|
+
description: "The new content for the page, in HTML format.",
|
|
107
|
+
},
|
|
108
|
+
status: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "The new status for the page.",
|
|
111
|
+
enum: ["publish", "draft", "pending", "private"],
|
|
112
|
+
},
|
|
103
113
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
type: "string",
|
|
107
|
-
description: "The new title for the page.",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "content",
|
|
111
|
-
type: "string",
|
|
112
|
-
description: "The new content for the page, in HTML format.",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "status",
|
|
116
|
-
type: "string",
|
|
117
|
-
description: "The new status for the page.",
|
|
118
|
-
enum: ["publish", "draft", "pending", "private"],
|
|
119
|
-
},
|
|
120
|
-
],
|
|
114
|
+
required: ["id"],
|
|
115
|
+
},
|
|
121
116
|
handler: this.handleUpdatePage.bind(this),
|
|
122
117
|
},
|
|
123
118
|
{
|
|
124
119
|
name: "wp_delete_page",
|
|
125
120
|
description: "Deletes a page.",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
id: {
|
|
125
|
+
type: "number",
|
|
126
|
+
description: "The ID of the page to delete.",
|
|
127
|
+
},
|
|
128
|
+
force: {
|
|
129
|
+
type: "boolean",
|
|
130
|
+
description: "If true, permanently delete. If false, move to trash. Defaults to false.",
|
|
131
|
+
},
|
|
137
132
|
},
|
|
138
|
-
|
|
133
|
+
required: ["id"],
|
|
134
|
+
},
|
|
139
135
|
handler: this.handleDeletePage.bind(this),
|
|
140
136
|
},
|
|
141
137
|
{
|
|
142
138
|
name: "wp_get_page_revisions",
|
|
143
139
|
description: "Retrieves revisions for a specific page.",
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
id: {
|
|
144
|
+
type: "number",
|
|
145
|
+
description: "The ID of the page to get revisions for.",
|
|
146
|
+
},
|
|
150
147
|
},
|
|
151
|
-
|
|
148
|
+
required: ["id"],
|
|
149
|
+
},
|
|
152
150
|
handler: this.handleGetPageRevisions.bind(this),
|
|
153
151
|
},
|
|
154
152
|
];
|