@node2flow/wordpress-mcp 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 +179 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +126 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +109 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +10 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +229 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/worker.d.ts +11 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +77 -0
- package/dist/worker.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Node2Flow
|
|
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,179 @@
|
|
|
1
|
+
# WordPress MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@node2flow/wordpress-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
MCP (Model Context Protocol) server for WordPress REST API. Manage posts, pages, media, comments, categories, tags, and users through 20 tools.
|
|
7
|
+
|
|
8
|
+
Works with Claude Desktop, Cursor, VS Code, and any MCP client.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
### Claude Desktop
|
|
15
|
+
|
|
16
|
+
Add to `claude_desktop_config.json`:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"wordpress": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "@node2flow/wordpress-mcp"],
|
|
24
|
+
"env": {
|
|
25
|
+
"WORDPRESS_URL": "https://your-site.com",
|
|
26
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
27
|
+
"WORDPRESS_APP_PASSWORD": "your-application-password"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Cursor / VS Code
|
|
35
|
+
|
|
36
|
+
Add to MCP settings:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"wordpress": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["-y", "@node2flow/wordpress-mcp"],
|
|
44
|
+
"env": {
|
|
45
|
+
"WORDPRESS_URL": "https://your-site.com",
|
|
46
|
+
"WORDPRESS_USERNAME": "your-username",
|
|
47
|
+
"WORDPRESS_APP_PASSWORD": "your-application-password"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### HTTP Mode (Streamable HTTP)
|
|
55
|
+
|
|
56
|
+
For remote deployment or shared access:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npx @node2flow/wordpress-mcp --http
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Server starts on port 3000 (configurable via `PORT` env var). MCP endpoint: `http://localhost:3000/mcp`
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
| Environment Variable | Required | Description |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `WORDPRESS_URL` | Yes | WordPress site URL (e.g. `https://your-site.com`) |
|
|
71
|
+
| `WORDPRESS_USERNAME` | Yes | WordPress username |
|
|
72
|
+
| `WORDPRESS_APP_PASSWORD` | Yes | Application Password (see below) |
|
|
73
|
+
| `PORT` | No | Port for HTTP server (default: `3000`, only used with `--http`) |
|
|
74
|
+
|
|
75
|
+
### How to Create an Application Password
|
|
76
|
+
|
|
77
|
+
1. Go to your WordPress Admin → **Users** → **Profile**
|
|
78
|
+
2. Scroll down to **Application Passwords**
|
|
79
|
+
3. Enter a name (e.g. "MCP Server") and click **Add New Application Password**
|
|
80
|
+
4. Copy the generated password
|
|
81
|
+
|
|
82
|
+
> **Important**: WordPress displays the password with spaces for readability (e.g. `cUAn CKZ1 u5DN`). The server automatically removes spaces — you can paste it as-is.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## All Tools (20 tools)
|
|
87
|
+
|
|
88
|
+
### Posts (5 tools)
|
|
89
|
+
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `wp_list_posts` | List posts with filters (status, search, per_page) |
|
|
93
|
+
| `wp_get_post` | Get single post with full content |
|
|
94
|
+
| `wp_create_post` | Create post (title, content, status, categories, tags) |
|
|
95
|
+
| `wp_update_post` | Update post fields |
|
|
96
|
+
| `wp_delete_post` | Delete post (moves to trash) |
|
|
97
|
+
|
|
98
|
+
### Pages (5 tools)
|
|
99
|
+
|
|
100
|
+
| Tool | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `wp_list_pages` | List pages with status filter |
|
|
103
|
+
| `wp_get_page` | Get single page with full content |
|
|
104
|
+
| `wp_create_page` | Create page (title, content, status, parent) |
|
|
105
|
+
| `wp_update_page` | Update page fields |
|
|
106
|
+
| `wp_delete_page` | Delete page |
|
|
107
|
+
|
|
108
|
+
### Media (2 tools)
|
|
109
|
+
|
|
110
|
+
| Tool | Description |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `wp_list_media` | List media files with type filter |
|
|
113
|
+
| `wp_delete_media` | Permanently delete media file |
|
|
114
|
+
|
|
115
|
+
### Comments (4 tools)
|
|
116
|
+
|
|
117
|
+
| Tool | Description |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `wp_list_comments` | List comments, filter by post |
|
|
120
|
+
| `wp_create_comment` | Create comment on post |
|
|
121
|
+
| `wp_update_comment` | Moderate comment (approve/hold/spam/trash) |
|
|
122
|
+
| `wp_delete_comment` | Permanently delete comment |
|
|
123
|
+
|
|
124
|
+
### Taxonomy (2 tools)
|
|
125
|
+
|
|
126
|
+
| Tool | Description |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `wp_list_categories` | List all categories with post counts |
|
|
129
|
+
| `wp_list_tags` | List all tags with post counts |
|
|
130
|
+
|
|
131
|
+
### Users & Site (2 tools)
|
|
132
|
+
|
|
133
|
+
| Tool | Description |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `wp_list_users` | List users with roles |
|
|
136
|
+
| `wp_get_site_info` | Get site name, description, URL, timezone |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Requirements
|
|
141
|
+
|
|
142
|
+
- **Node.js** 18+
|
|
143
|
+
- **WordPress** with REST API enabled (enabled by default)
|
|
144
|
+
- **Application Password** (WordPress 5.6+)
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## For Developers
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
git clone https://github.com/node2flow-th/wordpress-mcp-community.git
|
|
152
|
+
cd wordpress-mcp-community
|
|
153
|
+
npm install
|
|
154
|
+
npm run build
|
|
155
|
+
|
|
156
|
+
# Run in stdio mode
|
|
157
|
+
WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npm start
|
|
158
|
+
|
|
159
|
+
# Run in dev mode (hot reload)
|
|
160
|
+
WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npm run dev
|
|
161
|
+
|
|
162
|
+
# Run in HTTP mode
|
|
163
|
+
WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npm start -- --http
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT License - see [LICENSE](LICENSE)
|
|
171
|
+
|
|
172
|
+
Copyright (c) 2026 [Node2Flow](https://node2flow.net)
|
|
173
|
+
|
|
174
|
+
## Links
|
|
175
|
+
|
|
176
|
+
- [npm Package](https://www.npmjs.com/package/@node2flow/wordpress-mcp)
|
|
177
|
+
- [WordPress REST API Handbook](https://developer.wordpress.org/rest-api/)
|
|
178
|
+
- [MCP Protocol](https://modelcontextprotocol.io/)
|
|
179
|
+
- [Node2Flow](https://node2flow.net)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress REST API Client
|
|
3
|
+
* Uses Application Password authentication (HTTP Basic Auth)
|
|
4
|
+
*/
|
|
5
|
+
import type { WordPressConfig } from './types.js';
|
|
6
|
+
export declare class WordPressClient {
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: WordPressConfig);
|
|
9
|
+
private request;
|
|
10
|
+
listPosts(params?: {
|
|
11
|
+
per_page?: number;
|
|
12
|
+
status?: string;
|
|
13
|
+
search?: string;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
getPost(id: number): Promise<unknown>;
|
|
16
|
+
createPost(data: {
|
|
17
|
+
title: string;
|
|
18
|
+
content: string;
|
|
19
|
+
status?: string;
|
|
20
|
+
categories?: number[];
|
|
21
|
+
tags?: number[];
|
|
22
|
+
}): Promise<unknown>;
|
|
23
|
+
updatePost(id: number, data: {
|
|
24
|
+
title?: string;
|
|
25
|
+
content?: string;
|
|
26
|
+
status?: string;
|
|
27
|
+
categories?: number[];
|
|
28
|
+
tags?: number[];
|
|
29
|
+
}): Promise<unknown>;
|
|
30
|
+
deletePost(id: number): Promise<unknown>;
|
|
31
|
+
listPages(params?: {
|
|
32
|
+
per_page?: number;
|
|
33
|
+
status?: string;
|
|
34
|
+
}): Promise<unknown>;
|
|
35
|
+
getPage(id: number): Promise<unknown>;
|
|
36
|
+
createPage(data: {
|
|
37
|
+
title: string;
|
|
38
|
+
content: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
parent?: number;
|
|
41
|
+
}): Promise<unknown>;
|
|
42
|
+
updatePage(id: number, data: {
|
|
43
|
+
title?: string;
|
|
44
|
+
content?: string;
|
|
45
|
+
status?: string;
|
|
46
|
+
}): Promise<unknown>;
|
|
47
|
+
deletePage(id: number): Promise<unknown>;
|
|
48
|
+
listMedia(params?: {
|
|
49
|
+
per_page?: number;
|
|
50
|
+
media_type?: string;
|
|
51
|
+
}): Promise<unknown>;
|
|
52
|
+
deleteMedia(id: number): Promise<unknown>;
|
|
53
|
+
listComments(params?: {
|
|
54
|
+
post?: number;
|
|
55
|
+
per_page?: number;
|
|
56
|
+
}): Promise<unknown>;
|
|
57
|
+
createComment(data: {
|
|
58
|
+
post: number;
|
|
59
|
+
content: string;
|
|
60
|
+
author_name?: string;
|
|
61
|
+
author_email?: string;
|
|
62
|
+
}): Promise<unknown>;
|
|
63
|
+
updateComment(id: number, data: {
|
|
64
|
+
content?: string;
|
|
65
|
+
status?: string;
|
|
66
|
+
}): Promise<unknown>;
|
|
67
|
+
deleteComment(id: number): Promise<unknown>;
|
|
68
|
+
listCategories(): Promise<unknown>;
|
|
69
|
+
listTags(): Promise<unknown>;
|
|
70
|
+
listUsers(): Promise<unknown>;
|
|
71
|
+
getSiteInfo(): Promise<unknown>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;YAQrB,OAAO;IAsBf,SAAS,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAS1E,OAAO,CAAC,EAAE,EAAE,MAAM;IAIlB,UAAU,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAA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AAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;IAIlG,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAIrE,aAAa,CAAC,EAAE,EAAE,MAAM;IAKxB,cAAc;IAKd,QAAQ;IAKR,SAAS;IAKT,WAAW;CAGlB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress REST API Client
|
|
3
|
+
* Uses Application Password authentication (HTTP Basic Auth)
|
|
4
|
+
*/
|
|
5
|
+
export class WordPressClient {
|
|
6
|
+
config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = {
|
|
9
|
+
...config,
|
|
10
|
+
siteUrl: config.siteUrl.replace(/\/+$/, ''),
|
|
11
|
+
applicationPassword: config.applicationPassword.replace(/\s+/g, ''),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
async request(endpoint, options = {}) {
|
|
15
|
+
const url = `${this.config.siteUrl}/wp-json${endpoint}`;
|
|
16
|
+
const auth = btoa(`${this.config.username}:${this.config.applicationPassword}`);
|
|
17
|
+
const response = await fetch(url, {
|
|
18
|
+
...options,
|
|
19
|
+
headers: {
|
|
20
|
+
'Authorization': `Basic ${auth}`,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
...options.headers,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const error = await response.text();
|
|
27
|
+
throw new Error(`WordPress API Error (${response.status}): ${error}`);
|
|
28
|
+
}
|
|
29
|
+
return response.json();
|
|
30
|
+
}
|
|
31
|
+
// Posts
|
|
32
|
+
async listPosts(params) {
|
|
33
|
+
const query = new URLSearchParams();
|
|
34
|
+
if (params?.per_page)
|
|
35
|
+
query.set('per_page', String(params.per_page));
|
|
36
|
+
if (params?.status)
|
|
37
|
+
query.set('status', params.status);
|
|
38
|
+
if (params?.search)
|
|
39
|
+
query.set('search', params.search);
|
|
40
|
+
const qs = query.toString();
|
|
41
|
+
return this.request(`/wp/v2/posts${qs ? `?${qs}` : ''}`);
|
|
42
|
+
}
|
|
43
|
+
async getPost(id) {
|
|
44
|
+
return this.request(`/wp/v2/posts/${id}`);
|
|
45
|
+
}
|
|
46
|
+
async createPost(data) {
|
|
47
|
+
return this.request('/wp/v2/posts', { method: 'POST', body: JSON.stringify(data) });
|
|
48
|
+
}
|
|
49
|
+
async updatePost(id, data) {
|
|
50
|
+
return this.request(`/wp/v2/posts/${id}`, { method: 'POST', body: JSON.stringify(data) });
|
|
51
|
+
}
|
|
52
|
+
async deletePost(id) {
|
|
53
|
+
return this.request(`/wp/v2/posts/${id}`, { method: 'DELETE' });
|
|
54
|
+
}
|
|
55
|
+
// Pages
|
|
56
|
+
async listPages(params) {
|
|
57
|
+
const query = new URLSearchParams();
|
|
58
|
+
if (params?.per_page)
|
|
59
|
+
query.set('per_page', String(params.per_page));
|
|
60
|
+
if (params?.status)
|
|
61
|
+
query.set('status', params.status);
|
|
62
|
+
const qs = query.toString();
|
|
63
|
+
return this.request(`/wp/v2/pages${qs ? `?${qs}` : ''}`);
|
|
64
|
+
}
|
|
65
|
+
async getPage(id) {
|
|
66
|
+
return this.request(`/wp/v2/pages/${id}`);
|
|
67
|
+
}
|
|
68
|
+
async createPage(data) {
|
|
69
|
+
return this.request('/wp/v2/pages', { method: 'POST', body: JSON.stringify(data) });
|
|
70
|
+
}
|
|
71
|
+
async updatePage(id, data) {
|
|
72
|
+
return this.request(`/wp/v2/pages/${id}`, { method: 'POST', body: JSON.stringify(data) });
|
|
73
|
+
}
|
|
74
|
+
async deletePage(id) {
|
|
75
|
+
return this.request(`/wp/v2/pages/${id}`, { method: 'DELETE' });
|
|
76
|
+
}
|
|
77
|
+
// Media
|
|
78
|
+
async listMedia(params) {
|
|
79
|
+
const query = new URLSearchParams();
|
|
80
|
+
if (params?.per_page)
|
|
81
|
+
query.set('per_page', String(params.per_page));
|
|
82
|
+
if (params?.media_type)
|
|
83
|
+
query.set('media_type', params.media_type);
|
|
84
|
+
const qs = query.toString();
|
|
85
|
+
return this.request(`/wp/v2/media${qs ? `?${qs}` : ''}`);
|
|
86
|
+
}
|
|
87
|
+
async deleteMedia(id) {
|
|
88
|
+
return this.request(`/wp/v2/media/${id}?force=true`, { method: 'DELETE' });
|
|
89
|
+
}
|
|
90
|
+
// Comments
|
|
91
|
+
async listComments(params) {
|
|
92
|
+
const query = new URLSearchParams();
|
|
93
|
+
if (params?.post)
|
|
94
|
+
query.set('post', String(params.post));
|
|
95
|
+
if (params?.per_page)
|
|
96
|
+
query.set('per_page', String(params.per_page));
|
|
97
|
+
const qs = query.toString();
|
|
98
|
+
return this.request(`/wp/v2/comments${qs ? `?${qs}` : ''}`);
|
|
99
|
+
}
|
|
100
|
+
async createComment(data) {
|
|
101
|
+
return this.request('/wp/v2/comments', { method: 'POST', body: JSON.stringify(data) });
|
|
102
|
+
}
|
|
103
|
+
async updateComment(id, data) {
|
|
104
|
+
return this.request(`/wp/v2/comments/${id}`, { method: 'POST', body: JSON.stringify(data) });
|
|
105
|
+
}
|
|
106
|
+
async deleteComment(id) {
|
|
107
|
+
return this.request(`/wp/v2/comments/${id}?force=true`, { method: 'DELETE' });
|
|
108
|
+
}
|
|
109
|
+
// Categories
|
|
110
|
+
async listCategories() {
|
|
111
|
+
return this.request('/wp/v2/categories?per_page=100');
|
|
112
|
+
}
|
|
113
|
+
// Tags
|
|
114
|
+
async listTags() {
|
|
115
|
+
return this.request('/wp/v2/tags?per_page=100');
|
|
116
|
+
}
|
|
117
|
+
// Users
|
|
118
|
+
async listUsers() {
|
|
119
|
+
return this.request('/wp/v2/users');
|
|
120
|
+
}
|
|
121
|
+
// Site info
|
|
122
|
+
async getSiteInfo() {
|
|
123
|
+
return this.request('/');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,eAAe;IAClB,MAAM,CAAkB;IAEhC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,MAAM;YACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACpE,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,QAAgB,EAAE,UAAuB,EAAE;QAClE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,WAAW,QAAQ,EAAE,CAAC;QACxD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEhF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,GAAG,OAAO;YACV,OAAO,EAAE;gBACP,eAAe,EAAE,SAAS,IAAI,EAAE;gBAChC,cAAc,EAAE,kBAAkB;gBAClC,GAAG,OAAO,CAAC,OAAO;aACnB;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAC,MAAM,MAAM,KAAK,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,E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AC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAoF;QACtG,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,IAA2C;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,aAAa;IACb,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;IACP,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ;IACR,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;IACZ,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WordPress MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Community edition — connects to any WordPress site via REST API.
|
|
6
|
+
*
|
|
7
|
+
* Usage (stdio - for Claude Desktop / Cursor / VS Code):
|
|
8
|
+
* WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npx @node2flow/wordpress-mcp
|
|
9
|
+
*
|
|
10
|
+
* Usage (HTTP - Streamable HTTP transport):
|
|
11
|
+
* WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npx @node2flow/wordpress-mcp --http
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Smithery expects a default export that returns a Server instance.
|
|
15
|
+
*/
|
|
16
|
+
export default function createSmitheryServer(opts?: {
|
|
17
|
+
config?: {
|
|
18
|
+
WORDPRESS_URL?: string;
|
|
19
|
+
WORDPRESS_USERNAME?: string;
|
|
20
|
+
WORDPRESS_APP_PASSWORD?: string;
|
|
21
|
+
};
|
|
22
|
+
}): import("@modelcontextprotocol/sdk/server/mcp.js").McpServer;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AA6KH;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,+DAMxJ"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WordPress MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Community edition — connects to any WordPress site via REST API.
|
|
6
|
+
*
|
|
7
|
+
* Usage (stdio - for Claude Desktop / Cursor / VS Code):
|
|
8
|
+
* WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npx @node2flow/wordpress-mcp
|
|
9
|
+
*
|
|
10
|
+
* Usage (HTTP - Streamable HTTP transport):
|
|
11
|
+
* WORDPRESS_URL=https://your-site.com WORDPRESS_USERNAME=user WORDPRESS_APP_PASSWORD=pass npx @node2flow/wordpress-mcp --http
|
|
12
|
+
*/
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
|
+
import { StreamableHTTPServerTransport, } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
16
|
+
import { createMcpExpressApp } from '@modelcontextprotocol/sdk/server/express.js';
|
|
17
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
18
|
+
import { createServer } from './server.js';
|
|
19
|
+
import { TOOLS } from './tools.js';
|
|
20
|
+
/**
|
|
21
|
+
* Read config from environment variables
|
|
22
|
+
*/
|
|
23
|
+
function getConfig() {
|
|
24
|
+
const siteUrl = process.env.WORDPRESS_URL;
|
|
25
|
+
const username = process.env.WORDPRESS_USERNAME;
|
|
26
|
+
const applicationPassword = process.env.WORDPRESS_APP_PASSWORD;
|
|
27
|
+
if (!siteUrl || !username || !applicationPassword) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return { siteUrl, username, applicationPassword };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Start in stdio mode (for Claude Desktop, Cursor, VS Code)
|
|
34
|
+
*/
|
|
35
|
+
async function startStdio() {
|
|
36
|
+
const config = getConfig();
|
|
37
|
+
const server = createServer(config ?? undefined);
|
|
38
|
+
const transport = new StdioServerTransport();
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
console.error('WordPress MCP Server running on stdio');
|
|
41
|
+
console.error(`Site URL: ${config?.siteUrl ?? '(not configured yet)'}`);
|
|
42
|
+
console.error(`Tools available: ${TOOLS.length}`);
|
|
43
|
+
console.error('Ready for MCP client\n');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Start in HTTP mode (Streamable HTTP transport)
|
|
47
|
+
*/
|
|
48
|
+
async function startHttp() {
|
|
49
|
+
const port = parseInt(process.env.PORT || '3000', 10);
|
|
50
|
+
const app = createMcpExpressApp({ host: '0.0.0.0' });
|
|
51
|
+
const transports = {};
|
|
52
|
+
app.post('/mcp', async (req, res) => {
|
|
53
|
+
const url = new URL(req.url, `http://${req.headers.host}`);
|
|
54
|
+
const qUrl = url.searchParams.get('WORDPRESS_URL');
|
|
55
|
+
const qUser = url.searchParams.get('WORDPRESS_USERNAME');
|
|
56
|
+
const qPass = url.searchParams.get('WORDPRESS_APP_PASSWORD');
|
|
57
|
+
if (qUrl)
|
|
58
|
+
process.env.WORDPRESS_URL = qUrl;
|
|
59
|
+
if (qUser)
|
|
60
|
+
process.env.WORDPRESS_USERNAME = qUser;
|
|
61
|
+
if (qPass)
|
|
62
|
+
process.env.WORDPRESS_APP_PASSWORD = qPass;
|
|
63
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
64
|
+
try {
|
|
65
|
+
let transport;
|
|
66
|
+
if (sessionId && transports[sessionId]) {
|
|
67
|
+
transport = transports[sessionId];
|
|
68
|
+
}
|
|
69
|
+
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
70
|
+
transport = new StreamableHTTPServerTransport({
|
|
71
|
+
sessionIdGenerator: () => randomUUID(),
|
|
72
|
+
onsessioninitialized: (sid) => {
|
|
73
|
+
transports[sid] = transport;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
transport.onclose = () => {
|
|
77
|
+
const sid = transport.sessionId;
|
|
78
|
+
if (sid && transports[sid]) {
|
|
79
|
+
delete transports[sid];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const config = getConfig();
|
|
83
|
+
const server = createServer(config ?? undefined);
|
|
84
|
+
await server.connect(transport);
|
|
85
|
+
await transport.handleRequest(req, res, req.body);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
res.status(400).json({
|
|
90
|
+
jsonrpc: '2.0',
|
|
91
|
+
error: { code: -32000, message: 'Bad Request: No valid session ID provided' },
|
|
92
|
+
id: null,
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await transport.handleRequest(req, res, req.body);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
console.error('Error handling MCP request:', error);
|
|
100
|
+
if (!res.headersSent) {
|
|
101
|
+
res.status(500).json({
|
|
102
|
+
jsonrpc: '2.0',
|
|
103
|
+
error: { code: -32603, message: 'Internal server error' },
|
|
104
|
+
id: null,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
app.get('/mcp', async (req, res) => {
|
|
110
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
111
|
+
if (!sessionId || !transports[sessionId]) {
|
|
112
|
+
res.status(400).send('Invalid or missing session ID');
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
await transports[sessionId].handleRequest(req, res);
|
|
116
|
+
});
|
|
117
|
+
app.delete('/mcp', async (req, res) => {
|
|
118
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
119
|
+
if (!sessionId || !transports[sessionId]) {
|
|
120
|
+
res.status(400).send('Invalid or missing session ID');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
await transports[sessionId].handleRequest(req, res);
|
|
124
|
+
});
|
|
125
|
+
app.get('/', (_req, res) => {
|
|
126
|
+
res.json({
|
|
127
|
+
name: 'wordpress-mcp',
|
|
128
|
+
version: '1.0.0',
|
|
129
|
+
status: 'ok',
|
|
130
|
+
tools: TOOLS.length,
|
|
131
|
+
transport: 'streamable-http',
|
|
132
|
+
endpoints: { mcp: '/mcp' },
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
const config = getConfig();
|
|
136
|
+
app.listen(port, () => {
|
|
137
|
+
console.log(`WordPress MCP Server (HTTP) listening on port ${port}`);
|
|
138
|
+
console.log(`Site URL: ${config?.siteUrl ?? '(not configured yet)'}`);
|
|
139
|
+
console.log(`Tools available: ${TOOLS.length}`);
|
|
140
|
+
console.log(`MCP endpoint: http://localhost:${port}/mcp`);
|
|
141
|
+
});
|
|
142
|
+
process.on('SIGINT', async () => {
|
|
143
|
+
console.log('\nShutting down...');
|
|
144
|
+
for (const sessionId in transports) {
|
|
145
|
+
try {
|
|
146
|
+
await transports[sessionId].close();
|
|
147
|
+
delete transports[sessionId];
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// Ignore cleanup errors
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
process.exit(0);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Main entry point
|
|
158
|
+
*/
|
|
159
|
+
async function main() {
|
|
160
|
+
const useHttp = process.argv.includes('--http');
|
|
161
|
+
if (useHttp) {
|
|
162
|
+
await startHttp();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
await startStdio();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Smithery expects a default export that returns a Server instance.
|
|
170
|
+
*/
|
|
171
|
+
export default function createSmitheryServer(opts) {
|
|
172
|
+
if (opts?.config?.WORDPRESS_URL)
|
|
173
|
+
process.env.WORDPRESS_URL = opts.config.WORDPRESS_URL;
|
|
174
|
+
if (opts?.config?.WORDPRESS_USERNAME)
|
|
175
|
+
process.env.WORDPRESS_USERNAME = opts.config.WORDPRESS_USERNAME;
|
|
176
|
+
if (opts?.config?.WORDPRESS_APP_PASSWORD)
|
|
177
|
+
process.env.WORDPRESS_APP_PASSWORD = opts.config.WORDPRESS_APP_PASSWORD;
|
|
178
|
+
const config = getConfig();
|
|
179
|
+
return createServer(config ?? undefined);
|
|
180
|
+
}
|
|
181
|
+
main().catch((error) => {
|
|
182
|
+
console.error('Fatal error:', error);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,6BAA6B,GAC9B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,SAAS,SAAS;IAChB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAChD,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAE/D,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAA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ker entry (worker.ts)
|
|
4
|
+
*/
|
|
5
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import { WordPressClient } from './client.js';
|
|
7
|
+
export interface WordPressMcpConfig {
|
|
8
|
+
siteUrl: string;
|
|
9
|
+
username: string;
|
|
10
|
+
applicationPassword: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Handle MCP tool calls by routing to WordPressClient methods
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleToolCall(toolName: string, args: Record<string, unknown>, client: WordPressClient): Promise<unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a configured MCP Server instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function createServer(config?: WordPressMcpConfig): McpServer;
|
|
20
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA+D/H;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS,CA8CnE"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP Server creation logic
|
|
3
|
+
* Used by both Node.js entry (index.ts) and CF Worker entry (worker.ts)
|
|
4
|
+
*/
|
|
5
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import { WordPressClient } from './client.js';
|
|
7
|
+
import { TOOLS } from './tools.js';
|
|
8
|
+
/**
|
|
9
|
+
* Handle MCP tool calls by routing to WordPressClient methods
|
|
10
|
+
*/
|
|
11
|
+
export async function handleToolCall(toolName, args, client) {
|
|
12
|
+
switch (toolName) {
|
|
13
|
+
// Posts
|
|
14
|
+
case 'wp_list_posts':
|
|
15
|
+
return client.listPosts(args);
|
|
16
|
+
case 'wp_get_post':
|
|
17
|
+
return client.getPost(args.id);
|
|
18
|
+
case 'wp_create_post':
|
|
19
|
+
return client.createPost(args);
|
|
20
|
+
case 'wp_update_post': {
|
|
21
|
+
const { id, ...data } = args;
|
|
22
|
+
return client.updatePost(id, data);
|
|
23
|
+
}
|
|
24
|
+
case 'wp_delete_post':
|
|
25
|
+
return client.deletePost(args.id);
|
|
26
|
+
// Pages
|
|
27
|
+
case 'wp_list_pages':
|
|
28
|
+
return client.listPages(args);
|
|
29
|
+
case 'wp_get_page':
|
|
30
|
+
return client.getPage(args.id);
|
|
31
|
+
case 'wp_create_page':
|
|
32
|
+
return client.createPage(args);
|
|
33
|
+
case 'wp_update_page': {
|
|
34
|
+
const { id, ...data } = args;
|
|
35
|
+
return client.updatePage(id, data);
|
|
36
|
+
}
|
|
37
|
+
case 'wp_delete_page':
|
|
38
|
+
return client.deletePage(args.id);
|
|
39
|
+
// Media
|
|
40
|
+
case 'wp_list_media':
|
|
41
|
+
return client.listMedia(args);
|
|
42
|
+
case 'wp_delete_media':
|
|
43
|
+
return client.deleteMedia(args.id);
|
|
44
|
+
// Comments
|
|
45
|
+
case 'wp_list_comments':
|
|
46
|
+
return client.listComments(args);
|
|
47
|
+
case 'wp_create_comment':
|
|
48
|
+
return client.createComment(args);
|
|
49
|
+
case 'wp_update_comment': {
|
|
50
|
+
const { id, ...data } = args;
|
|
51
|
+
return client.updateComment(id, data);
|
|
52
|
+
}
|
|
53
|
+
case 'wp_delete_comment':
|
|
54
|
+
return client.deleteComment(args.id);
|
|
55
|
+
// Taxonomy
|
|
56
|
+
case 'wp_list_categories':
|
|
57
|
+
return client.listCategories();
|
|
58
|
+
case 'wp_list_tags':
|
|
59
|
+
return client.listTags();
|
|
60
|
+
// Users & Site
|
|
61
|
+
case 'wp_list_users':
|
|
62
|
+
return client.listUsers();
|
|
63
|
+
case 'wp_get_site_info':
|
|
64
|
+
return client.getSiteInfo();
|
|
65
|
+
default:
|
|
66
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a configured MCP Server instance
|
|
71
|
+
*/
|
|
72
|
+
export function createServer(config) {
|
|
73
|
+
const server = new McpServer({
|
|
74
|
+
name: 'wordpress-mcp',
|
|
75
|
+
version: '1.0.0',
|
|
76
|
+
});
|
|
77
|
+
let client = null;
|
|
78
|
+
for (const tool of TOOLS) {
|
|
79
|
+
server.tool(tool.name, tool.description, tool.inputSchema, async (args) => {
|
|
80
|
+
const siteUrl = config?.siteUrl || args.WORDPRESS_URL;
|
|
81
|
+
const username = config?.username || args.WORDPRESS_USERNAME;
|
|
82
|
+
const applicationPassword = config?.applicationPassword || args.WORDPRESS_APP_PASSWORD;
|
|
83
|
+
if (!siteUrl || !username || !applicationPassword) {
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: 'text', text: 'Error: WORDPRESS_URL, WORDPRESS_USERNAME, and WORDPRESS_APP_PASSWORD are required.' }],
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (!client) {
|
|
90
|
+
client = new WordPressClient({ siteUrl, username, applicationPassword });
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const result = await handleToolCall(tool.name, args, client);
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
96
|
+
isError: false,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: 'text', text: `Error: ${error.message}` }],
|
|
102
|
+
isError: true,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return server;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAQnC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,IAA6B,EAAE,MAAuB;IAC3G,QAAQ,QAAQ,EAAE,CAAC;QACjB,QAAQ;QACR,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC,SAAS,CAAC,IAAW,CAAC,CAAC;QACvC,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAY,CAAC,CAAC;QAC3C,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,UAAU,CAAC,IAAW,CAAC,CAAC;QACxC,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACtB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAC7B,OAAO,MAAM,CAAC,UAAU,CAAC,EAAY,EAAE,IAAW,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAY,CAAC,CAAC;QAE9C,QAAQ;QACR,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC,SAAS,CAAC,IAAW,CAAC,CAAC;Q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EAAE,MAAM,CAAC,CAAC;gBAC7D,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;oBAC3E,OAAO,EAAE,KAAK;iBACf,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;oBACrE,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress MCP Tool Definitions (20 tools)
|
|
3
|
+
*/
|
|
4
|
+
export interface MCPToolDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare const TOOLS: MCPToolDefinition[];
|
|
10
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,KAAK,EAAE,iBAAiB,EAqOpC,CAAC"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress MCP Tool Definitions (20 tools)
|
|
3
|
+
*/
|
|
4
|
+
export const TOOLS = [
|
|
5
|
+
// ========== Post Tools (5) ==========
|
|
6
|
+
{
|
|
7
|
+
name: 'wp_list_posts',
|
|
8
|
+
description: 'List WordPress posts with optional filters. Returns post ID, title, status, date, and categories. Use to browse existing content or find posts by keyword.',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
per_page: { type: 'number', description: 'Number of posts to return (default 10, max 100)' },
|
|
13
|
+
status: { type: 'string', description: 'Filter by status: publish, draft, pending, private, trash' },
|
|
14
|
+
search: { type: 'string', description: 'Search posts by keyword' },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'wp_get_post',
|
|
20
|
+
description: 'Get a single WordPress post with full content, metadata, categories, and tags. Use to inspect post content before editing.',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
id: { type: 'number', description: 'Post ID' },
|
|
25
|
+
},
|
|
26
|
+
required: ['id'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'wp_create_post',
|
|
31
|
+
description: 'Create a new WordPress post. Provide title and content (HTML). Optionally set status (draft/publish), categories, and tags.',
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
title: { type: 'string', description: 'Post title' },
|
|
36
|
+
content: { type: 'string', description: 'Post content (HTML)' },
|
|
37
|
+
status: { type: 'string', description: 'Post status: draft (default), publish, pending, private' },
|
|
38
|
+
categories: { type: 'array', items: { type: 'number' }, description: 'Category IDs' },
|
|
39
|
+
tags: { type: 'array', items: { type: 'number' }, description: 'Tag IDs' },
|
|
40
|
+
},
|
|
41
|
+
required: ['title', 'content'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'wp_update_post',
|
|
46
|
+
description: 'Update an existing WordPress post. Change title, content, status, categories, or tags.',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
id: { type: 'number', description: 'Post ID to update' },
|
|
51
|
+
title: { type: 'string', description: 'New title (optional)' },
|
|
52
|
+
content: { type: 'string', description: 'New content HTML (optional)' },
|
|
53
|
+
status: { type: 'string', description: 'New status (optional)' },
|
|
54
|
+
categories: { type: 'array', items: { type: 'number' }, description: 'New category IDs (optional)' },
|
|
55
|
+
tags: { type: 'array', items: { type: 'number' }, description: 'New tag IDs (optional)' },
|
|
56
|
+
},
|
|
57
|
+
required: ['id'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'wp_delete_post',
|
|
62
|
+
description: 'Delete a WordPress post. Moves to trash by default.',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
id: { type: 'number', description: 'Post ID to delete' },
|
|
67
|
+
},
|
|
68
|
+
required: ['id'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
// ========== Page Tools (5) ==========
|
|
72
|
+
{
|
|
73
|
+
name: 'wp_list_pages',
|
|
74
|
+
description: 'List WordPress pages. Returns page ID, title, status, and parent page. Use to browse site page structure.',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
per_page: { type: 'number', description: 'Number of pages to return (default 10, max 100)' },
|
|
79
|
+
status: { type: 'string', description: 'Filter by status: publish, draft, pending, private' },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'wp_get_page',
|
|
85
|
+
description: 'Get a single WordPress page with full content and metadata.',
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: {
|
|
89
|
+
id: { type: 'number', description: 'Page ID' },
|
|
90
|
+
},
|
|
91
|
+
required: ['id'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'wp_create_page',
|
|
96
|
+
description: 'Create a new WordPress page. Provide title and content (HTML). Optionally set parent page for hierarchy.',
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
title: { type: 'string', description: 'Page title' },
|
|
101
|
+
content: { type: 'string', description: 'Page content (HTML)' },
|
|
102
|
+
status: { type: 'string', description: 'Page status: draft (default), publish' },
|
|
103
|
+
parent: { type: 'number', description: 'Parent page ID for hierarchical pages' },
|
|
104
|
+
},
|
|
105
|
+
required: ['title', 'content'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'wp_update_page',
|
|
110
|
+
description: 'Update an existing WordPress page.',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
id: { type: 'number', description: 'Page ID to update' },
|
|
115
|
+
title: { type: 'string', description: 'New title (optional)' },
|
|
116
|
+
content: { type: 'string', description: 'New content HTML (optional)' },
|
|
117
|
+
status: { type: 'string', description: 'New status (optional)' },
|
|
118
|
+
},
|
|
119
|
+
required: ['id'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'wp_delete_page',
|
|
124
|
+
description: 'Delete a WordPress page.',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
id: { type: 'number', description: 'Page ID to delete' },
|
|
129
|
+
},
|
|
130
|
+
required: ['id'],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
// ========== Media Tools (2) ==========
|
|
134
|
+
{
|
|
135
|
+
name: 'wp_list_media',
|
|
136
|
+
description: 'List media files in the WordPress library. Returns file URLs, types, and metadata.',
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
per_page: { type: 'number', description: 'Number of items to return (default 10)' },
|
|
141
|
+
media_type: { type: 'string', description: 'Filter by type: image, video, audio, application' },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'wp_delete_media',
|
|
147
|
+
description: 'Permanently delete a media file from WordPress.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
id: { type: 'number', description: 'Media ID to delete' },
|
|
152
|
+
},
|
|
153
|
+
required: ['id'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
// ========== Comment Tools (4) ==========
|
|
157
|
+
{
|
|
158
|
+
name: 'wp_list_comments',
|
|
159
|
+
description: 'List comments on WordPress posts. Filter by post ID.',
|
|
160
|
+
inputSchema: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
properties: {
|
|
163
|
+
post: { type: 'number', description: 'Filter by post ID' },
|
|
164
|
+
per_page: { type: 'number', description: 'Number of comments to return' },
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'wp_create_comment',
|
|
170
|
+
description: 'Create a new comment on a WordPress post.',
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
properties: {
|
|
174
|
+
post: { type: 'number', description: 'Post ID to comment on' },
|
|
175
|
+
content: { type: 'string', description: 'Comment content' },
|
|
176
|
+
author_name: { type: 'string', description: 'Comment author name' },
|
|
177
|
+
author_email: { type: 'string', description: 'Comment author email' },
|
|
178
|
+
},
|
|
179
|
+
required: ['post', 'content'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'wp_update_comment',
|
|
184
|
+
description: 'Update or moderate a comment. Change content or approval status.',
|
|
185
|
+
inputSchema: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: {
|
|
188
|
+
id: { type: 'number', description: 'Comment ID' },
|
|
189
|
+
content: { type: 'string', description: 'New comment content (optional)' },
|
|
190
|
+
status: { type: 'string', description: 'New status: approved, hold, spam, trash' },
|
|
191
|
+
},
|
|
192
|
+
required: ['id'],
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'wp_delete_comment',
|
|
197
|
+
description: 'Permanently delete a comment.',
|
|
198
|
+
inputSchema: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
properties: {
|
|
201
|
+
id: { type: 'number', description: 'Comment ID to delete' },
|
|
202
|
+
},
|
|
203
|
+
required: ['id'],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
// ========== Taxonomy Tools (2) ==========
|
|
207
|
+
{
|
|
208
|
+
name: 'wp_list_categories',
|
|
209
|
+
description: 'List all WordPress categories with post counts.',
|
|
210
|
+
inputSchema: { type: 'object', properties: {} },
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'wp_list_tags',
|
|
214
|
+
description: 'List all WordPress tags with post counts.',
|
|
215
|
+
inputSchema: { type: 'object', properties: {} },
|
|
216
|
+
},
|
|
217
|
+
// ========== User & Site Tools (2) ==========
|
|
218
|
+
{
|
|
219
|
+
name: 'wp_list_users',
|
|
220
|
+
description: 'List WordPress users with their roles.',
|
|
221
|
+
inputSchema: { type: 'object', properties: {} },
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'wp_get_site_info',
|
|
225
|
+
description: 'Get WordPress site information: name, description, URL, timezone, and available features.',
|
|
226
|
+
inputSchema: { type: 'object', properties: {} },
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,CAAC,MAAM,KAAK,GAAwB;IACxC,uCAAuC;IACvC;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,4JAA4J;QACzK,WAAW,EA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AAE,EAAE,EAAE;KAChD;IAED,8CAA8C;IAC9C;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,wCAAwC;QACrD,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,2FAA2F;QACxG,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD;CACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress MCP Server - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
export interface WordPressConfig {
|
|
5
|
+
siteUrl: string;
|
|
6
|
+
username: string;
|
|
7
|
+
applicationPassword: string;
|
|
8
|
+
}
|
|
9
|
+
export interface WPPost {
|
|
10
|
+
id: number;
|
|
11
|
+
title: {
|
|
12
|
+
rendered: string;
|
|
13
|
+
};
|
|
14
|
+
content: {
|
|
15
|
+
rendered: string;
|
|
16
|
+
};
|
|
17
|
+
excerpt: {
|
|
18
|
+
rendered: string;
|
|
19
|
+
};
|
|
20
|
+
status: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
date: string;
|
|
23
|
+
modified: string;
|
|
24
|
+
author: number;
|
|
25
|
+
categories: number[];
|
|
26
|
+
tags: number[];
|
|
27
|
+
}
|
|
28
|
+
export interface WPPage {
|
|
29
|
+
id: number;
|
|
30
|
+
title: {
|
|
31
|
+
rendered: string;
|
|
32
|
+
};
|
|
33
|
+
content: {
|
|
34
|
+
rendered: string;
|
|
35
|
+
};
|
|
36
|
+
status: string;
|
|
37
|
+
slug: string;
|
|
38
|
+
date: string;
|
|
39
|
+
modified: string;
|
|
40
|
+
parent: number;
|
|
41
|
+
}
|
|
42
|
+
export interface WPMedia {
|
|
43
|
+
id: number;
|
|
44
|
+
title: {
|
|
45
|
+
rendered: string;
|
|
46
|
+
};
|
|
47
|
+
source_url: string;
|
|
48
|
+
mime_type: string;
|
|
49
|
+
media_type: string;
|
|
50
|
+
date: string;
|
|
51
|
+
}
|
|
52
|
+
export interface WPComment {
|
|
53
|
+
id: number;
|
|
54
|
+
post: number;
|
|
55
|
+
author_name: string;
|
|
56
|
+
content: {
|
|
57
|
+
rendered: string;
|
|
58
|
+
};
|
|
59
|
+
status: string;
|
|
60
|
+
date: string;
|
|
61
|
+
}
|
|
62
|
+
export interface WPCategory {
|
|
63
|
+
id: number;
|
|
64
|
+
name: string;
|
|
65
|
+
slug: string;
|
|
66
|
+
count: number;
|
|
67
|
+
parent: number;
|
|
68
|
+
}
|
|
69
|
+
export interface WPTag {
|
|
70
|
+
id: number;
|
|
71
|
+
name: string;
|
|
72
|
+
slug: string;
|
|
73
|
+
count: number;
|
|
74
|
+
}
|
|
75
|
+
export interface WPUser {
|
|
76
|
+
id: number;
|
|
77
|
+
name: string;
|
|
78
|
+
slug: string;
|
|
79
|
+
email?: string;
|
|
80
|
+
roles: string[];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI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AAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Worker entry point for WordPress MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Deploys the MCP server on Cloudflare Workers using Web Standard APIs.
|
|
5
|
+
* Each request creates a fresh transport+server (stateless mode).
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
fetch(request: Request): Promise<Response>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;mBA+BoB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AADlD,wBA4DE"}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Worker entry point for WordPress MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Deploys the MCP server on Cloudflare Workers using Web Standard APIs.
|
|
5
|
+
* Each request creates a fresh transport+server (stateless mode).
|
|
6
|
+
*/
|
|
7
|
+
import { WebStandardStreamableHTTPServerTransport, } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
8
|
+
import { createServer } from './server.js';
|
|
9
|
+
import { TOOLS } from './tools.js';
|
|
10
|
+
function corsHeaders() {
|
|
11
|
+
return {
|
|
12
|
+
'Access-Control-Allow-Origin': '*',
|
|
13
|
+
'Access-Control-Allow-Methods': 'GET, POST, DELETE, OPTIONS',
|
|
14
|
+
'Access-Control-Allow-Headers': 'Content-Type, mcp-session-id, Accept, mcp-protocol-version',
|
|
15
|
+
'Access-Control-Expose-Headers': 'mcp-session-id',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function addCors(response) {
|
|
19
|
+
const headers = new Headers(response.headers);
|
|
20
|
+
for (const [key, value] of Object.entries(corsHeaders())) {
|
|
21
|
+
headers.set(key, value);
|
|
22
|
+
}
|
|
23
|
+
return new Response(response.body, {
|
|
24
|
+
status: response.status,
|
|
25
|
+
statusText: response.statusText,
|
|
26
|
+
headers,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export default {
|
|
30
|
+
async fetch(request) {
|
|
31
|
+
const url = new URL(request.url);
|
|
32
|
+
// CORS preflight
|
|
33
|
+
if (request.method === 'OPTIONS') {
|
|
34
|
+
return new Response(null, { status: 204, headers: corsHeaders() });
|
|
35
|
+
}
|
|
36
|
+
// Health check
|
|
37
|
+
if (url.pathname === '/' && request.method === 'GET') {
|
|
38
|
+
return addCors(Response.json({
|
|
39
|
+
name: 'wordpress-mcp',
|
|
40
|
+
version: '1.0.0',
|
|
41
|
+
status: 'ok',
|
|
42
|
+
tools: TOOLS.length,
|
|
43
|
+
transport: 'streamable-http',
|
|
44
|
+
endpoints: { mcp: '/mcp' },
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
// Only /mcp endpoint
|
|
48
|
+
if (url.pathname !== '/mcp') {
|
|
49
|
+
return addCors(new Response('Not Found', { status: 404 }));
|
|
50
|
+
}
|
|
51
|
+
// Only POST supported in stateless mode
|
|
52
|
+
if (request.method !== 'POST') {
|
|
53
|
+
return addCors(Response.json({ jsonrpc: '2.0', error: { code: -32000, message: 'Method not allowed. Use POST.' }, id: null }, { status: 405 }));
|
|
54
|
+
}
|
|
55
|
+
// Read config from query params
|
|
56
|
+
const siteUrl = url.searchParams.get('WORDPRESS_URL');
|
|
57
|
+
const username = url.searchParams.get('WORDPRESS_USERNAME');
|
|
58
|
+
const applicationPassword = url.searchParams.get('WORDPRESS_APP_PASSWORD');
|
|
59
|
+
const config = siteUrl && username && applicationPassword
|
|
60
|
+
? { siteUrl, username, applicationPassword }
|
|
61
|
+
: undefined;
|
|
62
|
+
try {
|
|
63
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
64
|
+
sessionIdGenerator: undefined,
|
|
65
|
+
enableJsonResponse: true,
|
|
66
|
+
});
|
|
67
|
+
const server = createServer(config);
|
|
68
|
+
await server.connect(transport);
|
|
69
|
+
const response = await transport.handleRequest(request);
|
|
70
|
+
return addCors(response);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return addCors(Response.json({ jsonrpc: '2.0', error: { code: -32603, message: error.message || 'Internal server error' }, id: null }, { status: 500 }));
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,wCAAwC,GACzC,MAAM,+DAA+D,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,SAAS,WAAW;IAClB,OAAO;QACL,6BAA6B,EAAE,GAAG;QAClC,8BAA8B,EAAE,4BAA4B;QAC5D,8BAA8B,EAAE,4DAA4D;QAC5F,+BAA+B,EAAE,gBAAgB;KAClD,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,QAAkB;IACjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,CAA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KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,uBAAuB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EACxG,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@node2flow/wordpress-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for WordPress REST API — manage posts, pages, media, comments, categories, tags, and users",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"wordpress-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"start": "node dist/index.js",
|
|
18
|
+
"dev": "tsx src/index.ts",
|
|
19
|
+
"deploy": "wrangler deploy",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"wordpress",
|
|
25
|
+
"rest-api",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"ai",
|
|
28
|
+
"claude",
|
|
29
|
+
"node2flow"
|
|
30
|
+
],
|
|
31
|
+
"author": "Node2Flow",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/node2flow-th/wordpress-mcp-community"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@modelcontextprotocol/sdk": "^1.26.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.0.0",
|
|
45
|
+
"tsx": "^4.19.0",
|
|
46
|
+
"typescript": "^5.7.0",
|
|
47
|
+
"wrangler": "^4.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|