@respira/wordpress-mcp-server 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,413 @@
1
+ /**
2
+ * WordPress API Client
3
+ *
4
+ * Handles all HTTP requests to WordPress REST API
5
+ */
6
+ import axios from 'axios';
7
+ export class WordPressClient {
8
+ client;
9
+ siteConfig;
10
+ constructor(siteConfig) {
11
+ this.siteConfig = siteConfig;
12
+ this.client = axios.create({
13
+ baseURL: `${siteConfig.url}/wp-json/respira/v1`,
14
+ headers: {
15
+ 'X-Respira-API-Key': siteConfig.apiKey,
16
+ 'Content-Type': 'application/json',
17
+ },
18
+ timeout: 30000,
19
+ });
20
+ // Add response interceptor for error handling
21
+ this.client.interceptors.response.use((response) => response, (error) => {
22
+ return Promise.reject(this.handleError(error));
23
+ });
24
+ }
25
+ /**
26
+ * Handle API errors with retry logic and format error messages with instructions
27
+ */
28
+ async handleError(error) {
29
+ if (error.response) {
30
+ const status = error.response.status;
31
+ const data = error.response.data;
32
+ // Handle specific error codes
33
+ if (status === 401) {
34
+ return new Error(`Authentication failed: Invalid API key`);
35
+ }
36
+ else if (status === 429) {
37
+ return new Error(`Rate limit exceeded. Please wait before making more requests.`);
38
+ }
39
+ else if (status === 403) {
40
+ // Format error with instructions if available
41
+ return this.formatErrorWithInstructions(data);
42
+ }
43
+ else if (status >= 500) {
44
+ return new Error(`WordPress server error (${status}): ${data.message || 'Internal server error'}`);
45
+ }
46
+ // Check if error has instructions data
47
+ if (data.data && (data.data.instructions || data.data.links)) {
48
+ return this.formatErrorWithInstructions(data);
49
+ }
50
+ return new Error(`API error (${status}): ${data.message || error.message}`);
51
+ }
52
+ else if (error.request) {
53
+ return new Error(`Network error: Could not connect to WordPress site at ${this.siteConfig.url}`);
54
+ }
55
+ return new Error(`Unknown error: ${error.message}`);
56
+ }
57
+ /**
58
+ * Format error message with instructions and links
59
+ */
60
+ formatErrorWithInstructions(data) {
61
+ const message = data.message || 'Permission denied';
62
+ const errorData = data.data || {};
63
+ const instructions = errorData.instructions || {};
64
+ const links = errorData.links || {};
65
+ const duplicateId = errorData.duplicate_id;
66
+ const originalId = errorData.original_id;
67
+ let formattedMessage = `${message}\n\n`;
68
+ // Add instructions
69
+ if (Object.keys(instructions).length > 0) {
70
+ formattedMessage += 'Instructions:\n';
71
+ Object.values(instructions).forEach((instruction) => {
72
+ formattedMessage += `• ${instruction}\n`;
73
+ });
74
+ formattedMessage += '\n';
75
+ }
76
+ // Add links
77
+ if (Object.keys(links).length > 0) {
78
+ formattedMessage += 'Links:\n';
79
+ if (links.edit_duplicate && duplicateId) {
80
+ formattedMessage += `• Edit Duplicate (ID: ${duplicateId}): ${links.edit_duplicate}\n`;
81
+ }
82
+ if (links.duplicate_endpoint && originalId) {
83
+ formattedMessage += `• Create Duplicate: ${links.duplicate_endpoint}\n`;
84
+ }
85
+ if (links.approvals_page) {
86
+ formattedMessage += `• Approvals Page: ${links.approvals_page}\n`;
87
+ }
88
+ if (links.settings_page) {
89
+ formattedMessage += `• Settings: ${links.settings_page}\n`;
90
+ }
91
+ formattedMessage += '\n';
92
+ }
93
+ // Add helpful note if duplicate exists
94
+ if (duplicateId) {
95
+ formattedMessage += `Note: A duplicate already exists (ID: ${duplicateId}). You can edit it directly or approve it in WordPress admin.\n`;
96
+ }
97
+ else if (originalId) {
98
+ formattedMessage += `Note: Create a duplicate of page/post ID ${originalId} first, then edit the duplicate.\n`;
99
+ }
100
+ return new Error(formattedMessage.trim());
101
+ }
102
+ /**
103
+ * Get site context information
104
+ */
105
+ async getSiteContext() {
106
+ const response = await this.client.get('/context/site-info');
107
+ return response.data;
108
+ }
109
+ /**
110
+ * Get theme documentation
111
+ */
112
+ async getThemeDocs() {
113
+ const response = await this.client.get('/context/theme-docs');
114
+ return response.data;
115
+ }
116
+ /**
117
+ * Get page builder information
118
+ */
119
+ async getBuilderInfo() {
120
+ const response = await this.client.get('/context/builder-info');
121
+ return response.data;
122
+ }
123
+ /**
124
+ * List pages
125
+ */
126
+ async listPages(filters) {
127
+ const response = await this.client.get('/pages', { params: filters });
128
+ return response.data;
129
+ }
130
+ /**
131
+ * Get a single page
132
+ */
133
+ async getPage(id) {
134
+ const response = await this.client.get(`/pages/${id}`);
135
+ return response.data;
136
+ }
137
+ /**
138
+ * Duplicate a page
139
+ */
140
+ async duplicatePage(id, suffix) {
141
+ const response = await this.client.post(`/pages/${id}/duplicate`, { suffix });
142
+ return response.data.duplicate;
143
+ }
144
+ /**
145
+ * Update a page
146
+ */
147
+ async updatePage(id, data) {
148
+ // Try PUT first, fall back to POST for compatibility
149
+ let response;
150
+ try {
151
+ response = await this.client.put(`/pages/${id}`, data);
152
+ }
153
+ catch (error) {
154
+ // If PUT fails with 404, try POST (for compatibility)
155
+ if (error.response?.status === 404) {
156
+ response = await this.client.post(`/pages/${id}`, data);
157
+ }
158
+ else {
159
+ throw error;
160
+ }
161
+ }
162
+ // Check if duplicate was created and format message accordingly
163
+ if (response.data.duplicate_created) {
164
+ const duplicateId = response.data.duplicate_id;
165
+ const originalId = response.data.original_id;
166
+ const approvalUrl = response.data.approval_url;
167
+ // The message is already formatted by Respira, but we can add context
168
+ const respiraMessage = response.data.message || '';
169
+ const instructions = response.data.instructions || [];
170
+ // Return the page data but note that it's a duplicate
171
+ const page = response.data.page;
172
+ if (page) {
173
+ page.__respira_duplicate_info = {
174
+ duplicate_created: true,
175
+ duplicate_id: duplicateId,
176
+ original_id: originalId,
177
+ approval_url: approvalUrl,
178
+ message: respiraMessage,
179
+ instructions: instructions,
180
+ };
181
+ }
182
+ }
183
+ return response.data.page;
184
+ }
185
+ /**
186
+ * Delete a page
187
+ */
188
+ async deletePage(id, force) {
189
+ await this.client.delete(`/pages/${id}`, { params: { force } });
190
+ }
191
+ /**
192
+ * List posts
193
+ */
194
+ async listPosts(filters) {
195
+ const response = await this.client.get('/posts', { params: filters });
196
+ return response.data;
197
+ }
198
+ /**
199
+ * Get a single post
200
+ */
201
+ async getPost(id) {
202
+ const response = await this.client.get(`/posts/${id}`);
203
+ return response.data;
204
+ }
205
+ /**
206
+ * Duplicate a post
207
+ */
208
+ async duplicatePost(id, suffix) {
209
+ const response = await this.client.post(`/posts/${id}/duplicate`, { suffix });
210
+ return response.data.duplicate;
211
+ }
212
+ /**
213
+ * Update a post
214
+ */
215
+ async updatePost(id, data) {
216
+ // Try PUT first, fall back to POST for compatibility
217
+ let response;
218
+ try {
219
+ response = await this.client.put(`/posts/${id}`, data);
220
+ }
221
+ catch (error) {
222
+ // If PUT fails with 404, try POST (for compatibility)
223
+ if (error.response?.status === 404) {
224
+ response = await this.client.post(`/posts/${id}`, data);
225
+ }
226
+ else {
227
+ throw error;
228
+ }
229
+ }
230
+ // Check if duplicate was created and format message accordingly
231
+ if (response.data.duplicate_created) {
232
+ const duplicateId = response.data.duplicate_id;
233
+ const originalId = response.data.original_id;
234
+ const approvalUrl = response.data.approval_url;
235
+ // The message is already formatted by Respira, but we can add context
236
+ const respiraMessage = response.data.message || '';
237
+ const instructions = response.data.instructions || [];
238
+ // Return the post data but note that it's a duplicate
239
+ const post = response.data.post;
240
+ if (post) {
241
+ post.__respira_duplicate_info = {
242
+ duplicate_created: true,
243
+ duplicate_id: duplicateId,
244
+ original_id: originalId,
245
+ approval_url: approvalUrl,
246
+ message: respiraMessage,
247
+ instructions: instructions,
248
+ };
249
+ }
250
+ }
251
+ return response.data.post;
252
+ }
253
+ /**
254
+ * Delete a post
255
+ */
256
+ async deletePost(id, force) {
257
+ await this.client.delete(`/posts/${id}`, { params: { force } });
258
+ }
259
+ /**
260
+ * List media
261
+ */
262
+ async listMedia(filters) {
263
+ const response = await this.client.get('/media', { params: filters });
264
+ return response.data;
265
+ }
266
+ /**
267
+ * Upload media
268
+ */
269
+ async uploadMedia(file, filename, mimeType) {
270
+ const formData = new FormData();
271
+ formData.append('file', new Blob([file], { type: mimeType }), filename);
272
+ const response = await this.client.post('/media/upload', formData, {
273
+ headers: {
274
+ 'Content-Type': 'multipart/form-data',
275
+ },
276
+ });
277
+ return response.data.media;
278
+ }
279
+ /**
280
+ * Extract page builder content
281
+ */
282
+ async extractBuilderContent(builder, pageId) {
283
+ const response = await this.client.get(`/builder/${builder}/extract/${pageId}`);
284
+ return response.data.content;
285
+ }
286
+ /**
287
+ * Inject page builder content
288
+ */
289
+ async injectBuilderContent(builder, pageId, content) {
290
+ await this.client.post(`/builder/${builder}/inject/${pageId}`, { content });
291
+ }
292
+ /**
293
+ * Validate content security
294
+ */
295
+ async validateSecurity(content) {
296
+ const response = await this.client.post('/validate/security', { content });
297
+ return response.data;
298
+ }
299
+ /**
300
+ * Get site name (for logging)
301
+ */
302
+ getSiteName() {
303
+ return this.siteConfig.name;
304
+ }
305
+ /**
306
+ * Get site URL
307
+ */
308
+ getSiteUrl() {
309
+ return this.siteConfig.url;
310
+ }
311
+ /**
312
+ * Analyze page performance
313
+ */
314
+ async analyzePerformance(pageId) {
315
+ const response = await this.client.get(`/analyze/performance/${pageId}`);
316
+ return response.data;
317
+ }
318
+ /**
319
+ * Get Core Web Vitals
320
+ */
321
+ async getCoreWebVitals(pageId) {
322
+ const response = await this.client.get(`/analyze/core-web-vitals/${pageId}`);
323
+ return response.data;
324
+ }
325
+ /**
326
+ * Analyze images on a page
327
+ */
328
+ async analyzeImages(pageId) {
329
+ const response = await this.client.get(`/analyze/images/${pageId}`);
330
+ return response.data;
331
+ }
332
+ /**
333
+ * Analyze SEO for a page
334
+ */
335
+ async analyzeSEO(pageId) {
336
+ const response = await this.client.get(`/analyze/seo/${pageId}`);
337
+ return response.data;
338
+ }
339
+ /**
340
+ * Check SEO issues for a page
341
+ */
342
+ async checkSEOIssues(pageId) {
343
+ const response = await this.client.get(`/analyze/seo-issues/${pageId}`);
344
+ return response.data;
345
+ }
346
+ /**
347
+ * Analyze readability for a page
348
+ */
349
+ async analyzeReadability(pageId) {
350
+ const response = await this.client.get(`/analyze/readability/${pageId}`);
351
+ return response.data;
352
+ }
353
+ /**
354
+ * Analyze AEO for a page
355
+ */
356
+ async analyzeAEO(pageId) {
357
+ const response = await this.client.get(`/analyze/aeo/${pageId}`);
358
+ return response.data;
359
+ }
360
+ /**
361
+ * Check structured data for a page
362
+ */
363
+ async checkStructuredData(pageId) {
364
+ const response = await this.client.get(`/analyze/structured-data/${pageId}`);
365
+ return response.data;
366
+ }
367
+ /**
368
+ * List all plugins (EXPERIMENTAL)
369
+ */
370
+ async listPlugins() {
371
+ const response = await this.client.get('/plugins');
372
+ return response.data;
373
+ }
374
+ /**
375
+ * Install a plugin (EXPERIMENTAL)
376
+ */
377
+ async installPlugin(slugOrUrl, source = 'wordpress.org') {
378
+ const response = await this.client.post('/plugins/install', {
379
+ slug_or_url: slugOrUrl,
380
+ source,
381
+ });
382
+ return response.data;
383
+ }
384
+ /**
385
+ * Activate a plugin (EXPERIMENTAL)
386
+ */
387
+ async activatePlugin(slug) {
388
+ const response = await this.client.post(`/plugins/${slug}/activate`);
389
+ return response.data;
390
+ }
391
+ /**
392
+ * Deactivate a plugin (EXPERIMENTAL)
393
+ */
394
+ async deactivatePlugin(slug) {
395
+ const response = await this.client.post(`/plugins/${slug}/deactivate`);
396
+ return response.data;
397
+ }
398
+ /**
399
+ * Update a plugin (EXPERIMENTAL)
400
+ */
401
+ async updatePlugin(slug) {
402
+ const response = await this.client.post(`/plugins/${slug}/update`);
403
+ return response.data;
404
+ }
405
+ /**
406
+ * Delete a plugin (EXPERIMENTAL)
407
+ */
408
+ async deletePlugin(slug) {
409
+ const response = await this.client.delete(`/plugins/${slug}`);
410
+ return response.data;
411
+ }
412
+ }
413
+ //# sourceMappingURL=wordpress-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wordpress-client.js","sourceRoot":"","sources":["../src/wordpress-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,MAAM,OAAO,eAAe;IAClB,MAAM,CAAgB;IACtB,UAAU,CAAsB;IAExC,YAAY,UAA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O,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@respira/wordpress-mcp-server",
3
+ "version": "1.4.0",
4
+ "description": "MCP server for connecting AI coding assistants to WordPress sites",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "respira-wordpress-mcp": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist/**/*",
11
+ "README.md",
12
+ "package.json"
13
+ ],
14
+ "type": "module",
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "watch": "tsc --watch",
18
+ "start": "node dist/index.js",
19
+ "dev": "tsc && node dist/index.js",
20
+ "lint": "eslint src --ext .ts",
21
+ "format": "prettier --write \"src/**/*.ts\"",
22
+ "clean": "rm -rf dist"
23
+ },
24
+ "keywords": [
25
+ "mcp",
26
+ "wordpress",
27
+ "ai",
28
+ "cursor",
29
+ "claude-code"
30
+ ],
31
+ "author": "Respira",
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^0.5.0",
35
+ "@sentry/node": "^10.25.0",
36
+ "@sentry/profiling-node": "^10.25.0",
37
+ "axios": "^1.6.0",
38
+ "dotenv": "^16.3.1"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^20.10.0",
42
+ "@typescript-eslint/eslint-plugin": "^6.13.0",
43
+ "@typescript-eslint/parser": "^6.13.0",
44
+ "eslint": "^8.54.0",
45
+ "prettier": "^3.1.0",
46
+ "typescript": "^5.3.0"
47
+ },
48
+ "engines": {
49
+ "node": ">=18.0.0"
50
+ }
51
+ }