@adsim/wordpress-mcp-server 4.5.0 → 4.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adsim/wordpress-mcp-server",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "A Model Context Protocol (MCP) server for WordPress REST API integration. Manage posts, search content, and interact with your WordPress site through any MCP-compatible client.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,136 @@
1
+ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+
3
+ vi.mock('node-fetch', () => ({ default: vi.fn() }));
4
+
5
+ import fetch from 'node-fetch';
6
+ import { handleToolCall, getFilteredTools } from '../../../index.js';
7
+ import { makeRequest, mockSuccess, mockError, parseResult } from '../../helpers/mockWpRequest.js';
8
+
9
+ function call(name, args = {}) {
10
+ return handleToolCall(makeRequest(name, args));
11
+ }
12
+
13
+ let consoleSpy;
14
+ const envBackup = {};
15
+
16
+ function saveEnv(...keys) {
17
+ keys.forEach(k => { envBackup[k] = process.env[k]; });
18
+ }
19
+ function restoreEnv() {
20
+ Object.entries(envBackup).forEach(([k, v]) => {
21
+ if (v === undefined) delete process.env[k];
22
+ else process.env[k] = v;
23
+ });
24
+ }
25
+
26
+ beforeEach(() => {
27
+ fetch.mockReset();
28
+ consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
29
+ saveEnv('WC_CONSUMER_KEY', 'WP_REQUIRE_APPROVAL', 'WP_ENABLE_PLUGIN_INTELLIGENCE');
30
+ // Default: all optional features OFF
31
+ delete process.env.WC_CONSUMER_KEY;
32
+ delete process.env.WP_REQUIRE_APPROVAL;
33
+ delete process.env.WP_ENABLE_PLUGIN_INTELLIGENCE;
34
+ });
35
+ afterEach(() => {
36
+ consoleSpy.mockRestore();
37
+ restoreEnv();
38
+ });
39
+
40
+ // =========================================================================
41
+ // WooCommerce filtering
42
+ // =========================================================================
43
+
44
+ describe('WooCommerce filtering', () => {
45
+ it('hides WooCommerce tools when WC_CONSUMER_KEY absent', () => {
46
+ const tools = getFilteredTools();
47
+ const wcTools = tools.filter(t => t.name.startsWith('wc_'));
48
+ expect(wcTools).toHaveLength(0);
49
+ });
50
+
51
+ it('shows WooCommerce tools when WC_CONSUMER_KEY set', () => {
52
+ process.env.WC_CONSUMER_KEY = 'ck_test';
53
+ const tools = getFilteredTools();
54
+ const wcTools = tools.filter(t => t.name.startsWith('wc_'));
55
+ expect(wcTools.length).toBe(13);
56
+ });
57
+ });
58
+
59
+ // =========================================================================
60
+ // Editorial workflow filtering
61
+ // =========================================================================
62
+
63
+ describe('Editorial workflow filtering', () => {
64
+ it('hides editorial tools when WP_REQUIRE_APPROVAL not true', () => {
65
+ const tools = getFilteredTools();
66
+ const names = tools.map(t => t.name);
67
+ expect(names).not.toContain('wp_submit_for_review');
68
+ expect(names).not.toContain('wp_approve_post');
69
+ expect(names).not.toContain('wp_reject_post');
70
+ });
71
+
72
+ it('shows editorial tools when WP_REQUIRE_APPROVAL=true', () => {
73
+ process.env.WP_REQUIRE_APPROVAL = 'true';
74
+ const tools = getFilteredTools();
75
+ const names = tools.map(t => t.name);
76
+ expect(names).toContain('wp_submit_for_review');
77
+ expect(names).toContain('wp_approve_post');
78
+ expect(names).toContain('wp_reject_post');
79
+ });
80
+ });
81
+
82
+ // =========================================================================
83
+ // Plugin Intelligence filtering
84
+ // =========================================================================
85
+
86
+ describe('Plugin Intelligence filtering', () => {
87
+ it('hides Plugin Intelligence when WP_ENABLE_PLUGIN_INTELLIGENCE not true', () => {
88
+ const tools = getFilteredTools();
89
+ const names = tools.map(t => t.name);
90
+ expect(names).not.toContain('wp_get_rendered_head');
91
+ expect(names).not.toContain('wp_audit_schema_plugins');
92
+ expect(names).not.toContain('wp_get_twitter_meta');
93
+ });
94
+
95
+ it('shows Plugin Intelligence when WP_ENABLE_PLUGIN_INTELLIGENCE=true', () => {
96
+ process.env.WP_ENABLE_PLUGIN_INTELLIGENCE = 'true';
97
+ const tools = getFilteredTools();
98
+ const piNames = ['wp_get_rendered_head', 'wp_audit_rendered_seo', 'wp_get_pillar_content', 'wp_audit_schema_plugins', 'wp_get_seo_score', 'wp_get_twitter_meta'];
99
+ const names = tools.map(t => t.name);
100
+ piNames.forEach(n => expect(names).toContain(n));
101
+ });
102
+ });
103
+
104
+ // =========================================================================
105
+ // Combined counts
106
+ // =========================================================================
107
+
108
+ describe('Combined filtering counts', () => {
109
+ it('returns all 85 tools when all features enabled', () => {
110
+ process.env.WC_CONSUMER_KEY = 'ck_test';
111
+ process.env.WP_REQUIRE_APPROVAL = 'true';
112
+ process.env.WP_ENABLE_PLUGIN_INTELLIGENCE = 'true';
113
+ expect(getFilteredTools()).toHaveLength(85);
114
+ });
115
+
116
+ it('returns 63 tools with no optional features (85 - 13wc - 3editorial - 6pi)', () => {
117
+ expect(getFilteredTools()).toHaveLength(63);
118
+ });
119
+ });
120
+
121
+ // =========================================================================
122
+ // handleToolCall still works for filtered-out tools
123
+ // =========================================================================
124
+
125
+ describe('Filtered tools remain callable', () => {
126
+ it('handleToolCall works for a filtered-out WooCommerce tool (wc_list_products)', async () => {
127
+ // WC_CONSUMER_KEY is absent, so wc_list_products is filtered from listTools
128
+ const names = getFilteredTools().map(t => t.name);
129
+ expect(names).not.toContain('wc_list_products');
130
+
131
+ // But calling it directly should NOT throw "Unknown tool"
132
+ // It will fail with a WooCommerce credentials error, which is fine
133
+ const res = await call('wc_list_products');
134
+ expect(res.content[0].text).not.toContain('Unknown tool');
135
+ });
136
+ });
@@ -0,0 +1,342 @@
1
+ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+
3
+ vi.mock('node-fetch', () => ({ default: vi.fn() }));
4
+
5
+ import fetch from 'node-fetch';
6
+ import { handleToolCall } from '../../../index.js';
7
+ import { mockSuccess, makeRequest, parseResult } from '../../helpers/mockWpRequest.js';
8
+
9
+ function call(name, args = {}) {
10
+ return handleToolCall(makeRequest(name, args));
11
+ }
12
+
13
+ let consoleSpy;
14
+ beforeEach(() => { fetch.mockReset(); consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); });
15
+ afterEach(() => { consoleSpy.mockRestore(); });
16
+
17
+ // ── Mock data factories ──
18
+
19
+ const mockPage = { id: 10, title: { rendered: 'About' }, slug: 'about', status: 'publish', date: '2024-01-01', link: 'https://test.example.com/about', parent: 0, menu_order: 1, template: '', excerpt: { rendered: 'About page' } };
20
+
21
+ const mockMedia = { id: 1, title: { rendered: 'Logo' }, date: '2024-01-01', mime_type: 'image/png', source_url: 'https://test.example.com/logo.png', alt_text: 'Site logo', media_details: { width: 200, height: 100 } };
22
+
23
+ const mockComment = { id: 100, post: 5, parent: 0, author_name: 'Alice', date: '2024-02-01', status: 'approved', content: { rendered: '<p>Great post!</p>' }, link: 'https://test.example.com/post#comment-100' };
24
+
25
+ const mockCategory = { id: 5, name: 'Tech', slug: 'tech', description: 'Tech articles', parent: 0, count: 12 };
26
+
27
+ const mockTag = { id: 7, name: 'javascript', slug: 'javascript', count: 8 };
28
+
29
+ const mockUser = { id: 1, name: 'Admin', slug: 'admin', link: 'https://test.example.com/author/admin', roles: ['administrator'], avatar_urls: { '96': 'https://test.example.com/avatar.jpg' } };
30
+
31
+ const mockCustomPost = { id: 42, title: { rendered: 'Portfolio Item' }, slug: 'portfolio-item', status: 'publish', date: '2024-03-01', link: 'https://test.example.com/portfolio/portfolio-item', type: 'portfolio', meta: {} };
32
+
33
+ const mockPlugin = { plugin: 'akismet/akismet.php', name: 'Akismet', version: '5.3', status: 'active', author: { rendered: 'Automattic' }, description: { rendered: 'Anti-spam' }, plugin_uri: 'https://akismet.com', requires_wp: '6.0', requires_php: '7.4', network_only: false, textdomain: 'akismet' };
34
+
35
+ const mockTheme = { stylesheet: 'twentytwentyfour', template: 'twentytwentyfour', name: { rendered: 'Twenty Twenty-Four' }, description: { rendered: 'Default theme' }, status: 'active', version: '1.2', author: { rendered: 'WordPress' }, author_uri: '', theme_uri: '', requires_wp: '6.4', requires_php: '7.0', tags: { rendered: ['blog'] } };
36
+
37
+ const mockRevision = { id: 200, parent: 5, date: '2024-04-01', date_gmt: '2024-04-01T00:00:00', modified: '2024-04-01', modified_gmt: '2024-04-01T00:00:00', author: 1, title: { rendered: 'Draft v2' }, excerpt: { rendered: 'Updated excerpt' }, slug: '5-revision-v1' };
38
+
39
+ const mockTypes = { portfolio: { slug: 'portfolio', name: 'Portfolio', rest_base: 'portfolio' } };
40
+
41
+ // =========================================================================
42
+ // wp_list_pages
43
+ // =========================================================================
44
+
45
+ describe('wp_list_pages — output compression', () => {
46
+ it('mode=ids_only returns flat ID array', async () => {
47
+ fetch.mockResolvedValue(mockSuccess([mockPage]));
48
+ const data = parseResult(await call('wp_list_pages', { mode: 'ids_only' }));
49
+ expect(data.mode).toBe('ids_only');
50
+ expect(data.ids).toEqual([10]);
51
+ expect(data.pages).toBeUndefined();
52
+ });
53
+
54
+ it('mode=summary returns compact object with expected keys', async () => {
55
+ fetch.mockResolvedValue(mockSuccess([mockPage]));
56
+ const data = parseResult(await call('wp_list_pages', { mode: 'summary' }));
57
+ expect(data.mode).toBe('summary');
58
+ expect(data.pages[0]).toEqual({ id: 10, title: 'About', slug: 'about', status: 'publish', link: 'https://test.example.com/about', parent: 0 });
59
+ expect(data.pages[0].menu_order).toBeUndefined();
60
+ });
61
+
62
+ it('mode=full (default) returns full format', async () => {
63
+ fetch.mockResolvedValue(mockSuccess([mockPage]));
64
+ const data = parseResult(await call('wp_list_pages'));
65
+ expect(data.mode).toBeUndefined();
66
+ expect(data.pages[0].menu_order).toBe(1);
67
+ expect(data.pages[0].template).toBe('');
68
+ });
69
+ });
70
+
71
+ // =========================================================================
72
+ // wp_list_media
73
+ // =========================================================================
74
+
75
+ describe('wp_list_media — output compression', () => {
76
+ it('mode=ids_only returns flat ID array', async () => {
77
+ fetch.mockResolvedValue(mockSuccess([mockMedia]));
78
+ const data = parseResult(await call('wp_list_media', { mode: 'ids_only' }));
79
+ expect(data.mode).toBe('ids_only');
80
+ expect(data.ids).toEqual([1]);
81
+ expect(data.media).toBeUndefined();
82
+ });
83
+
84
+ it('mode=summary returns compact object with expected keys', async () => {
85
+ fetch.mockResolvedValue(mockSuccess([mockMedia]));
86
+ const data = parseResult(await call('wp_list_media', { mode: 'summary' }));
87
+ expect(data.mode).toBe('summary');
88
+ expect(data.media[0]).toEqual({ id: 1, title: 'Logo', mime_type: 'image/png', source_url: 'https://test.example.com/logo.png', alt_text: 'Site logo' });
89
+ expect(data.media[0].width).toBeUndefined();
90
+ });
91
+
92
+ it('mode=full (default) returns full format', async () => {
93
+ fetch.mockResolvedValue(mockSuccess([mockMedia]));
94
+ const data = parseResult(await call('wp_list_media'));
95
+ expect(data.mode).toBeUndefined();
96
+ expect(data.media[0].width).toBe(200);
97
+ expect(data.media[0].height).toBe(100);
98
+ });
99
+ });
100
+
101
+ // =========================================================================
102
+ // wp_list_comments
103
+ // =========================================================================
104
+
105
+ describe('wp_list_comments — output compression', () => {
106
+ it('mode=ids_only returns flat ID array', async () => {
107
+ fetch.mockResolvedValue(mockSuccess([mockComment]));
108
+ const data = parseResult(await call('wp_list_comments', { mode: 'ids_only' }));
109
+ expect(data.mode).toBe('ids_only');
110
+ expect(data.ids).toEqual([100]);
111
+ expect(data.comments).toBeUndefined();
112
+ });
113
+
114
+ it('mode=summary returns compact object with expected keys', async () => {
115
+ fetch.mockResolvedValue(mockSuccess([mockComment]));
116
+ const data = parseResult(await call('wp_list_comments', { mode: 'summary' }));
117
+ expect(data.mode).toBe('summary');
118
+ expect(data.comments[0]).toEqual({ id: 100, post: 5, author_name: 'Alice', date: '2024-02-01', status: 'approved' });
119
+ expect(data.comments[0].content).toBeUndefined();
120
+ });
121
+
122
+ it('mode=full (default) returns full format', async () => {
123
+ fetch.mockResolvedValue(mockSuccess([mockComment]));
124
+ const data = parseResult(await call('wp_list_comments'));
125
+ expect(data.mode).toBeUndefined();
126
+ expect(data.comments[0].content).toBeDefined();
127
+ expect(data.comments[0].link).toBeDefined();
128
+ });
129
+ });
130
+
131
+ // =========================================================================
132
+ // wp_list_categories
133
+ // =========================================================================
134
+
135
+ describe('wp_list_categories — output compression', () => {
136
+ it('mode=ids_only returns flat ID array', async () => {
137
+ fetch.mockResolvedValue(mockSuccess([mockCategory]));
138
+ const data = parseResult(await call('wp_list_categories', { mode: 'ids_only' }));
139
+ expect(data.mode).toBe('ids_only');
140
+ expect(data.ids).toEqual([5]);
141
+ expect(data.categories).toBeUndefined();
142
+ });
143
+
144
+ it('mode=summary returns compact object with expected keys', async () => {
145
+ fetch.mockResolvedValue(mockSuccess([mockCategory]));
146
+ const data = parseResult(await call('wp_list_categories', { mode: 'summary' }));
147
+ expect(data.mode).toBe('summary');
148
+ expect(data.categories[0]).toEqual({ id: 5, name: 'Tech', slug: 'tech', count: 12, parent: 0 });
149
+ expect(data.categories[0].description).toBeUndefined();
150
+ });
151
+
152
+ it('mode=full (default) returns full format', async () => {
153
+ fetch.mockResolvedValue(mockSuccess([mockCategory]));
154
+ const data = parseResult(await call('wp_list_categories'));
155
+ expect(data.mode).toBeUndefined();
156
+ expect(data.categories[0].description).toBe('Tech articles');
157
+ });
158
+ });
159
+
160
+ // =========================================================================
161
+ // wp_list_tags
162
+ // =========================================================================
163
+
164
+ describe('wp_list_tags — output compression', () => {
165
+ it('mode=ids_only returns flat ID array', async () => {
166
+ fetch.mockResolvedValue(mockSuccess([mockTag]));
167
+ const data = parseResult(await call('wp_list_tags', { mode: 'ids_only' }));
168
+ expect(data.mode).toBe('ids_only');
169
+ expect(data.ids).toEqual([7]);
170
+ expect(data.tags).toBeUndefined();
171
+ });
172
+
173
+ it('mode=summary returns compact object with expected keys', async () => {
174
+ fetch.mockResolvedValue(mockSuccess([mockTag]));
175
+ const data = parseResult(await call('wp_list_tags', { mode: 'summary' }));
176
+ expect(data.mode).toBe('summary');
177
+ expect(data.tags[0]).toEqual({ id: 7, name: 'javascript', slug: 'javascript', count: 8 });
178
+ });
179
+
180
+ it('mode=full (default) returns full format', async () => {
181
+ fetch.mockResolvedValue(mockSuccess([mockTag]));
182
+ const data = parseResult(await call('wp_list_tags'));
183
+ expect(data.mode).toBeUndefined();
184
+ expect(data.tags[0].id).toBe(7);
185
+ expect(data.tags[0].count).toBe(8);
186
+ });
187
+ });
188
+
189
+ // =========================================================================
190
+ // wp_list_users
191
+ // =========================================================================
192
+
193
+ describe('wp_list_users — output compression', () => {
194
+ it('mode=ids_only returns flat ID array', async () => {
195
+ fetch.mockResolvedValue(mockSuccess([mockUser]));
196
+ const data = parseResult(await call('wp_list_users', { mode: 'ids_only' }));
197
+ expect(data.mode).toBe('ids_only');
198
+ expect(data.ids).toEqual([1]);
199
+ expect(data.users).toBeUndefined();
200
+ });
201
+
202
+ it('mode=summary returns compact object with expected keys', async () => {
203
+ fetch.mockResolvedValue(mockSuccess([mockUser]));
204
+ const data = parseResult(await call('wp_list_users', { mode: 'summary' }));
205
+ expect(data.mode).toBe('summary');
206
+ expect(data.users[0]).toEqual({ id: 1, name: 'Admin', slug: 'admin', roles: ['administrator'] });
207
+ expect(data.users[0].avatar).toBeUndefined();
208
+ });
209
+
210
+ it('mode=full (default) returns full format', async () => {
211
+ fetch.mockResolvedValue(mockSuccess([mockUser]));
212
+ const data = parseResult(await call('wp_list_users'));
213
+ expect(data.mode).toBeUndefined();
214
+ expect(data.users[0].link).toBeDefined();
215
+ expect(data.users[0].avatar).toBeDefined();
216
+ });
217
+ });
218
+
219
+ // =========================================================================
220
+ // wp_list_custom_posts
221
+ // =========================================================================
222
+
223
+ describe('wp_list_custom_posts — output compression', () => {
224
+ it('mode=ids_only returns flat ID array', async () => {
225
+ mockSuccess(mockTypes);
226
+ mockSuccess([mockCustomPost]);
227
+ const data = parseResult(await call('wp_list_custom_posts', { post_type: 'portfolio', mode: 'ids_only' }));
228
+ expect(data.mode).toBe('ids_only');
229
+ expect(data.ids).toEqual([42]);
230
+ expect(data.posts).toBeUndefined();
231
+ });
232
+
233
+ it('mode=summary returns compact object with expected keys', async () => {
234
+ mockSuccess(mockTypes);
235
+ mockSuccess([mockCustomPost]);
236
+ const data = parseResult(await call('wp_list_custom_posts', { post_type: 'portfolio', mode: 'summary' }));
237
+ expect(data.mode).toBe('summary');
238
+ expect(data.posts[0]).toEqual({ id: 42, title: 'Portfolio Item', slug: 'portfolio-item', date: '2024-03-01', status: 'publish', link: 'https://test.example.com/portfolio/portfolio-item' });
239
+ expect(data.posts[0].type).toBeUndefined();
240
+ });
241
+
242
+ it('mode=full (default) returns full format', async () => {
243
+ mockSuccess(mockTypes);
244
+ mockSuccess([mockCustomPost]);
245
+ const data = parseResult(await call('wp_list_custom_posts', { post_type: 'portfolio' }));
246
+ expect(data.mode).toBeUndefined();
247
+ expect(data.posts[0].type).toBe('portfolio');
248
+ expect(data.posts[0].meta).toEqual({});
249
+ });
250
+ });
251
+
252
+ // =========================================================================
253
+ // wp_list_plugins
254
+ // =========================================================================
255
+
256
+ describe('wp_list_plugins — output compression', () => {
257
+ it('mode=ids_only returns flat plugin slug array', async () => {
258
+ fetch.mockResolvedValue(mockSuccess([mockPlugin]));
259
+ const data = parseResult(await call('wp_list_plugins', { mode: 'ids_only' }));
260
+ expect(data.mode).toBe('ids_only');
261
+ expect(data.ids).toEqual(['akismet/akismet.php']);
262
+ expect(data.plugins).toBeUndefined();
263
+ });
264
+
265
+ it('mode=summary returns compact object with expected keys', async () => {
266
+ fetch.mockResolvedValue(mockSuccess([mockPlugin]));
267
+ const data = parseResult(await call('wp_list_plugins', { mode: 'summary' }));
268
+ expect(data.mode).toBe('summary');
269
+ expect(data.plugins[0]).toEqual({ plugin: 'akismet/akismet.php', name: 'Akismet', status: 'active', version: '5.3' });
270
+ expect(data.plugins[0].author).toBeUndefined();
271
+ });
272
+
273
+ it('mode=full (default) returns full format', async () => {
274
+ fetch.mockResolvedValue(mockSuccess([mockPlugin]));
275
+ const data = parseResult(await call('wp_list_plugins'));
276
+ expect(data.mode).toBeUndefined();
277
+ expect(data.active).toBe(1);
278
+ expect(data.inactive).toBe(0);
279
+ expect(data.plugins[0].author).toBeDefined();
280
+ });
281
+ });
282
+
283
+ // =========================================================================
284
+ // wp_list_themes
285
+ // =========================================================================
286
+
287
+ describe('wp_list_themes — output compression', () => {
288
+ it('mode=ids_only returns flat stylesheet array', async () => {
289
+ fetch.mockResolvedValue(mockSuccess([mockTheme]));
290
+ const data = parseResult(await call('wp_list_themes', { mode: 'ids_only' }));
291
+ expect(data.mode).toBe('ids_only');
292
+ expect(data.ids).toEqual(['twentytwentyfour']);
293
+ expect(data.themes).toBeUndefined();
294
+ });
295
+
296
+ it('mode=summary returns compact object with expected keys', async () => {
297
+ fetch.mockResolvedValue(mockSuccess([mockTheme]));
298
+ const data = parseResult(await call('wp_list_themes', { mode: 'summary' }));
299
+ expect(data.mode).toBe('summary');
300
+ expect(data.themes[0]).toEqual({ stylesheet: 'twentytwentyfour', name: 'Twenty Twenty-Four', status: 'active', version: '1.2' });
301
+ expect(data.themes[0].author).toBeUndefined();
302
+ });
303
+
304
+ it('mode=full (default) returns full format', async () => {
305
+ fetch.mockResolvedValue(mockSuccess([mockTheme]));
306
+ const data = parseResult(await call('wp_list_themes'));
307
+ expect(data.mode).toBeUndefined();
308
+ expect(data.active_theme).toBe('Twenty Twenty-Four');
309
+ expect(data.themes[0].author).toBeDefined();
310
+ });
311
+ });
312
+
313
+ // =========================================================================
314
+ // wp_list_revisions
315
+ // =========================================================================
316
+
317
+ describe('wp_list_revisions — output compression', () => {
318
+ it('mode=ids_only returns flat ID array', async () => {
319
+ fetch.mockResolvedValue(mockSuccess([mockRevision]));
320
+ const data = parseResult(await call('wp_list_revisions', { post_id: 5, mode: 'ids_only' }));
321
+ expect(data.mode).toBe('ids_only');
322
+ expect(data.ids).toEqual([200]);
323
+ expect(data.revisions).toBeUndefined();
324
+ });
325
+
326
+ it('mode=summary returns compact object with expected keys', async () => {
327
+ fetch.mockResolvedValue(mockSuccess([mockRevision]));
328
+ const data = parseResult(await call('wp_list_revisions', { post_id: 5, mode: 'summary' }));
329
+ expect(data.mode).toBe('summary');
330
+ expect(data.revisions[0]).toEqual({ id: 200, date: '2024-04-01', author: 1 });
331
+ expect(data.revisions[0].slug).toBeUndefined();
332
+ });
333
+
334
+ it('mode=full (default) returns full format', async () => {
335
+ fetch.mockResolvedValue(mockSuccess([mockRevision]));
336
+ const data = parseResult(await call('wp_list_revisions', { post_id: 5 }));
337
+ expect(data.mode).toBeUndefined();
338
+ expect(data.note).toBeDefined();
339
+ expect(data.revisions[0].slug).toBe('5-revision-v1');
340
+ expect(data.revisions[0].author).toBe(1);
341
+ });
342
+ });
@@ -80,7 +80,9 @@ describe('wp_site_info', () => {
80
80
 
81
81
  // Server info
82
82
  expect(data.server.mcp_version).toBeDefined();
83
- expect(data.server.tools_count).toBe(85);
83
+ expect(data.server.tools_total).toBe(85);
84
+ expect(typeof data.server.tools_exposed).toBe('number');
85
+ expect(Array.isArray(data.server.filtered_out)).toBe(true);
84
86
  });
85
87
 
86
88
  it('SUCCESS — enterprise_controls reflect WP_READ_ONLY env var', async () => {