claude-plugin-wordpress-manager 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.
- package/.claude-plugin/plugin.json +19 -0
- package/.mcp.json +19 -0
- package/CHANGELOG.md +62 -0
- package/LICENSE +69 -0
- package/README.md +213 -0
- package/agents/wp-content-strategist.md +148 -0
- package/agents/wp-deployment-engineer.md +93 -0
- package/agents/wp-performance-optimizer.md +198 -0
- package/agents/wp-security-auditor.md +161 -0
- package/agents/wp-site-manager.md +109 -0
- package/commands/wp-audit.md +37 -0
- package/commands/wp-backup.md +45 -0
- package/commands/wp-deploy.md +38 -0
- package/commands/wp-setup.md +64 -0
- package/commands/wp-status.md +53 -0
- package/docs/GUIDE.md +1190 -0
- package/hooks/hooks.json +57 -0
- package/hooks/scripts/backup-reminder.sh +29 -0
- package/hooks/scripts/pre-deploy-check.sh +49 -0
- package/package.json +46 -0
- package/scripts/health-check.sh +110 -0
- package/scripts/validate-wp-operation.sh +115 -0
- package/servers/wp-rest-bridge/build/server.d.ts +2 -0
- package/servers/wp-rest-bridge/build/server.js +74 -0
- package/servers/wp-rest-bridge/build/tools/comments.d.ts +227 -0
- package/servers/wp-rest-bridge/build/tools/comments.js +192 -0
- package/servers/wp-rest-bridge/build/tools/index.d.ts +919 -0
- package/servers/wp-rest-bridge/build/tools/index.js +30 -0
- package/servers/wp-rest-bridge/build/tools/media.d.ts +174 -0
- package/servers/wp-rest-bridge/build/tools/media.js +247 -0
- package/servers/wp-rest-bridge/build/tools/plugin-repository.d.ts +62 -0
- package/servers/wp-rest-bridge/build/tools/plugin-repository.js +149 -0
- package/servers/wp-rest-bridge/build/tools/plugins.d.ts +153 -0
- package/servers/wp-rest-bridge/build/tools/plugins.js +175 -0
- package/servers/wp-rest-bridge/build/tools/search.d.ts +44 -0
- package/servers/wp-rest-bridge/build/tools/search.js +44 -0
- package/servers/wp-rest-bridge/build/tools/unified-content.d.ts +328 -0
- package/servers/wp-rest-bridge/build/tools/unified-content.js +628 -0
- package/servers/wp-rest-bridge/build/tools/unified-taxonomies.d.ts +244 -0
- package/servers/wp-rest-bridge/build/tools/unified-taxonomies.js +492 -0
- package/servers/wp-rest-bridge/build/tools/users.d.ts +269 -0
- package/servers/wp-rest-bridge/build/tools/users.js +226 -0
- package/servers/wp-rest-bridge/build/types.d.ts +151 -0
- package/servers/wp-rest-bridge/build/types.js +2 -0
- package/servers/wp-rest-bridge/build/wordpress.d.ts +48 -0
- package/servers/wp-rest-bridge/build/wordpress.js +305 -0
- package/servers/wp-rest-bridge/package.json +27 -0
- package/skills/wordpress-router/SKILL.md +78 -0
- package/skills/wordpress-router/references/decision-tree.md +88 -0
- package/skills/wp-abilities-api/SKILL.md +97 -0
- package/skills/wp-abilities-api/references/php-registration.md +67 -0
- package/skills/wp-abilities-api/references/rest-api.md +13 -0
- package/skills/wp-audit/SKILL.md +114 -0
- package/skills/wp-audit/references/performance-checklist.md +113 -0
- package/skills/wp-audit/references/security-checklist.md +95 -0
- package/skills/wp-audit/references/seo-checklist.md +128 -0
- package/skills/wp-backup/SKILL.md +87 -0
- package/skills/wp-backup/references/backup-strategies.md +116 -0
- package/skills/wp-backup/references/restore-procedures.md +129 -0
- package/skills/wp-block-development/SKILL.md +176 -0
- package/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
- package/skills/wp-block-development/references/block-json.md +49 -0
- package/skills/wp-block-development/references/creating-new-blocks.md +46 -0
- package/skills/wp-block-development/references/debugging.md +36 -0
- package/skills/wp-block-development/references/deprecations.md +24 -0
- package/skills/wp-block-development/references/dynamic-rendering.md +23 -0
- package/skills/wp-block-development/references/inner-blocks.md +25 -0
- package/skills/wp-block-development/references/registration.md +30 -0
- package/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
- package/skills/wp-block-development/references/tooling-and-testing.md +21 -0
- package/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
- package/skills/wp-block-themes/SKILL.md +118 -0
- package/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
- package/skills/wp-block-themes/references/debugging.md +24 -0
- package/skills/wp-block-themes/references/patterns.md +18 -0
- package/skills/wp-block-themes/references/style-variations.md +14 -0
- package/skills/wp-block-themes/references/templates-and-parts.md +16 -0
- package/skills/wp-block-themes/references/theme-json.md +59 -0
- package/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
- package/skills/wp-content/SKILL.md +103 -0
- package/skills/wp-content/references/content-templates.md +230 -0
- package/skills/wp-content/references/seo-optimization.md +169 -0
- package/skills/wp-deploy/SKILL.md +52 -0
- package/skills/wp-deploy/references/hostinger-deploy.md +51 -0
- package/skills/wp-deploy/references/ssh-deploy.md +63 -0
- package/skills/wp-interactivity-api/SKILL.md +181 -0
- package/skills/wp-interactivity-api/references/debugging.md +29 -0
- package/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
- package/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
- package/skills/wp-migrate/SKILL.md +100 -0
- package/skills/wp-migrate/references/cross-platform.md +104 -0
- package/skills/wp-migrate/references/hostinger-migration.md +86 -0
- package/skills/wp-performance/SKILL.md +148 -0
- package/skills/wp-performance/references/autoload-options.md +24 -0
- package/skills/wp-performance/references/cron.md +20 -0
- package/skills/wp-performance/references/database.md +20 -0
- package/skills/wp-performance/references/http-api.md +15 -0
- package/skills/wp-performance/references/measurement.md +21 -0
- package/skills/wp-performance/references/object-cache.md +24 -0
- package/skills/wp-performance/references/query-monitor-headless.md +38 -0
- package/skills/wp-performance/references/server-timing.md +22 -0
- package/skills/wp-performance/references/wp-cli-doctor.md +24 -0
- package/skills/wp-performance/references/wp-cli-profile.md +32 -0
- package/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
- package/skills/wp-phpstan/SKILL.md +99 -0
- package/skills/wp-phpstan/references/configuration.md +52 -0
- package/skills/wp-phpstan/references/third-party-classes.md +76 -0
- package/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
- package/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
- package/skills/wp-playground/SKILL.md +103 -0
- package/skills/wp-playground/references/blueprints.md +36 -0
- package/skills/wp-playground/references/cli-commands.md +39 -0
- package/skills/wp-playground/references/debugging.md +16 -0
- package/skills/wp-plugin-development/SKILL.md +114 -0
- package/skills/wp-plugin-development/references/data-and-cron.md +19 -0
- package/skills/wp-plugin-development/references/debugging.md +19 -0
- package/skills/wp-plugin-development/references/lifecycle.md +33 -0
- package/skills/wp-plugin-development/references/security.md +29 -0
- package/skills/wp-plugin-development/references/settings-api.md +22 -0
- package/skills/wp-plugin-development/references/structure.md +16 -0
- package/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
- package/skills/wp-project-triage/SKILL.md +40 -0
- package/skills/wp-project-triage/references/triage.schema.json +143 -0
- package/skills/wp-project-triage/scripts/detect_wp_project.mjs +592 -0
- package/skills/wp-rest-api/SKILL.md +116 -0
- package/skills/wp-rest-api/references/authentication.md +18 -0
- package/skills/wp-rest-api/references/custom-content-types.md +20 -0
- package/skills/wp-rest-api/references/discovery-and-params.md +20 -0
- package/skills/wp-rest-api/references/responses-and-fields.md +30 -0
- package/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
- package/skills/wp-rest-api/references/schema.md +22 -0
- package/skills/wp-wpcli-and-ops/SKILL.md +125 -0
- package/skills/wp-wpcli-and-ops/references/automation.md +30 -0
- package/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
- package/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
- package/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
- package/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
- package/skills/wp-wpcli-and-ops/references/safety.md +30 -0
- package/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
- package/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
- package/skills/wpds/SKILL.md +60 -0
- package/skills/wpds/references/wpds-mcp-setup.md +59 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const listPluginsSchema: z.ZodObject<{
|
|
4
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["active", "inactive"]>>>;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
status: "active" | "inactive";
|
|
7
|
+
}, {
|
|
8
|
+
status?: "active" | "inactive" | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
declare const getPluginSchema: z.ZodObject<{
|
|
11
|
+
plugin: z.ZodString;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
plugin: string;
|
|
14
|
+
}, {
|
|
15
|
+
plugin: string;
|
|
16
|
+
}>;
|
|
17
|
+
declare const activatePluginSchema: z.ZodObject<{
|
|
18
|
+
plugin: z.ZodString;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
plugin: string;
|
|
21
|
+
}, {
|
|
22
|
+
plugin: string;
|
|
23
|
+
}>;
|
|
24
|
+
declare const deactivatePluginSchema: z.ZodObject<{
|
|
25
|
+
plugin: z.ZodString;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
plugin: string;
|
|
28
|
+
}, {
|
|
29
|
+
plugin: string;
|
|
30
|
+
}>;
|
|
31
|
+
declare const createPluginSchema: z.ZodObject<{
|
|
32
|
+
slug: z.ZodString;
|
|
33
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["inactive", "active"]>>>;
|
|
34
|
+
}, "strict", z.ZodTypeAny, {
|
|
35
|
+
slug: string;
|
|
36
|
+
status: "active" | "inactive";
|
|
37
|
+
}, {
|
|
38
|
+
slug: string;
|
|
39
|
+
status?: "active" | "inactive" | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
declare const deletePluginSchema: z.ZodObject<{
|
|
42
|
+
plugin: z.ZodString;
|
|
43
|
+
}, "strict", z.ZodTypeAny, {
|
|
44
|
+
plugin: string;
|
|
45
|
+
}, {
|
|
46
|
+
plugin: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const pluginTools: Tool[];
|
|
49
|
+
export declare const pluginHandlers: {
|
|
50
|
+
list_plugins: (params: z.infer<typeof listPluginsSchema>) => Promise<{
|
|
51
|
+
toolResult: {
|
|
52
|
+
content: {
|
|
53
|
+
type: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}[];
|
|
56
|
+
isError?: undefined;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
toolResult: {
|
|
60
|
+
isError: boolean;
|
|
61
|
+
content: {
|
|
62
|
+
type: string;
|
|
63
|
+
text: string;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
get_plugin: (params: z.infer<typeof getPluginSchema>) => Promise<{
|
|
68
|
+
toolResult: {
|
|
69
|
+
content: {
|
|
70
|
+
type: string;
|
|
71
|
+
text: string;
|
|
72
|
+
}[];
|
|
73
|
+
isError?: undefined;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
toolResult: {
|
|
77
|
+
isError: boolean;
|
|
78
|
+
content: {
|
|
79
|
+
type: string;
|
|
80
|
+
text: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
84
|
+
activate_plugin: (params: z.infer<typeof activatePluginSchema>) => Promise<{
|
|
85
|
+
toolResult: {
|
|
86
|
+
content: {
|
|
87
|
+
type: string;
|
|
88
|
+
text: string;
|
|
89
|
+
}[];
|
|
90
|
+
isError?: undefined;
|
|
91
|
+
};
|
|
92
|
+
} | {
|
|
93
|
+
toolResult: {
|
|
94
|
+
isError: boolean;
|
|
95
|
+
content: {
|
|
96
|
+
type: string;
|
|
97
|
+
text: string;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
101
|
+
deactivate_plugin: (params: z.infer<typeof deactivatePluginSchema>) => Promise<{
|
|
102
|
+
toolResult: {
|
|
103
|
+
content: {
|
|
104
|
+
type: string;
|
|
105
|
+
text: string;
|
|
106
|
+
}[];
|
|
107
|
+
isError?: undefined;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
toolResult: {
|
|
111
|
+
isError: boolean;
|
|
112
|
+
content: {
|
|
113
|
+
type: string;
|
|
114
|
+
text: string;
|
|
115
|
+
}[];
|
|
116
|
+
};
|
|
117
|
+
}>;
|
|
118
|
+
create_plugin: (params: z.infer<typeof createPluginSchema>) => Promise<{
|
|
119
|
+
toolResult: {
|
|
120
|
+
content: {
|
|
121
|
+
type: string;
|
|
122
|
+
text: string;
|
|
123
|
+
}[];
|
|
124
|
+
isError?: undefined;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
toolResult: {
|
|
128
|
+
isError: boolean;
|
|
129
|
+
content: {
|
|
130
|
+
type: string;
|
|
131
|
+
text: string;
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
}>;
|
|
135
|
+
delete_plugin: (params: z.infer<typeof deletePluginSchema>) => Promise<{
|
|
136
|
+
toolResult: {
|
|
137
|
+
content: {
|
|
138
|
+
type: string;
|
|
139
|
+
text: string;
|
|
140
|
+
}[];
|
|
141
|
+
isError?: undefined;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
toolResult: {
|
|
145
|
+
isError: boolean;
|
|
146
|
+
content: {
|
|
147
|
+
type: string;
|
|
148
|
+
text: string;
|
|
149
|
+
}[];
|
|
150
|
+
};
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
153
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Note: Plugin operations require authentication with admin privileges
|
|
4
|
+
// and use a different endpoint than the standard WP API (wp-json/wp/v2/plugins)
|
|
5
|
+
// Make schema empty since the WordPress REST API plugins endpoint doesn't accept parameters
|
|
6
|
+
// in the same way as other endpoints
|
|
7
|
+
const listPluginsSchema = z.object({
|
|
8
|
+
status: z.enum(['active', 'inactive']).optional().default('active').describe("Filter plugins by status (active, inactive)")
|
|
9
|
+
}).strict();
|
|
10
|
+
const getPluginSchema = z.object({
|
|
11
|
+
plugin: z.string().describe("Plugin identifier in folder/file.php format (e.g., 'akismet/akismet.php', 'elementor/elementor.php')")
|
|
12
|
+
}).strict();
|
|
13
|
+
const activatePluginSchema = z.object({
|
|
14
|
+
plugin: z.string().describe("Plugin identifier in folder/file.php format (e.g., 'akismet/akismet.php', 'elementor/elementor.php')")
|
|
15
|
+
}).strict();
|
|
16
|
+
const deactivatePluginSchema = z.object({
|
|
17
|
+
plugin: z.string().describe("Plugin identifier in folder/file.php format (e.g., 'akismet/akismet.php', 'elementor/elementor.php')")
|
|
18
|
+
}).strict();
|
|
19
|
+
const createPluginSchema = z.object({
|
|
20
|
+
slug: z.string({ required_error: "Plugin slug is required" }).describe("WordPress.org plugin directory slug, e.g., 'akismet', 'elementor', 'wordpress-seo'"),
|
|
21
|
+
status: z.enum(['inactive', 'active']).optional().default('active').describe("Plugin activation status")
|
|
22
|
+
}).strict();
|
|
23
|
+
const deletePluginSchema = z.object({
|
|
24
|
+
plugin: z.string().describe("Plugin identifier in folder/file.php format (e.g., 'akismet/akismet.php')")
|
|
25
|
+
}).strict();
|
|
26
|
+
// Define tool set for plugin operations
|
|
27
|
+
export const pluginTools = [
|
|
28
|
+
{
|
|
29
|
+
name: "list_plugins",
|
|
30
|
+
description: "Lists all plugins with filtering options",
|
|
31
|
+
inputSchema: { type: "object", properties: listPluginsSchema.shape }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "get_plugin",
|
|
35
|
+
description: "Retrieves plugin details",
|
|
36
|
+
inputSchema: { type: "object", properties: getPluginSchema.shape }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "activate_plugin",
|
|
40
|
+
description: "Activates a plugin",
|
|
41
|
+
inputSchema: { type: "object", properties: activatePluginSchema.shape }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "deactivate_plugin",
|
|
45
|
+
description: "Deactivates a plugin",
|
|
46
|
+
inputSchema: { type: "object", properties: deactivatePluginSchema.shape }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "create_plugin",
|
|
50
|
+
description: "Creates a plugin from the WordPress.org repository",
|
|
51
|
+
inputSchema: { type: "object", properties: createPluginSchema.shape }
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "delete_plugin",
|
|
55
|
+
description: "Deletes an installed plugin (must be deactivated first)",
|
|
56
|
+
inputSchema: { type: "object", properties: deletePluginSchema.shape }
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
// Define handlers for each plugin operation
|
|
60
|
+
export const pluginHandlers = {
|
|
61
|
+
list_plugins: async (params) => {
|
|
62
|
+
try {
|
|
63
|
+
const response = await makeWordPressRequest("GET", "plugins", params);
|
|
64
|
+
return {
|
|
65
|
+
toolResult: {
|
|
66
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
72
|
+
return {
|
|
73
|
+
toolResult: {
|
|
74
|
+
isError: true,
|
|
75
|
+
content: [{ type: "text", text: `Error listing plugins: ${errorMessage}` }]
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
get_plugin: async (params) => {
|
|
81
|
+
try {
|
|
82
|
+
const response = await makeWordPressRequest("GET", `plugins/${params.plugin}`);
|
|
83
|
+
return {
|
|
84
|
+
toolResult: {
|
|
85
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
91
|
+
return {
|
|
92
|
+
toolResult: {
|
|
93
|
+
isError: true,
|
|
94
|
+
content: [{ type: "text", text: `Error retrieving plugin: ${errorMessage}` }]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
activate_plugin: async (params) => {
|
|
100
|
+
try {
|
|
101
|
+
const response = await makeWordPressRequest("PUT", `plugins/${params.plugin}`, { status: 'active' });
|
|
102
|
+
return {
|
|
103
|
+
toolResult: {
|
|
104
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
110
|
+
return {
|
|
111
|
+
toolResult: {
|
|
112
|
+
isError: true,
|
|
113
|
+
content: [{ type: "text", text: `Error activating plugin: ${errorMessage}` }]
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
deactivate_plugin: async (params) => {
|
|
119
|
+
try {
|
|
120
|
+
const response = await makeWordPressRequest("PUT", `plugins/${params.plugin}`, { status: 'inactive' });
|
|
121
|
+
return {
|
|
122
|
+
toolResult: {
|
|
123
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
129
|
+
return {
|
|
130
|
+
toolResult: {
|
|
131
|
+
isError: true,
|
|
132
|
+
content: [{ type: "text", text: `Error deactivating plugin: ${errorMessage}` }]
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
create_plugin: async (params) => {
|
|
138
|
+
try {
|
|
139
|
+
const response = await makeWordPressRequest("POST", "plugins", params);
|
|
140
|
+
return {
|
|
141
|
+
toolResult: {
|
|
142
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
148
|
+
return {
|
|
149
|
+
toolResult: {
|
|
150
|
+
isError: true,
|
|
151
|
+
content: [{ type: "text", text: `Error creating plugin: ${errorMessage}` }]
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
delete_plugin: async (params) => {
|
|
157
|
+
try {
|
|
158
|
+
const response = await makeWordPressRequest("DELETE", `plugins/${params.plugin}`);
|
|
159
|
+
return {
|
|
160
|
+
toolResult: {
|
|
161
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
167
|
+
return {
|
|
168
|
+
toolResult: {
|
|
169
|
+
isError: true,
|
|
170
|
+
content: [{ type: "text", text: `Error deleting plugin: ${errorMessage}` }]
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const wpSearchSchema: z.ZodObject<{
|
|
4
|
+
search: z.ZodString;
|
|
5
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
per_page: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
type: z.ZodOptional<z.ZodString>;
|
|
8
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
9
|
+
_embed: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
_fields: z.ZodOptional<z.ZodString>;
|
|
11
|
+
include_pagination: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
search: string;
|
|
14
|
+
page?: number | undefined;
|
|
15
|
+
per_page?: number | undefined;
|
|
16
|
+
type?: string | undefined;
|
|
17
|
+
_embed?: boolean | undefined;
|
|
18
|
+
_fields?: string | undefined;
|
|
19
|
+
include_pagination?: boolean | undefined;
|
|
20
|
+
subtype?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
search: string;
|
|
23
|
+
page?: number | undefined;
|
|
24
|
+
per_page?: number | undefined;
|
|
25
|
+
type?: string | undefined;
|
|
26
|
+
_embed?: boolean | undefined;
|
|
27
|
+
_fields?: string | undefined;
|
|
28
|
+
include_pagination?: boolean | undefined;
|
|
29
|
+
subtype?: string | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
type WpSearchParams = z.infer<typeof wpSearchSchema>;
|
|
32
|
+
export declare const searchTools: Tool[];
|
|
33
|
+
export declare const searchHandlers: {
|
|
34
|
+
wp_search: (params: WpSearchParams) => Promise<{
|
|
35
|
+
toolResult: {
|
|
36
|
+
content: {
|
|
37
|
+
type: string;
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
isError: boolean;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const wpSearchSchema = z.object({
|
|
4
|
+
search: z.string().describe("Search term to find across all content types"),
|
|
5
|
+
page: z.number().optional().describe("Page number (default 1)"),
|
|
6
|
+
per_page: z.number().min(1).max(100).optional().describe("Items per page (default 10, max 100)"),
|
|
7
|
+
type: z.string().optional().describe("Limit to a specific content type (post, page, etc.)"),
|
|
8
|
+
subtype: z.string().optional().describe("Limit to a specific subtype"),
|
|
9
|
+
_embed: z.boolean().optional().describe("Inline related resources"),
|
|
10
|
+
_fields: z.string().optional().describe("Comma-separated list of fields to return"),
|
|
11
|
+
include_pagination: z.boolean().optional().describe("Include pagination metadata in response")
|
|
12
|
+
});
|
|
13
|
+
export const searchTools = [
|
|
14
|
+
{
|
|
15
|
+
name: "wp_search",
|
|
16
|
+
description: "Searches across all WordPress content types (posts, pages, custom types) using the native /search endpoint",
|
|
17
|
+
inputSchema: { type: "object", properties: wpSearchSchema.shape }
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
export const searchHandlers = {
|
|
21
|
+
wp_search: async (params) => {
|
|
22
|
+
try {
|
|
23
|
+
const { include_pagination, ...queryParams } = params;
|
|
24
|
+
const response = await makeWordPressRequest('GET', 'search', queryParams, {
|
|
25
|
+
includePagination: include_pagination,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
toolResult: {
|
|
29
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
30
|
+
isError: false
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
36
|
+
return {
|
|
37
|
+
toolResult: {
|
|
38
|
+
isError: true,
|
|
39
|
+
content: [{ type: 'text', text: `Error searching WordPress: ${errorMessage}` }],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|