@adsim/wordpress-mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +272 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +308 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +191 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/formatters.d.ts +22 -0
- package/dist/services/formatters.d.ts.map +1 -0
- package/dist/services/formatters.js +52 -0
- package/dist/services/formatters.js.map +1 -0
- package/dist/services/wp-client.d.ts +38 -0
- package/dist/services/wp-client.d.ts.map +1 -0
- package/dist/services/wp-client.js +102 -0
- package/dist/services/wp-client.js.map +1 -0
- package/dist/tools/content.d.ts +4 -0
- package/dist/tools/content.d.ts.map +1 -0
- package/dist/tools/content.js +196 -0
- package/dist/tools/content.js.map +1 -0
- package/dist/tools/posts.d.ts +4 -0
- package/dist/tools/posts.d.ts.map +1 -0
- package/dist/tools/posts.js +179 -0
- package/dist/tools/posts.js.map +1 -0
- package/dist/tools/seo.d.ts +4 -0
- package/dist/tools/seo.d.ts.map +1 -0
- package/dist/tools/seo.js +241 -0
- package/dist/tools/seo.js.map +1 -0
- package/dist/tools/taxonomy.d.ts +4 -0
- package/dist/tools/taxonomy.d.ts.map +1 -0
- package/dist/tools/taxonomy.js +82 -0
- package/dist/tools/taxonomy.js.map +1 -0
- package/dist/types.d.ts +160 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AdSim SRL - Georges Cordewiener
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# WordPress MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@adsim/wordpress-mcp-server)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A comprehensive **MCP (Model Context Protocol)** server for the **WordPress REST API**. Manage posts, pages, categories, tags, media, users, comments, and SEO metadata directly from Claude Desktop or any MCP-compatible client.
|
|
7
|
+
|
|
8
|
+
Built with TypeScript, Zod validation, and full support for **RankMath** and **Yoast SEO** metadata.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
| Category | Tools | Description |
|
|
15
|
+
|----------|-------|-------------|
|
|
16
|
+
| **Posts** | `wp_list_posts`, `wp_get_post`, `wp_create_post`, `wp_update_post`, `wp_delete_post` | Full CRUD for posts with filtering, pagination, search |
|
|
17
|
+
| **Pages** | `wp_list_pages` | List and filter pages |
|
|
18
|
+
| **Taxonomy** | `wp_list_categories`, `wp_list_tags` | Browse categories and tags |
|
|
19
|
+
| **SEO** | `wp_get_seo_meta`, `wp_update_seo_meta`, `wp_audit_seo` | RankMath & Yoast support, SEO auditing with scoring |
|
|
20
|
+
| **Media** | `wp_list_media` | Browse media library by type |
|
|
21
|
+
| **Search** | `wp_search` | Cross-content search |
|
|
22
|
+
| **Users** | `wp_list_users` | List users by role |
|
|
23
|
+
| **Comments** | `wp_list_comments` | List and filter comments |
|
|
24
|
+
| **Site** | `wp_site_info` | Get site name, URL, timezone |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### 1. Prerequisites
|
|
31
|
+
|
|
32
|
+
- **Node.js 18+**
|
|
33
|
+
- **WordPress site** with REST API enabled (enabled by default)
|
|
34
|
+
- **Application Password** (WordPress → Users → Your Profile → Application Passwords)
|
|
35
|
+
|
|
36
|
+
### 2. Install & Configure
|
|
37
|
+
|
|
38
|
+
Add to your Claude Desktop config file:
|
|
39
|
+
|
|
40
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
41
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"wordpress": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["-y", "@adsim/wordpress-mcp-server"],
|
|
49
|
+
"env": {
|
|
50
|
+
"WP_API_URL": "https://your-site.com",
|
|
51
|
+
"WP_API_USERNAME": "your-username",
|
|
52
|
+
"WP_API_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Restart Claude Desktop
|
|
60
|
+
|
|
61
|
+
That's it! Ask Claude: *"List my 10 latest WordPress posts"*
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Environment Variables
|
|
66
|
+
|
|
67
|
+
| Variable | Required | Description |
|
|
68
|
+
|----------|----------|-------------|
|
|
69
|
+
| `WP_API_URL` | ✅ | Your WordPress site URL (e.g., `https://example.com`) |
|
|
70
|
+
| `WP_API_USERNAME` | ✅ | WordPress username |
|
|
71
|
+
| `WP_API_PASSWORD` | ✅ | Application Password (Users → Profile → Application Passwords) |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## SEO Support
|
|
76
|
+
|
|
77
|
+
### Supported Plugins
|
|
78
|
+
|
|
79
|
+
- **RankMath** — Full support: read/write SEO title, description, focus keyword
|
|
80
|
+
- **Yoast SEO** — Read support: title, description via `yoast_head_json`
|
|
81
|
+
|
|
82
|
+
### Exposing SEO Meta Fields
|
|
83
|
+
|
|
84
|
+
For the SEO tools to work, you need to expose your SEO plugin's meta fields via the REST API. Add this code to your theme's `functions.php` or a custom plugin:
|
|
85
|
+
|
|
86
|
+
#### RankMath
|
|
87
|
+
|
|
88
|
+
```php
|
|
89
|
+
<?php
|
|
90
|
+
// Expose RankMath SEO fields via REST API
|
|
91
|
+
add_action('init', function() {
|
|
92
|
+
$fields = [
|
|
93
|
+
'rank_math_title',
|
|
94
|
+
'rank_math_description',
|
|
95
|
+
'rank_math_focus_keyword',
|
|
96
|
+
'rank_math_robots',
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
foreach (['post', 'page'] as $post_type) {
|
|
100
|
+
foreach ($fields as $field) {
|
|
101
|
+
register_post_meta($post_type, $field, [
|
|
102
|
+
'show_in_rest' => true,
|
|
103
|
+
'single' => true,
|
|
104
|
+
'type' => 'string',
|
|
105
|
+
'auth_callback' => function() {
|
|
106
|
+
return current_user_can('edit_posts');
|
|
107
|
+
},
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Yoast SEO
|
|
115
|
+
|
|
116
|
+
Yoast automatically exposes `yoast_head_json` in REST API responses — no extra configuration needed.
|
|
117
|
+
|
|
118
|
+
#### MCP SEO Bridge Plugin (Auto-Detection)
|
|
119
|
+
|
|
120
|
+
For a more robust solution that survives theme updates and auto-detects your SEO plugin:
|
|
121
|
+
|
|
122
|
+
```php
|
|
123
|
+
<?php
|
|
124
|
+
/**
|
|
125
|
+
* Plugin Name: MCP SEO Bridge
|
|
126
|
+
* Description: Exposes SEO meta fields for MCP WordPress Server
|
|
127
|
+
* Version: 1.0.0
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
add_action('init', function() {
|
|
131
|
+
// RankMath
|
|
132
|
+
if (class_exists('RankMath')) {
|
|
133
|
+
$fields = ['rank_math_title', 'rank_math_description', 'rank_math_focus_keyword', 'rank_math_robots'];
|
|
134
|
+
foreach (['post', 'page'] as $type) {
|
|
135
|
+
foreach ($fields as $field) {
|
|
136
|
+
register_post_meta($type, $field, ['show_in_rest' => true, 'single' => true, 'type' => 'string', 'auth_callback' => fn() => current_user_can('edit_posts')]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// SEOPress
|
|
142
|
+
if (function_exists('seopress_init')) {
|
|
143
|
+
$fields = ['_seopress_titles_title', '_seopress_titles_desc'];
|
|
144
|
+
foreach (['post', 'page'] as $type) {
|
|
145
|
+
foreach ($fields as $field) {
|
|
146
|
+
register_post_meta($type, $field, ['show_in_rest' => true, 'single' => true, 'type' => 'string', 'auth_callback' => fn() => current_user_can('edit_posts')]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
> **⚠️ Important**: A stray character before `<?php` in functions.php will break the REST API with "Unexpected token '<'" errors. Always verify the file starts exactly with `<?php`.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Usage Examples
|
|
158
|
+
|
|
159
|
+
Once configured, ask Claude naturally:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
"List my 10 latest posts"
|
|
163
|
+
"Show me the SEO audit for all published posts"
|
|
164
|
+
"Create a draft post about AI trends in 2025"
|
|
165
|
+
"Update the meta description of post #42"
|
|
166
|
+
"Search my WordPress content for 'analytics'"
|
|
167
|
+
"Show me all categories with their post counts"
|
|
168
|
+
"List media files uploaded this month"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Tools Reference
|
|
174
|
+
|
|
175
|
+
### Posts
|
|
176
|
+
|
|
177
|
+
#### `wp_list_posts`
|
|
178
|
+
List posts with advanced filtering.
|
|
179
|
+
|
|
180
|
+
| Param | Type | Default | Description |
|
|
181
|
+
|-------|------|---------|-------------|
|
|
182
|
+
| `per_page` | number | 10 | Items per page (1-100) |
|
|
183
|
+
| `page` | number | 1 | Page number |
|
|
184
|
+
| `status` | string | publish | publish/draft/pending/private/future/trash |
|
|
185
|
+
| `orderby` | string | date | date/id/title/slug/modified/author/relevance |
|
|
186
|
+
| `order` | string | desc | asc/desc |
|
|
187
|
+
| `categories` | string | — | Comma-separated category IDs |
|
|
188
|
+
| `tags` | string | — | Comma-separated tag IDs |
|
|
189
|
+
| `search` | string | — | Search keyword |
|
|
190
|
+
|
|
191
|
+
#### `wp_get_post`
|
|
192
|
+
Get full post data including SEO metadata.
|
|
193
|
+
|
|
194
|
+
#### `wp_create_post`
|
|
195
|
+
Create a new post (defaults to draft for safety).
|
|
196
|
+
|
|
197
|
+
#### `wp_update_post`
|
|
198
|
+
Update any post field including SEO meta via the `meta` parameter.
|
|
199
|
+
|
|
200
|
+
#### `wp_delete_post`
|
|
201
|
+
Delete or trash a post.
|
|
202
|
+
|
|
203
|
+
### SEO
|
|
204
|
+
|
|
205
|
+
#### `wp_get_seo_meta`
|
|
206
|
+
Read SEO metadata (RankMath/Yoast).
|
|
207
|
+
|
|
208
|
+
#### `wp_update_seo_meta`
|
|
209
|
+
Update RankMath SEO fields (title, description, focus keyword).
|
|
210
|
+
|
|
211
|
+
#### `wp_audit_seo`
|
|
212
|
+
Audit SEO for multiple posts/pages with scoring (0-100), issues, and recommendations.
|
|
213
|
+
|
|
214
|
+
### Content
|
|
215
|
+
|
|
216
|
+
#### `wp_list_pages`, `wp_list_media`, `wp_search`, `wp_list_comments`, `wp_list_users`, `wp_site_info`
|
|
217
|
+
|
|
218
|
+
See tool descriptions in Claude for full parameter details.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Development
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Clone the repository
|
|
226
|
+
git clone https://github.com/GeorgesAdSim/wordpress-mcp-server.git
|
|
227
|
+
cd wordpress-mcp-server
|
|
228
|
+
|
|
229
|
+
# Install dependencies
|
|
230
|
+
npm install
|
|
231
|
+
|
|
232
|
+
# Build
|
|
233
|
+
npm run build
|
|
234
|
+
|
|
235
|
+
# Run locally
|
|
236
|
+
WP_API_URL="https://your-site.com" \
|
|
237
|
+
WP_API_USERNAME="user" \
|
|
238
|
+
WP_API_PASSWORD="xxxx xxxx xxxx xxxx" \
|
|
239
|
+
node dist/index.js
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Testing with MCP Inspector
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npx @modelcontextprotocol/inspector node dist/index.js
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Troubleshooting
|
|
251
|
+
|
|
252
|
+
| Issue | Solution |
|
|
253
|
+
|-------|----------|
|
|
254
|
+
| "Unexpected token '<'" errors | Check `functions.php` — ensure no characters before `<?php` |
|
|
255
|
+
| SEO fields return empty | Add the `register_post_meta()` code from the SEO section above |
|
|
256
|
+
| 401 Unauthorized | Verify Application Password (not your login password) |
|
|
257
|
+
| 403 Forbidden | Check user has `edit_posts` capability |
|
|
258
|
+
| Connection timeout | Verify `WP_API_URL` is correct and accessible |
|
|
259
|
+
| Server not starting | Check Node.js 18+ is installed: `node --version` |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Author
|
|
264
|
+
|
|
265
|
+
**Georges Cordewiener** — [AdSim SRL](https://adsim.be)
|
|
266
|
+
CTO & Co-founder, digital marketing agency specializing in SEO/SEA for the financial sector.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
MIT © 2025 AdSim SRL
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SERVER_NAME = "wordpress-mcp-server";
|
|
2
|
+
export declare const SERVER_VERSION = "1.0.0";
|
|
3
|
+
export declare const CHARACTER_LIMIT = 50000;
|
|
4
|
+
export declare const WP_REST_BASE = "/wp-json/wp/v2";
|
|
5
|
+
export declare const DEFAULT_PER_PAGE = 10;
|
|
6
|
+
export declare const MAX_PER_PAGE = 100;
|
|
7
|
+
export declare const POST_STATUSES: readonly ["publish", "draft", "pending", "private", "future", "trash"];
|
|
8
|
+
export type PostStatus = (typeof POST_STATUSES)[number];
|
|
9
|
+
export declare const POST_ORDERBYS: readonly ["date", "id", "title", "slug", "modified", "author", "relevance"];
|
|
10
|
+
export type PostOrderBy = (typeof POST_ORDERBYS)[number];
|
|
11
|
+
export declare const ORDER_DIRECTIONS: readonly ["asc", "desc"];
|
|
12
|
+
export type OrderDirection = (typeof ORDER_DIRECTIONS)[number];
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAClD,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,eAAO,MAAM,aAAa,wEAAyE,CAAC;AACpG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,aAAa,6EAA8E,CAAC;AACzG,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,gBAAgB,0BAA2B,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const SERVER_NAME = "wordpress-mcp-server";
|
|
2
|
+
export const SERVER_VERSION = "1.0.0";
|
|
3
|
+
export const CHARACTER_LIMIT = 50000;
|
|
4
|
+
export const WP_REST_BASE = "/wp-json/wp/v2";
|
|
5
|
+
export const DEFAULT_PER_PAGE = 10;
|
|
6
|
+
export const MAX_PER_PAGE = 100;
|
|
7
|
+
export const POST_STATUSES = ["publish", "draft", "pending", "private", "future", "trash"];
|
|
8
|
+
export const POST_ORDERBYS = ["date", "id", "title", "slug", "modified", "author", "relevance"];
|
|
9
|
+
export const ORDER_DIRECTIONS = ["asc", "desc"];
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAGpG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAGzG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { createClientFromEnv } from "./services/wp-client.js";
|
|
5
|
+
import { registerPostsTools } from "./tools/posts.js";
|
|
6
|
+
import { registerTaxonomyTools } from "./tools/taxonomy.js";
|
|
7
|
+
import { registerSEOTools } from "./tools/seo.js";
|
|
8
|
+
import { registerContentTools } from "./tools/content.js";
|
|
9
|
+
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
10
|
+
async function main() {
|
|
11
|
+
// Create WordPress API client from environment variables
|
|
12
|
+
const client = createClientFromEnv();
|
|
13
|
+
// Create MCP server
|
|
14
|
+
const server = new McpServer({
|
|
15
|
+
name: SERVER_NAME,
|
|
16
|
+
version: SERVER_VERSION,
|
|
17
|
+
});
|
|
18
|
+
// Register all tools
|
|
19
|
+
registerPostsTools(server, client);
|
|
20
|
+
registerTaxonomyTools(server, client);
|
|
21
|
+
registerSEOTools(server, client);
|
|
22
|
+
registerContentTools(server, client);
|
|
23
|
+
// Start server with stdio transport
|
|
24
|
+
const transport = new StdioServerTransport();
|
|
25
|
+
await server.connect(transport);
|
|
26
|
+
console.error(`${SERVER_NAME} v${SERVER_VERSION} started successfully`);
|
|
27
|
+
console.error(`Connected to: ${process.env.WP_API_URL}`);
|
|
28
|
+
}
|
|
29
|
+
main().catch((error) => {
|
|
30
|
+
console.error(`Fatal error starting ${SERVER_NAME}:`, error.message);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE7D,KAAK,UAAU,IAAI;IACjB,yDAAyD;IACzD,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;IAErC,oBAAoB;IACpB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,qBAAqB;IACrB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,oCAAoC;IACpC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,uBAAuB,CAAC,CAAC;IACxE,OAAO,CAAC,KAAK,CAAC,iBAAiB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,wBAAwB,WAAW,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PaginationSchema: z.ZodObject<{
|
|
3
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
per_page: number;
|
|
7
|
+
page: number;
|
|
8
|
+
}, {
|
|
9
|
+
per_page?: number | undefined;
|
|
10
|
+
page?: number | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const PostStatusSchema: z.ZodDefault<z.ZodEnum<["publish", "draft", "pending", "private", "future", "trash"]>>;
|
|
13
|
+
export declare const OrderBySchema: z.ZodDefault<z.ZodEnum<["date", "id", "title", "slug", "modified", "author", "relevance"]>>;
|
|
14
|
+
export declare const OrderSchema: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
15
|
+
export declare const ListPostsSchema: z.ZodObject<{
|
|
16
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
} & {
|
|
19
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["publish", "draft", "pending", "private", "future", "trash"]>>>;
|
|
20
|
+
orderby: z.ZodOptional<z.ZodDefault<z.ZodEnum<["date", "id", "title", "slug", "modified", "author", "relevance"]>>>;
|
|
21
|
+
order: z.ZodOptional<z.ZodDefault<z.ZodEnum<["asc", "desc"]>>>;
|
|
22
|
+
categories: z.ZodOptional<z.ZodString>;
|
|
23
|
+
tags: z.ZodOptional<z.ZodString>;
|
|
24
|
+
search: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
per_page: number;
|
|
27
|
+
page: number;
|
|
28
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
29
|
+
orderby?: "date" | "id" | "title" | "slug" | "modified" | "author" | "relevance" | undefined;
|
|
30
|
+
order?: "asc" | "desc" | undefined;
|
|
31
|
+
categories?: string | undefined;
|
|
32
|
+
tags?: string | undefined;
|
|
33
|
+
search?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
per_page?: number | undefined;
|
|
36
|
+
page?: number | undefined;
|
|
37
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
38
|
+
orderby?: "date" | "id" | "title" | "slug" | "modified" | "author" | "relevance" | undefined;
|
|
39
|
+
order?: "asc" | "desc" | undefined;
|
|
40
|
+
categories?: string | undefined;
|
|
41
|
+
tags?: string | undefined;
|
|
42
|
+
search?: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const GetPostSchema: z.ZodObject<{
|
|
45
|
+
id: z.ZodNumber;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
id: number;
|
|
48
|
+
}, {
|
|
49
|
+
id: number;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const CreatePostSchema: z.ZodObject<{
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
content: z.ZodString;
|
|
54
|
+
status: z.ZodDefault<z.ZodEnum<["publish", "draft", "pending", "private", "future"]>>;
|
|
55
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
56
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
57
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
58
|
+
featured_media: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
title: string;
|
|
62
|
+
status: "publish" | "draft" | "pending" | "private" | "future";
|
|
63
|
+
content: string;
|
|
64
|
+
slug?: string | undefined;
|
|
65
|
+
categories?: number[] | undefined;
|
|
66
|
+
tags?: number[] | undefined;
|
|
67
|
+
excerpt?: string | undefined;
|
|
68
|
+
featured_media?: number | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
title: string;
|
|
71
|
+
content: string;
|
|
72
|
+
slug?: string | undefined;
|
|
73
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | undefined;
|
|
74
|
+
categories?: number[] | undefined;
|
|
75
|
+
tags?: number[] | undefined;
|
|
76
|
+
excerpt?: string | undefined;
|
|
77
|
+
featured_media?: number | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export declare const UpdatePostSchema: z.ZodObject<{
|
|
80
|
+
id: z.ZodNumber;
|
|
81
|
+
title: z.ZodOptional<z.ZodString>;
|
|
82
|
+
content: z.ZodOptional<z.ZodString>;
|
|
83
|
+
status: z.ZodOptional<z.ZodEnum<["publish", "draft", "pending", "private", "future", "trash"]>>;
|
|
84
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
85
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
86
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
87
|
+
featured_media: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
89
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
id: number;
|
|
92
|
+
title?: string | undefined;
|
|
93
|
+
slug?: string | undefined;
|
|
94
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
95
|
+
categories?: number[] | undefined;
|
|
96
|
+
tags?: number[] | undefined;
|
|
97
|
+
content?: string | undefined;
|
|
98
|
+
excerpt?: string | undefined;
|
|
99
|
+
featured_media?: number | undefined;
|
|
100
|
+
meta?: Record<string, unknown> | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
id: number;
|
|
103
|
+
title?: string | undefined;
|
|
104
|
+
slug?: string | undefined;
|
|
105
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
106
|
+
categories?: number[] | undefined;
|
|
107
|
+
tags?: number[] | undefined;
|
|
108
|
+
content?: string | undefined;
|
|
109
|
+
excerpt?: string | undefined;
|
|
110
|
+
featured_media?: number | undefined;
|
|
111
|
+
meta?: Record<string, unknown> | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const DeletePostSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodNumber;
|
|
115
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
id: number;
|
|
118
|
+
force: boolean;
|
|
119
|
+
}, {
|
|
120
|
+
id: number;
|
|
121
|
+
force?: boolean | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
export declare const ListPagesSchema: z.ZodObject<{
|
|
124
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
125
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
126
|
+
} & {
|
|
127
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["publish", "draft", "pending", "private", "future", "trash"]>>>;
|
|
128
|
+
parent: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
orderby: z.ZodOptional<z.ZodDefault<z.ZodEnum<["date", "id", "title", "slug", "modified", "author", "relevance"]>>>;
|
|
130
|
+
order: z.ZodOptional<z.ZodDefault<z.ZodEnum<["asc", "desc"]>>>;
|
|
131
|
+
search: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
per_page: number;
|
|
134
|
+
page: number;
|
|
135
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
136
|
+
orderby?: "date" | "id" | "title" | "slug" | "modified" | "author" | "relevance" | undefined;
|
|
137
|
+
order?: "asc" | "desc" | undefined;
|
|
138
|
+
search?: string | undefined;
|
|
139
|
+
parent?: number | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
per_page?: number | undefined;
|
|
142
|
+
page?: number | undefined;
|
|
143
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
144
|
+
orderby?: "date" | "id" | "title" | "slug" | "modified" | "author" | "relevance" | undefined;
|
|
145
|
+
order?: "asc" | "desc" | undefined;
|
|
146
|
+
search?: string | undefined;
|
|
147
|
+
parent?: number | undefined;
|
|
148
|
+
}>;
|
|
149
|
+
export declare const ListCategoriesSchema: z.ZodObject<{
|
|
150
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
151
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
152
|
+
} & {
|
|
153
|
+
search: z.ZodOptional<z.ZodString>;
|
|
154
|
+
parent: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
orderby: z.ZodDefault<z.ZodEnum<["id", "name", "slug", "count"]>>;
|
|
156
|
+
order: z.ZodOptional<z.ZodDefault<z.ZodEnum<["asc", "desc"]>>>;
|
|
157
|
+
hide_empty: z.ZodDefault<z.ZodBoolean>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
per_page: number;
|
|
160
|
+
page: number;
|
|
161
|
+
orderby: "id" | "slug" | "name" | "count";
|
|
162
|
+
hide_empty: boolean;
|
|
163
|
+
order?: "asc" | "desc" | undefined;
|
|
164
|
+
search?: string | undefined;
|
|
165
|
+
parent?: number | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
per_page?: number | undefined;
|
|
168
|
+
page?: number | undefined;
|
|
169
|
+
orderby?: "id" | "slug" | "name" | "count" | undefined;
|
|
170
|
+
order?: "asc" | "desc" | undefined;
|
|
171
|
+
search?: string | undefined;
|
|
172
|
+
parent?: number | undefined;
|
|
173
|
+
hide_empty?: boolean | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
export declare const ListTagsSchema: z.ZodObject<{
|
|
176
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
177
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
178
|
+
} & {
|
|
179
|
+
search: z.ZodOptional<z.ZodString>;
|
|
180
|
+
orderby: z.ZodDefault<z.ZodEnum<["id", "name", "slug", "count"]>>;
|
|
181
|
+
order: z.ZodOptional<z.ZodDefault<z.ZodEnum<["asc", "desc"]>>>;
|
|
182
|
+
hide_empty: z.ZodDefault<z.ZodBoolean>;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
per_page: number;
|
|
185
|
+
page: number;
|
|
186
|
+
orderby: "id" | "slug" | "name" | "count";
|
|
187
|
+
hide_empty: boolean;
|
|
188
|
+
order?: "asc" | "desc" | undefined;
|
|
189
|
+
search?: string | undefined;
|
|
190
|
+
}, {
|
|
191
|
+
per_page?: number | undefined;
|
|
192
|
+
page?: number | undefined;
|
|
193
|
+
orderby?: "id" | "slug" | "name" | "count" | undefined;
|
|
194
|
+
order?: "asc" | "desc" | undefined;
|
|
195
|
+
search?: string | undefined;
|
|
196
|
+
hide_empty?: boolean | undefined;
|
|
197
|
+
}>;
|
|
198
|
+
export declare const SearchSchema: z.ZodObject<{
|
|
199
|
+
search: z.ZodString;
|
|
200
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
201
|
+
type: z.ZodOptional<z.ZodEnum<["post", "page", "category", "tag"]>>;
|
|
202
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
per_page: number;
|
|
205
|
+
search: string;
|
|
206
|
+
type?: "page" | "post" | "category" | "tag" | undefined;
|
|
207
|
+
subtype?: string | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
search: string;
|
|
210
|
+
per_page?: number | undefined;
|
|
211
|
+
type?: "page" | "post" | "category" | "tag" | undefined;
|
|
212
|
+
subtype?: string | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
export declare const GetSEOMetaSchema: z.ZodObject<{
|
|
215
|
+
id: z.ZodNumber;
|
|
216
|
+
post_type: z.ZodDefault<z.ZodEnum<["post", "page"]>>;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
id: number;
|
|
219
|
+
post_type: "page" | "post";
|
|
220
|
+
}, {
|
|
221
|
+
id: number;
|
|
222
|
+
post_type?: "page" | "post" | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
export declare const UpdateSEOMetaSchema: z.ZodObject<{
|
|
225
|
+
id: z.ZodNumber;
|
|
226
|
+
post_type: z.ZodDefault<z.ZodEnum<["post", "page"]>>;
|
|
227
|
+
rank_math_title: z.ZodOptional<z.ZodString>;
|
|
228
|
+
rank_math_description: z.ZodOptional<z.ZodString>;
|
|
229
|
+
rank_math_focus_keyword: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
id: number;
|
|
232
|
+
post_type: "page" | "post";
|
|
233
|
+
rank_math_title?: string | undefined;
|
|
234
|
+
rank_math_description?: string | undefined;
|
|
235
|
+
rank_math_focus_keyword?: string | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
id: number;
|
|
238
|
+
post_type?: "page" | "post" | undefined;
|
|
239
|
+
rank_math_title?: string | undefined;
|
|
240
|
+
rank_math_description?: string | undefined;
|
|
241
|
+
rank_math_focus_keyword?: string | undefined;
|
|
242
|
+
}>;
|
|
243
|
+
export declare const AuditSEOSchema: z.ZodObject<{
|
|
244
|
+
post_type: z.ZodDefault<z.ZodEnum<["post", "page"]>>;
|
|
245
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
246
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["publish", "draft", "pending", "private", "future", "trash"]>>>;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
per_page: number;
|
|
249
|
+
post_type: "page" | "post";
|
|
250
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
per_page?: number | undefined;
|
|
253
|
+
status?: "publish" | "draft" | "pending" | "private" | "future" | "trash" | undefined;
|
|
254
|
+
post_type?: "page" | "post" | undefined;
|
|
255
|
+
}>;
|
|
256
|
+
export declare const SiteInfoSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
257
|
+
export declare const ListMediaSchema: z.ZodObject<{
|
|
258
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
259
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
260
|
+
} & {
|
|
261
|
+
media_type: z.ZodOptional<z.ZodEnum<["image", "video", "audio", "application"]>>;
|
|
262
|
+
search: z.ZodOptional<z.ZodString>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
per_page: number;
|
|
265
|
+
page: number;
|
|
266
|
+
search?: string | undefined;
|
|
267
|
+
media_type?: "image" | "video" | "audio" | "application" | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
per_page?: number | undefined;
|
|
270
|
+
page?: number | undefined;
|
|
271
|
+
search?: string | undefined;
|
|
272
|
+
media_type?: "image" | "video" | "audio" | "application" | undefined;
|
|
273
|
+
}>;
|
|
274
|
+
export declare const ListCommentsSchema: z.ZodObject<{
|
|
275
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
276
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
277
|
+
} & {
|
|
278
|
+
post: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
status: z.ZodOptional<z.ZodEnum<["approve", "hold", "spam", "trash"]>>;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
per_page: number;
|
|
282
|
+
page: number;
|
|
283
|
+
status?: "trash" | "approve" | "hold" | "spam" | undefined;
|
|
284
|
+
post?: number | undefined;
|
|
285
|
+
}, {
|
|
286
|
+
per_page?: number | undefined;
|
|
287
|
+
page?: number | undefined;
|
|
288
|
+
status?: "trash" | "approve" | "hold" | "spam" | undefined;
|
|
289
|
+
post?: number | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
export declare const ListUsersSchema: z.ZodObject<{
|
|
292
|
+
per_page: z.ZodDefault<z.ZodNumber>;
|
|
293
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
294
|
+
} & {
|
|
295
|
+
roles: z.ZodOptional<z.ZodString>;
|
|
296
|
+
search: z.ZodOptional<z.ZodString>;
|
|
297
|
+
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
per_page: number;
|
|
299
|
+
page: number;
|
|
300
|
+
search?: string | undefined;
|
|
301
|
+
roles?: string | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
per_page?: number | undefined;
|
|
304
|
+
page?: number | undefined;
|
|
305
|
+
search?: string | undefined;
|
|
306
|
+
roles?: string | undefined;
|
|
307
|
+
}>;
|
|
308
|
+
//# sourceMappingURL=index.d.ts.map
|