mcp-wordpress 1.1.2 → 1.1.7

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.
Files changed (91) hide show
  1. package/README.md +8 -8
  2. package/bin/mcp-wordpress.js +1 -1
  3. package/dist/client/api.d.ts +10 -10
  4. package/dist/client/api.js +157 -157
  5. package/dist/client/api.js.map +1 -1
  6. package/dist/client/auth.d.ts +2 -2
  7. package/dist/client/auth.d.ts.map +1 -1
  8. package/dist/client/auth.js +72 -72
  9. package/dist/client/auth.js.map +1 -1
  10. package/dist/client/managers/AuthenticationManager.d.ts +2 -2
  11. package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
  12. package/dist/client/managers/AuthenticationManager.js +50 -46
  13. package/dist/client/managers/AuthenticationManager.js.map +1 -1
  14. package/dist/client/managers/BaseManager.d.ts +1 -1
  15. package/dist/client/managers/BaseManager.d.ts.map +1 -1
  16. package/dist/client/managers/BaseManager.js +9 -9
  17. package/dist/client/managers/BaseManager.js.map +1 -1
  18. package/dist/client/managers/RequestManager.d.ts +2 -2
  19. package/dist/client/managers/RequestManager.js +15 -15
  20. package/dist/client/managers/index.d.ts +3 -3
  21. package/dist/client/managers/index.js +3 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +78 -61
  24. package/dist/index.js.map +1 -1
  25. package/dist/tools/auth.d.ts +2 -2
  26. package/dist/tools/auth.js +31 -31
  27. package/dist/tools/auth.js.map +1 -1
  28. package/dist/tools/comments.d.ts +2 -2
  29. package/dist/tools/comments.js +79 -79
  30. package/dist/tools/media.d.ts +2 -2
  31. package/dist/tools/media.d.ts.map +1 -1
  32. package/dist/tools/media.js +80 -80
  33. package/dist/tools/media.js.map +1 -1
  34. package/dist/tools/pages.d.ts +2 -2
  35. package/dist/tools/pages.js +75 -75
  36. package/dist/tools/posts.d.ts +2 -2
  37. package/dist/tools/posts.js +94 -94
  38. package/dist/tools/site.d.ts +2 -2
  39. package/dist/tools/site.js +60 -60
  40. package/dist/tools/site.js.map +1 -1
  41. package/dist/tools/taxonomies.d.ts +2 -2
  42. package/dist/tools/taxonomies.js +89 -89
  43. package/dist/tools/users.d.ts +2 -2
  44. package/dist/tools/users.js +68 -68
  45. package/dist/tools/users.js.map +1 -1
  46. package/dist/types/mcp.d.ts +1 -1
  47. package/dist/types/mcp.d.ts.map +1 -1
  48. package/dist/utils/debug.d.ts.map +1 -1
  49. package/dist/utils/debug.js +10 -6
  50. package/dist/utils/debug.js.map +1 -1
  51. package/dist/utils/toolWrapper.js +3 -3
  52. package/docs/developer/GITHUB_ACTIONS_SETUP.md +208 -0
  53. package/docs/developer/MAINTENANCE.md +307 -0
  54. package/docs/developer/MIGRATION_GUIDE.md +172 -0
  55. package/docs/developer/NPM_AUTH_SETUP.md +142 -0
  56. package/docs/developer/REFACTORING.md +196 -0
  57. package/docs/releases/COMMUNITY_ANNOUNCEMENT_v1.1.2.md +126 -0
  58. package/docs/releases/RELEASE_NOTES_v1.1.2.md +173 -0
  59. package/docs/user-guides/CLAUDE_DESKTOP_SETUP.md +187 -0
  60. package/package.json +4 -3
  61. package/src/client/api.ts +229 -229
  62. package/src/client/auth.ts +135 -136
  63. package/src/client/managers/AuthenticationManager.ts +148 -105
  64. package/src/client/managers/BaseManager.ts +15 -12
  65. package/src/client/managers/RequestManager.ts +17 -17
  66. package/src/client/managers/index.ts +3 -3
  67. package/src/index.ts +141 -114
  68. package/src/server.ts +1 -1
  69. package/src/tools/auth.ts +36 -36
  70. package/src/tools/comments.ts +90 -90
  71. package/src/tools/media.ts +89 -91
  72. package/src/tools/pages.ts +86 -86
  73. package/src/tools/posts.ts +106 -106
  74. package/src/tools/site.ts +71 -71
  75. package/src/tools/taxonomies.ts +102 -102
  76. package/src/tools/users.ts +77 -77
  77. package/src/types/client.ts +1 -1
  78. package/src/types/index.ts +1 -1
  79. package/src/types/mcp.ts +36 -16
  80. package/src/types/wordpress.ts +1 -1
  81. package/src/utils/debug.ts +63 -39
  82. package/src/utils/error.ts +1 -1
  83. package/src/utils/toolWrapper.ts +4 -4
  84. package/dist/client/WordPressClient.d.ts +0 -81
  85. package/dist/client/WordPressClient.d.ts.map +0 -1
  86. package/dist/client/WordPressClient.js +0 -354
  87. package/dist/client/WordPressClient.js.map +0 -1
  88. package/dist/tools/base.d.ts +0 -37
  89. package/dist/tools/base.d.ts.map +0 -1
  90. package/dist/tools/base.js +0 -60
  91. package/dist/tools/base.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getErrorMessage } from "../utils/error.js";
1
+ import { getErrorMessage } from '../utils/error.js';
2
2
  /**
3
3
  * Provides tools for managing pages on a WordPress site.
4
4
  * This class encapsulates tool definitions and their corresponding handlers.
@@ -11,137 +11,137 @@ export class PageTools {
11
11
  getTools() {
12
12
  return [
13
13
  {
14
- name: "wp_list_pages",
15
- description: "Lists pages from a WordPress site, with filters.",
14
+ name: 'wp_list_pages',
15
+ description: 'Lists pages from a WordPress site, with filters.',
16
16
  parameters: [
17
17
  {
18
- name: "per_page",
19
- type: "number",
20
- description: "Number of items to return per page (max 100).",
18
+ name: 'per_page',
19
+ type: 'number',
20
+ description: 'Number of items to return per page (max 100).'
21
21
  },
22
22
  {
23
- name: "search",
24
- type: "string",
25
- description: "Limit results to those matching a search term.",
23
+ name: 'search',
24
+ type: 'string',
25
+ description: 'Limit results to those matching a search term.'
26
26
  },
27
27
  {
28
- name: "status",
29
- type: "string",
30
- description: "Filter by page status.",
31
- enum: ["publish", "future", "draft", "pending", "private"],
32
- },
28
+ name: 'status',
29
+ type: 'string',
30
+ description: 'Filter by page status.',
31
+ enum: ['publish', 'future', 'draft', 'pending', 'private']
32
+ }
33
33
  ],
34
- handler: this.handleListPages.bind(this),
34
+ handler: this.handleListPages.bind(this)
35
35
  },
36
36
  {
37
- name: "wp_get_page",
38
- description: "Retrieves a single page by its ID.",
37
+ name: 'wp_get_page',
38
+ description: 'Retrieves a single page by its ID.',
39
39
  parameters: [
40
40
  {
41
- name: "id",
42
- type: "number",
41
+ name: 'id',
42
+ type: 'number',
43
43
  required: true,
44
- description: "The unique identifier for the page.",
45
- },
44
+ description: 'The unique identifier for the page.'
45
+ }
46
46
  ],
47
- handler: this.handleGetPage.bind(this),
47
+ handler: this.handleGetPage.bind(this)
48
48
  },
49
49
  {
50
- name: "wp_create_page",
51
- description: "Creates a new page.",
50
+ name: 'wp_create_page',
51
+ description: 'Creates a new page.',
52
52
  parameters: [
53
53
  {
54
- name: "title",
55
- type: "string",
54
+ name: 'title',
55
+ type: 'string',
56
56
  required: true,
57
- description: "The title for the page.",
57
+ description: 'The title for the page.'
58
58
  },
59
59
  {
60
- name: "content",
61
- type: "string",
62
- description: "The content for the page, in HTML format.",
60
+ name: 'content',
61
+ type: 'string',
62
+ description: 'The content for the page, in HTML format.'
63
63
  },
64
64
  {
65
- name: "status",
66
- type: "string",
67
- description: "The publishing status for the page.",
68
- enum: ["publish", "draft", "pending", "private"],
69
- },
65
+ name: 'status',
66
+ type: 'string',
67
+ description: 'The publishing status for the page.',
68
+ enum: ['publish', 'draft', 'pending', 'private']
69
+ }
70
70
  ],
71
- handler: this.handleCreatePage.bind(this),
71
+ handler: this.handleCreatePage.bind(this)
72
72
  },
73
73
  {
74
- name: "wp_update_page",
75
- description: "Updates an existing page.",
74
+ name: 'wp_update_page',
75
+ description: 'Updates an existing page.',
76
76
  parameters: [
77
77
  {
78
- name: "id",
79
- type: "number",
78
+ name: 'id',
79
+ type: 'number',
80
80
  required: true,
81
- description: "The ID of the page to update.",
81
+ description: 'The ID of the page to update.'
82
82
  },
83
83
  {
84
- name: "title",
85
- type: "string",
86
- description: "The new title for the page.",
84
+ name: 'title',
85
+ type: 'string',
86
+ description: 'The new title for the page.'
87
87
  },
88
88
  {
89
- name: "content",
90
- type: "string",
91
- description: "The new content for the page, in HTML format.",
89
+ name: 'content',
90
+ type: 'string',
91
+ description: 'The new content for the page, in HTML format.'
92
92
  },
93
93
  {
94
- name: "status",
95
- type: "string",
96
- description: "The new status for the page.",
97
- enum: ["publish", "draft", "pending", "private"],
98
- },
94
+ name: 'status',
95
+ type: 'string',
96
+ description: 'The new status for the page.',
97
+ enum: ['publish', 'draft', 'pending', 'private']
98
+ }
99
99
  ],
100
- handler: this.handleUpdatePage.bind(this),
100
+ handler: this.handleUpdatePage.bind(this)
101
101
  },
102
102
  {
103
- name: "wp_delete_page",
104
- description: "Deletes a page.",
103
+ name: 'wp_delete_page',
104
+ description: 'Deletes a page.',
105
105
  parameters: [
106
106
  {
107
- name: "id",
108
- type: "number",
107
+ name: 'id',
108
+ type: 'number',
109
109
  required: true,
110
- description: "The ID of the page to delete.",
110
+ description: 'The ID of the page to delete.'
111
111
  },
112
112
  {
113
- name: "force",
114
- type: "boolean",
115
- description: "If true, permanently delete. If false, move to trash. Defaults to false.",
116
- },
113
+ name: 'force',
114
+ type: 'boolean',
115
+ description: 'If true, permanently delete. If false, move to trash. Defaults to false.'
116
+ }
117
117
  ],
118
- handler: this.handleDeletePage.bind(this),
118
+ handler: this.handleDeletePage.bind(this)
119
119
  },
120
120
  {
121
- name: "wp_get_page_revisions",
122
- description: "Retrieves revisions for a specific page.",
121
+ name: 'wp_get_page_revisions',
122
+ description: 'Retrieves revisions for a specific page.',
123
123
  parameters: [
124
124
  {
125
- name: "id",
126
- type: "number",
125
+ name: 'id',
126
+ type: 'number',
127
127
  required: true,
128
- description: "The ID of the page to get revisions for.",
129
- },
128
+ description: 'The ID of the page to get revisions for.'
129
+ }
130
130
  ],
131
- handler: this.handleGetPageRevisions.bind(this),
132
- },
131
+ handler: this.handleGetPageRevisions.bind(this)
132
+ }
133
133
  ];
134
134
  }
135
135
  async handleListPages(client, params) {
136
136
  try {
137
137
  const pages = await client.getPages(params);
138
138
  if (pages.length === 0) {
139
- return "No pages found matching the criteria.";
139
+ return 'No pages found matching the criteria.';
140
140
  }
141
141
  const content = `Found ${pages.length} pages:\n\n` +
142
142
  pages
143
143
  .map((p) => `- ID ${p.id}: **${p.title.rendered}** (${p.status})\n Link: ${p.link}`)
144
- .join("\n");
144
+ .join('\n');
145
145
  return content;
146
146
  }
147
147
  catch (error) {
@@ -183,7 +183,7 @@ export class PageTools {
183
183
  async handleDeletePage(client, params) {
184
184
  try {
185
185
  await client.deletePage(params.id, params.force);
186
- const action = params.force ? "permanently deleted" : "moved to trash";
186
+ const action = params.force ? 'permanently deleted' : 'moved to trash';
187
187
  return `✅ Page ${params.id} has been ${action}.`;
188
188
  }
189
189
  catch (error) {
@@ -199,7 +199,7 @@ export class PageTools {
199
199
  const content = `Found ${revisions.length} revisions for page ${params.id}:\n\n` +
200
200
  revisions
201
201
  .map((r) => `- Revision by user ID ${r.author} at ${new Date(r.modified).toLocaleString()}`)
202
- .join("\n");
202
+ .join('\n');
203
203
  return content;
204
204
  }
205
205
  catch (error) {
@@ -1,5 +1,5 @@
1
- import { WordPressClient } from "../client/api.js";
2
- import { CreatePostRequest, PostQueryParams, UpdatePostRequest } from "../types/wordpress.js";
1
+ import { WordPressClient } from '../client/api.js';
2
+ import { CreatePostRequest, PostQueryParams, UpdatePostRequest } from '../types/wordpress.js';
3
3
  /**
4
4
  * Provides tools for managing posts on a WordPress site.
5
5
  * This class encapsulates tool definitions and their corresponding handlers.
@@ -1,4 +1,4 @@
1
- import { getErrorMessage } from "../utils/error.js";
1
+ import { getErrorMessage } from '../utils/error.js';
2
2
  /**
3
3
  * Provides tools for managing posts on a WordPress site.
4
4
  * This class encapsulates tool definitions and their corresponding handlers.
@@ -11,166 +11,166 @@ export class PostTools {
11
11
  getTools() {
12
12
  return [
13
13
  {
14
- name: "wp_list_posts",
15
- description: "Lists posts from a WordPress site, with filters.",
14
+ name: 'wp_list_posts',
15
+ description: 'Lists posts from a WordPress site, with filters.',
16
16
  parameters: [
17
17
  {
18
- name: "per_page",
19
- type: "number",
20
- description: "Number of items to return per page (max 100).",
18
+ name: 'per_page',
19
+ type: 'number',
20
+ description: 'Number of items to return per page (max 100).'
21
21
  },
22
22
  {
23
- name: "search",
24
- type: "string",
25
- description: "Limit results to those matching a search term.",
23
+ name: 'search',
24
+ type: 'string',
25
+ description: 'Limit results to those matching a search term.'
26
26
  },
27
27
  {
28
- name: "status",
29
- type: "string",
30
- description: "Filter by post status.",
31
- enum: ["publish", "future", "draft", "pending", "private"],
28
+ name: 'status',
29
+ type: 'string',
30
+ description: 'Filter by post status.',
31
+ enum: ['publish', 'future', 'draft', 'pending', 'private']
32
32
  },
33
33
  {
34
- name: "categories",
35
- type: "array",
36
- items: { type: "number" },
37
- description: "Limit results to posts in specific category IDs.",
34
+ name: 'categories',
35
+ type: 'array',
36
+ items: { type: 'number' },
37
+ description: 'Limit results to posts in specific category IDs.'
38
38
  },
39
39
  {
40
- name: "tags",
41
- type: "array",
42
- items: { type: "number" },
43
- description: "Limit results to posts with specific tag IDs.",
44
- },
40
+ name: 'tags',
41
+ type: 'array',
42
+ items: { type: 'number' },
43
+ description: 'Limit results to posts with specific tag IDs.'
44
+ }
45
45
  ],
46
- handler: this.handleListPosts.bind(this),
46
+ handler: this.handleListPosts.bind(this)
47
47
  },
48
48
  {
49
- name: "wp_get_post",
50
- description: "Retrieves a single post by its ID.",
49
+ name: 'wp_get_post',
50
+ description: 'Retrieves a single post by its ID.',
51
51
  parameters: [
52
52
  {
53
- name: "id",
54
- type: "number",
53
+ name: 'id',
54
+ type: 'number',
55
55
  required: true,
56
- description: "The unique identifier for the post.",
57
- },
56
+ description: 'The unique identifier for the post.'
57
+ }
58
58
  ],
59
- handler: this.handleGetPost.bind(this),
59
+ handler: this.handleGetPost.bind(this)
60
60
  },
61
61
  {
62
- name: "wp_create_post",
63
- description: "Creates a new post.",
62
+ name: 'wp_create_post',
63
+ description: 'Creates a new post.',
64
64
  parameters: [
65
65
  {
66
- name: "title",
67
- type: "string",
66
+ name: 'title',
67
+ type: 'string',
68
68
  required: true,
69
- description: "The title for the post.",
69
+ description: 'The title for the post.'
70
70
  },
71
71
  {
72
- name: "content",
73
- type: "string",
74
- description: "The content for the post, in HTML format.",
72
+ name: 'content',
73
+ type: 'string',
74
+ description: 'The content for the post, in HTML format.'
75
75
  },
76
76
  {
77
- name: "status",
78
- type: "string",
79
- description: "The publishing status for the post.",
80
- enum: ["publish", "draft", "pending", "private"],
77
+ name: 'status',
78
+ type: 'string',
79
+ description: 'The publishing status for the post.',
80
+ enum: ['publish', 'draft', 'pending', 'private']
81
81
  },
82
82
  {
83
- name: "excerpt",
84
- type: "string",
85
- description: "The excerpt for the post.",
83
+ name: 'excerpt',
84
+ type: 'string',
85
+ description: 'The excerpt for the post.'
86
86
  },
87
87
  {
88
- name: "categories",
89
- type: "array",
90
- items: { type: "number" },
91
- description: "An array of category IDs to assign to the post.",
88
+ name: 'categories',
89
+ type: 'array',
90
+ items: { type: 'number' },
91
+ description: 'An array of category IDs to assign to the post.'
92
92
  },
93
93
  {
94
- name: "tags",
95
- type: "array",
96
- items: { type: "number" },
97
- description: "An array of tag IDs to assign to the post.",
98
- },
94
+ name: 'tags',
95
+ type: 'array',
96
+ items: { type: 'number' },
97
+ description: 'An array of tag IDs to assign to the post.'
98
+ }
99
99
  ],
100
- handler: this.handleCreatePost.bind(this),
100
+ handler: this.handleCreatePost.bind(this)
101
101
  },
102
102
  {
103
- name: "wp_update_post",
104
- description: "Updates an existing post.",
103
+ name: 'wp_update_post',
104
+ description: 'Updates an existing post.',
105
105
  parameters: [
106
106
  {
107
- name: "id",
108
- type: "number",
107
+ name: 'id',
108
+ type: 'number',
109
109
  required: true,
110
- description: "The ID of the post to update.",
110
+ description: 'The ID of the post to update.'
111
111
  },
112
112
  {
113
- name: "title",
114
- type: "string",
115
- description: "The new title for the post.",
113
+ name: 'title',
114
+ type: 'string',
115
+ description: 'The new title for the post.'
116
116
  },
117
117
  {
118
- name: "content",
119
- type: "string",
120
- description: "The new content for the post, in HTML format.",
118
+ name: 'content',
119
+ type: 'string',
120
+ description: 'The new content for the post, in HTML format.'
121
121
  },
122
122
  {
123
- name: "status",
124
- type: "string",
125
- description: "The new status for the post.",
126
- enum: ["publish", "draft", "pending", "private"],
127
- },
123
+ name: 'status',
124
+ type: 'string',
125
+ description: 'The new status for the post.',
126
+ enum: ['publish', 'draft', 'pending', 'private']
127
+ }
128
128
  ],
129
- handler: this.handleUpdatePost.bind(this),
129
+ handler: this.handleUpdatePost.bind(this)
130
130
  },
131
131
  {
132
- name: "wp_delete_post",
133
- description: "Deletes a post.",
132
+ name: 'wp_delete_post',
133
+ description: 'Deletes a post.',
134
134
  parameters: [
135
135
  {
136
- name: "id",
137
- type: "number",
136
+ name: 'id',
137
+ type: 'number',
138
138
  required: true,
139
- description: "The ID of the post to delete.",
139
+ description: 'The ID of the post to delete.'
140
140
  },
141
141
  {
142
- name: "force",
143
- type: "boolean",
144
- description: "If true, permanently delete. If false, move to trash. Defaults to false.",
145
- },
142
+ name: 'force',
143
+ type: 'boolean',
144
+ description: 'If true, permanently delete. If false, move to trash. Defaults to false.'
145
+ }
146
146
  ],
147
- handler: this.handleDeletePost.bind(this),
147
+ handler: this.handleDeletePost.bind(this)
148
148
  },
149
149
  {
150
- name: "wp_get_post_revisions",
151
- description: "Retrieves revisions for a specific post.",
150
+ name: 'wp_get_post_revisions',
151
+ description: 'Retrieves revisions for a specific post.',
152
152
  parameters: [
153
153
  {
154
- name: "id",
155
- type: "number",
154
+ name: 'id',
155
+ type: 'number',
156
156
  required: true,
157
- description: "The ID of the post to get revisions for.",
158
- },
157
+ description: 'The ID of the post to get revisions for.'
158
+ }
159
159
  ],
160
- handler: this.handleGetPostRevisions.bind(this),
161
- },
160
+ handler: this.handleGetPostRevisions.bind(this)
161
+ }
162
162
  ];
163
163
  }
164
164
  async handleListPosts(client, params) {
165
165
  try {
166
166
  const posts = await client.getPosts(params);
167
167
  if (posts.length === 0) {
168
- return "No posts found matching the criteria.";
168
+ return 'No posts found matching the criteria.';
169
169
  }
170
170
  const content = `Found ${posts.length} posts:\n\n` +
171
171
  posts
172
172
  .map((p) => `- ID ${p.id}: **${p.title.rendered}** (${p.status})\n Link: ${p.link}`)
173
- .join("\n");
173
+ .join('\n');
174
174
  return content;
175
175
  }
176
176
  catch (error) {
@@ -212,7 +212,7 @@ export class PostTools {
212
212
  async handleDeletePost(client, params) {
213
213
  try {
214
214
  await client.deletePost(params.id, params.force);
215
- const action = params.force ? "permanently deleted" : "moved to trash";
215
+ const action = params.force ? 'permanently deleted' : 'moved to trash';
216
216
  return `✅ Post ${params.id} has been ${action}.`;
217
217
  }
218
218
  catch (error) {
@@ -228,7 +228,7 @@ export class PostTools {
228
228
  const content = `Found ${revisions.length} revisions for post ${params.id}:\n\n` +
229
229
  revisions
230
230
  .map((r) => `- Revision by user ID ${r.author} at ${new Date(r.modified).toLocaleString()}`)
231
- .join("\n");
231
+ .join('\n');
232
232
  return content;
233
233
  }
234
234
  catch (error) {
@@ -1,4 +1,4 @@
1
- import { WordPressClient } from "../client/api.js";
1
+ import { WordPressClient } from '../client/api.js';
2
2
  /**
3
3
  * Provides tools for managing general site settings and operations on a WordPress site.
4
4
  * This class encapsulates tool definitions and their corresponding handlers.
@@ -13,7 +13,7 @@ export declare class SiteTools {
13
13
  handleUpdateSiteSettings(client: WordPressClient, params: any): Promise<any>;
14
14
  handleSearchSite(client: WordPressClient, params: {
15
15
  term: string;
16
- type?: "posts" | "pages" | "media";
16
+ type?: 'posts' | 'pages' | 'media';
17
17
  }): Promise<any>;
18
18
  handleGetApplicationPasswords(client: WordPressClient, params: {
19
19
  user_id: number;