suparank 1.2.6 → 1.2.8

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,679 @@
1
+ /**
2
+ * Suparank MCP - Tool Definitions
3
+ *
4
+ * All tool schemas for the MCP server:
5
+ * - TOOLS: Backend tools (keyword research, content write, etc.)
6
+ * - ACTION_TOOLS: Local tools requiring credentials (image gen, publishing)
7
+ * - ORCHESTRATOR_TOOLS: Workflow management tools (create_content, session)
8
+ * - VISIBLE_TOOLS: Subset of tools shown to clients
9
+ */
10
+
11
+ // Backend research/content tools
12
+ export const TOOLS = [
13
+ {
14
+ name: 'keyword_research',
15
+ description: `Research keywords for SEO. Use ONLY when user specifically asks for keyword research WITHOUT wanting full article creation.
16
+
17
+ TRIGGERS - Use when user says:
18
+ - "find keywords for..."
19
+ - "research keywords about..."
20
+ - "what keywords should I target for..."
21
+ - "keyword ideas for..."
22
+ - "analyze keywords for..."
23
+
24
+ DO NOT USE when user wants to write/create content - use create_content instead (it includes keyword research automatically).
25
+
26
+ OUTCOME: List of keywords with search volume, difficulty, and recommendations.`,
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ seed_keyword: {
31
+ type: 'string',
32
+ description: 'Starting keyword or topic to research (optional - uses project primary keywords if not specified)'
33
+ },
34
+ content_goal: {
35
+ type: 'string',
36
+ enum: ['traffic', 'conversions', 'brand-awareness'],
37
+ description: 'Primary goal for the content strategy (optional - defaults to traffic)'
38
+ },
39
+ competitor_domain: {
40
+ type: 'string',
41
+ description: 'Optional: Competitor domain to analyze'
42
+ }
43
+ }
44
+ }
45
+ },
46
+ {
47
+ name: 'seo_strategy',
48
+ description: 'Create comprehensive SEO strategy and content brief. Works with project keywords automatically if none specified.',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {
52
+ target_keyword: {
53
+ type: 'string',
54
+ description: 'Main keyword to target (optional - uses project primary keywords if not specified)'
55
+ },
56
+ content_type: {
57
+ type: 'string',
58
+ enum: ['guide', 'listicle', 'how-to', 'comparison', 'review'],
59
+ description: 'Type of content to create (optional - defaults to guide)'
60
+ },
61
+ search_intent: {
62
+ type: 'string',
63
+ enum: ['informational', 'commercial', 'transactional', 'navigational'],
64
+ description: 'Primary search intent to target (optional - auto-detected)'
65
+ }
66
+ }
67
+ }
68
+ },
69
+ {
70
+ name: 'topical_map',
71
+ description: 'Design pillar-cluster content architecture for topical authority. Uses project niche and keywords automatically.',
72
+ inputSchema: {
73
+ type: 'object',
74
+ properties: {
75
+ core_topic: {
76
+ type: 'string',
77
+ description: 'Main topic for the content cluster (optional - uses project niche if not specified)'
78
+ },
79
+ depth: {
80
+ type: 'number',
81
+ enum: [1, 2, 3],
82
+ description: 'Depth of content cluster: 1 (pillar + 5 articles), 2 (+ subtopics), 3 (full hierarchy)',
83
+ default: 2
84
+ }
85
+ }
86
+ }
87
+ },
88
+ {
89
+ name: 'content_calendar',
90
+ description: 'Create editorial calendar and publication schedule. Uses project keywords and niche automatically.',
91
+ inputSchema: {
92
+ type: 'object',
93
+ properties: {
94
+ time_period: {
95
+ type: 'string',
96
+ enum: ['week', 'month', 'quarter'],
97
+ description: 'Planning period for the content calendar (optional - defaults to month)',
98
+ default: 'month'
99
+ },
100
+ content_types: {
101
+ type: 'array',
102
+ items: { type: 'string' },
103
+ description: 'Types of content to include (optional - defaults to blog)'
104
+ },
105
+ priority_keywords: {
106
+ type: 'array',
107
+ items: { type: 'string' },
108
+ description: 'Keywords to prioritize (optional - uses project keywords)'
109
+ }
110
+ }
111
+ }
112
+ },
113
+ {
114
+ name: 'content_write',
115
+ description: 'Write comprehensive, SEO-optimized blog articles. Creates engaging content with proper structure, internal links, and semantic optimization. Uses project brand voice and keywords automatically.',
116
+ inputSchema: {
117
+ type: 'object',
118
+ properties: {
119
+ title: {
120
+ type: 'string',
121
+ description: 'Article title or headline (optional - can be generated from topic)'
122
+ },
123
+ target_keyword: {
124
+ type: 'string',
125
+ description: 'Primary keyword to optimize for (optional - uses project keywords)'
126
+ },
127
+ outline: {
128
+ type: 'string',
129
+ description: 'Optional: Article outline or structure (H2/H3 headings)'
130
+ },
131
+ tone: {
132
+ type: 'string',
133
+ enum: ['professional', 'casual', 'conversational', 'technical'],
134
+ description: 'Writing tone (optional - uses project brand voice)'
135
+ }
136
+ }
137
+ }
138
+ },
139
+ {
140
+ name: 'image_prompt',
141
+ description: 'Create optimized prompts for AI image generation. Designs prompts for blog hero images, section illustrations, and branded visuals. Uses project visual style and brand automatically.',
142
+ inputSchema: {
143
+ type: 'object',
144
+ properties: {
145
+ image_purpose: {
146
+ type: 'string',
147
+ enum: ['hero', 'section', 'diagram', 'comparison', 'infographic'],
148
+ description: 'Purpose of the image (optional - defaults to hero)',
149
+ default: 'hero'
150
+ },
151
+ subject: {
152
+ type: 'string',
153
+ description: 'Main subject or concept for the image (optional - uses project niche)'
154
+ },
155
+ mood: {
156
+ type: 'string',
157
+ description: 'Optional: Desired mood (uses project visual style if not specified)'
158
+ }
159
+ }
160
+ }
161
+ },
162
+ {
163
+ name: 'internal_links',
164
+ description: 'Develop strategic internal linking plan. Analyzes existing content and identifies linking opportunities for improved site architecture. Works with project content automatically.',
165
+ inputSchema: {
166
+ type: 'object',
167
+ properties: {
168
+ current_page: {
169
+ type: 'string',
170
+ description: 'URL or title of the page to optimize (optional - can work with last created content)'
171
+ },
172
+ available_pages: {
173
+ type: 'array',
174
+ items: { type: 'string' },
175
+ description: 'List of existing pages to consider (optional - can analyze site automatically)'
176
+ },
177
+ link_goal: {
178
+ type: 'string',
179
+ enum: ['authority-building', 'user-navigation', 'conversion'],
180
+ description: 'Primary goal for internal linking (optional - defaults to authority-building)'
181
+ }
182
+ }
183
+ }
184
+ },
185
+ {
186
+ name: 'schema_generate',
187
+ description: 'Implement Schema.org structured data markup. Analyzes content to recommend and generate appropriate JSON-LD schemas for enhanced search visibility. Auto-detects page type if not specified.',
188
+ inputSchema: {
189
+ type: 'object',
190
+ properties: {
191
+ page_type: {
192
+ type: 'string',
193
+ enum: ['article', 'product', 'how-to', 'faq', 'review', 'organization'],
194
+ description: 'Type of page to generate schema for (optional - auto-detected from content)'
195
+ },
196
+ content_summary: {
197
+ type: 'string',
198
+ description: 'Brief summary of the page content (optional - can analyze content)'
199
+ }
200
+ }
201
+ }
202
+ },
203
+ {
204
+ name: 'geo_optimize',
205
+ description: 'Optimize content for AI search engines and Google SGE. Implements GEO (Generative Engine Optimization) best practices for LLM-friendly content. Works with project content automatically.',
206
+ inputSchema: {
207
+ type: 'object',
208
+ properties: {
209
+ content_url: {
210
+ type: 'string',
211
+ description: 'URL or title of content to optimize (optional - can work with last created content)'
212
+ },
213
+ target_engines: {
214
+ type: 'array',
215
+ items: {
216
+ type: 'string',
217
+ enum: ['chatgpt', 'perplexity', 'claude', 'gemini', 'google-sge']
218
+ },
219
+ description: 'AI search engines to optimize for (optional - defaults to all)',
220
+ default: ['chatgpt', 'google-sge']
221
+ }
222
+ }
223
+ }
224
+ },
225
+ {
226
+ name: 'quality_check',
227
+ description: 'Perform comprehensive pre-publish quality assurance. Checks grammar, SEO requirements, brand consistency, accessibility, and technical accuracy. Can review last created content automatically.',
228
+ inputSchema: {
229
+ type: 'object',
230
+ properties: {
231
+ content: {
232
+ type: 'string',
233
+ description: 'Full content to review (optional - can review last created content)'
234
+ },
235
+ check_type: {
236
+ type: 'string',
237
+ enum: ['full', 'seo-only', 'grammar-only', 'brand-only'],
238
+ description: 'Type of quality check to perform (optional - defaults to full)',
239
+ default: 'full'
240
+ }
241
+ }
242
+ }
243
+ },
244
+ {
245
+ name: 'full_pipeline',
246
+ description: 'Execute complete 5-phase content creation pipeline. Orchestrates research, planning, creation, optimization, and quality checking in one workflow. Works with project configuration automatically - just describe what you need!',
247
+ inputSchema: {
248
+ type: 'object',
249
+ properties: {
250
+ seed_keyword: {
251
+ type: 'string',
252
+ description: 'Starting keyword for the pipeline (optional - uses project primary keywords and niche)'
253
+ },
254
+ content_type: {
255
+ type: 'string',
256
+ enum: ['guide', 'listicle', 'how-to', 'comparison', 'review'],
257
+ description: 'Type of content to create (optional - defaults to guide)',
258
+ default: 'guide'
259
+ },
260
+ skip_phases: {
261
+ type: 'array',
262
+ items: {
263
+ type: 'string',
264
+ enum: ['research', 'planning', 'creation', 'optimization', 'quality']
265
+ },
266
+ description: 'Optional: Phases to skip in the pipeline'
267
+ }
268
+ }
269
+ }
270
+ }
271
+ ]
272
+
273
+ // Action tools that require local credentials
274
+ export const ACTION_TOOLS = [
275
+ {
276
+ name: 'generate_image',
277
+ description: `Generate AI images. Use when user wants to create, generate, or regenerate images.
278
+
279
+ TRIGGERS - Use when user says:
280
+ - "create an image for..."
281
+ - "generate image of..."
282
+ - "make a picture of..."
283
+ - "I need an image for..."
284
+ - "regenerate the image"
285
+ - "new hero image"
286
+ - "create thumbnail for..."
287
+
288
+ NOTE: create_content automatically generates images. Use this tool for:
289
+ - Regenerating/replacing images
290
+ - Creating standalone images
291
+ - Custom image requests outside content workflow
292
+
293
+ OUTCOME: AI-generated image URL ready for use.`,
294
+ inputSchema: {
295
+ type: 'object',
296
+ properties: {
297
+ prompt: {
298
+ type: 'string',
299
+ description: 'Detailed prompt for image generation'
300
+ },
301
+ style: {
302
+ type: 'string',
303
+ description: 'Style guidance (e.g., "minimalist", "photorealistic", "illustration")'
304
+ },
305
+ aspect_ratio: {
306
+ type: 'string',
307
+ enum: ['1:1', '16:9', '9:16', '4:3', '3:4'],
308
+ description: 'Image aspect ratio',
309
+ default: '16:9'
310
+ }
311
+ },
312
+ required: ['prompt']
313
+ },
314
+ requiresCredential: 'image'
315
+ },
316
+ {
317
+ name: 'publish_wordpress',
318
+ description: 'Publish content directly to WordPress (supports .com and .org). Requires WordPress credentials in ~/.suparank/credentials.json',
319
+ inputSchema: {
320
+ type: 'object',
321
+ properties: {
322
+ title: {
323
+ type: 'string',
324
+ description: 'Post title'
325
+ },
326
+ content: {
327
+ type: 'string',
328
+ description: 'Full post content (HTML or Markdown)'
329
+ },
330
+ status: {
331
+ type: 'string',
332
+ enum: ['draft', 'publish'],
333
+ description: 'Publication status',
334
+ default: 'draft'
335
+ },
336
+ categories: {
337
+ type: 'array',
338
+ items: { type: 'string' },
339
+ description: 'Category names'
340
+ },
341
+ tags: {
342
+ type: 'array',
343
+ items: { type: 'string' },
344
+ description: 'Tag names'
345
+ },
346
+ featured_image_url: {
347
+ type: 'string',
348
+ description: 'URL of featured image to upload'
349
+ }
350
+ },
351
+ required: ['title', 'content']
352
+ },
353
+ requiresCredential: 'wordpress'
354
+ },
355
+ {
356
+ name: 'publish_ghost',
357
+ description: 'Publish content to Ghost CMS. Requires Ghost Admin API key in ~/.suparank/credentials.json',
358
+ inputSchema: {
359
+ type: 'object',
360
+ properties: {
361
+ title: {
362
+ type: 'string',
363
+ description: 'Post title'
364
+ },
365
+ content: {
366
+ type: 'string',
367
+ description: 'Full post content (HTML or Markdown)'
368
+ },
369
+ status: {
370
+ type: 'string',
371
+ enum: ['draft', 'published'],
372
+ description: 'Publication status',
373
+ default: 'draft'
374
+ },
375
+ tags: {
376
+ type: 'array',
377
+ items: { type: 'string' },
378
+ description: 'Tag names'
379
+ },
380
+ featured_image_url: {
381
+ type: 'string',
382
+ description: 'URL of featured image'
383
+ }
384
+ },
385
+ required: ['title', 'content']
386
+ },
387
+ requiresCredential: 'ghost'
388
+ },
389
+ {
390
+ name: 'send_webhook',
391
+ description: 'Send data to configured webhooks (Make.com, n8n, Zapier, Slack). Requires webhook URLs in ~/.suparank/credentials.json',
392
+ inputSchema: {
393
+ type: 'object',
394
+ properties: {
395
+ webhook_type: {
396
+ type: 'string',
397
+ enum: ['default', 'make', 'n8n', 'zapier', 'slack'],
398
+ description: 'Which webhook to use',
399
+ default: 'default'
400
+ },
401
+ payload: {
402
+ type: 'object',
403
+ description: 'Data to send in the webhook'
404
+ },
405
+ message: {
406
+ type: 'string',
407
+ description: 'For Slack: formatted message text'
408
+ }
409
+ },
410
+ required: ['webhook_type']
411
+ },
412
+ requiresCredential: 'webhooks'
413
+ }
414
+ ]
415
+
416
+ // Orchestrator tools for automated workflows
417
+ export const ORCHESTRATOR_TOOLS = [
418
+ {
419
+ name: 'create_content',
420
+ description: `PRIMARY TOOL for content creation. Use this when user wants to write, create, or generate any content.
421
+
422
+ TRIGGERS - Use when user says:
423
+ - "write a blog post about..."
424
+ - "create an article about..."
425
+ - "I need content for..."
426
+ - "help me write about..."
427
+ - "generate a post on..."
428
+ - "make content about..."
429
+ - any request involving writing/creating/generating articles or blog posts
430
+
431
+ WORKFLOW (automatic 4-phase):
432
+ 1. RESEARCH: Keywords, SEO strategy, content structure
433
+ 2. CREATION: Outline, write full article, save to session
434
+ 3. OPTIMIZATION: Quality check, GEO optimization for AI search
435
+ 4. PUBLISHING: Generate images, publish to WordPress/Ghost
436
+
437
+ OUTCOME: Complete article written, optimized, and published to CMS.`,
438
+ inputSchema: {
439
+ type: 'object',
440
+ properties: {
441
+ request: {
442
+ type: 'string',
443
+ description: 'What content do you want? (e.g., "write a blog post about AI", "create 5 articles")'
444
+ },
445
+ count: {
446
+ type: 'number',
447
+ description: 'Number of articles to create (default: 1)',
448
+ default: 1
449
+ },
450
+ publish_to: {
451
+ type: 'array',
452
+ items: { type: 'string', enum: ['ghost', 'wordpress', 'none'] },
453
+ description: 'Where to publish (default: all configured CMS)',
454
+ default: []
455
+ },
456
+ with_images: {
457
+ type: 'boolean',
458
+ description: 'Generate hero images (default: true)',
459
+ default: true
460
+ }
461
+ }
462
+ }
463
+ },
464
+ {
465
+ name: 'save_content',
466
+ description: `Save written article to session. Use after manually writing content outside create_content workflow.
467
+
468
+ TRIGGERS - Use when:
469
+ - You wrote an article manually and need to save it
470
+ - User says "save this article" / "save my content"
471
+ - Saving edited/revised content
472
+
473
+ NOTE: create_content saves automatically. Only use this for manual saves.
474
+
475
+ OUTCOME: Article saved to session, ready for publishing.`,
476
+ inputSchema: {
477
+ type: 'object',
478
+ properties: {
479
+ title: {
480
+ type: 'string',
481
+ description: 'Article title'
482
+ },
483
+ content: {
484
+ type: 'string',
485
+ description: 'Full article content (markdown)'
486
+ },
487
+ keywords: {
488
+ type: 'array',
489
+ items: { type: 'string' },
490
+ description: 'Target keywords used'
491
+ },
492
+ meta_description: {
493
+ type: 'string',
494
+ description: 'SEO meta description'
495
+ }
496
+ },
497
+ required: ['title', 'content']
498
+ }
499
+ },
500
+ {
501
+ name: 'publish_content',
502
+ description: `Publish articles to WordPress/Ghost. Use when user wants to publish saved content.
503
+
504
+ TRIGGERS - Use when user says:
505
+ - "publish my article"
506
+ - "post this to WordPress/Ghost"
507
+ - "publish to my blog"
508
+ - "make it live"
509
+ - "publish as draft"
510
+
511
+ NOTE: create_content publishes automatically. Use this for:
512
+ - Manual publishing control
513
+ - Re-publishing edited content
514
+ - Publishing specific articles from session
515
+
516
+ OUTCOME: Article published to configured CMS platforms.`,
517
+ inputSchema: {
518
+ type: 'object',
519
+ properties: {
520
+ platforms: {
521
+ type: 'array',
522
+ items: { type: 'string', enum: ['ghost', 'wordpress', 'all'] },
523
+ description: 'Platforms to publish to (default: all configured)',
524
+ default: ['all']
525
+ },
526
+ status: {
527
+ type: 'string',
528
+ enum: ['draft', 'publish'],
529
+ description: 'Publication status',
530
+ default: 'draft'
531
+ },
532
+ category: {
533
+ type: 'string',
534
+ description: 'WordPress category name - pick the most relevant one from available categories shown in save_content response'
535
+ },
536
+ article_numbers: {
537
+ type: 'array',
538
+ items: { type: 'number' },
539
+ description: 'Optional: Publish specific articles by number (1, 2, 3...). If not specified, publishes ALL unpublished articles.'
540
+ }
541
+ }
542
+ }
543
+ },
544
+ {
545
+ name: 'get_session',
546
+ description: `View current session status. Shows saved articles, images, and publishing state.
547
+
548
+ TRIGGERS - Use when user says:
549
+ - "what's in my session"
550
+ - "show my articles"
551
+ - "what have I created"
552
+ - "session status"
553
+ - "list my saved content"
554
+
555
+ OUTCOME: List of all articles in session with their publish status.`,
556
+ inputSchema: {
557
+ type: 'object',
558
+ properties: {}
559
+ }
560
+ },
561
+ {
562
+ name: 'remove_article',
563
+ description: `Remove article(s) from session. Does NOT delete published content.
564
+
565
+ TRIGGERS - Use when user says:
566
+ - "remove article 2"
567
+ - "delete the second article"
568
+ - "remove that article"
569
+ - "discard article..."
570
+
571
+ OUTCOME: Specified article(s) removed from session.`,
572
+ inputSchema: {
573
+ type: 'object',
574
+ properties: {
575
+ article_numbers: {
576
+ type: 'array',
577
+ items: { type: 'number' },
578
+ description: 'Article numbers to remove (1, 2, 3...). Use get_session to see article numbers.'
579
+ }
580
+ },
581
+ required: ['article_numbers']
582
+ }
583
+ },
584
+ {
585
+ name: 'clear_session',
586
+ description: `Clear ALL content from session. DESTRUCTIVE - removes all unpublished articles!
587
+
588
+ TRIGGERS - Use when user says:
589
+ - "clear my session"
590
+ - "start fresh"
591
+ - "remove all articles"
592
+ - "reset everything"
593
+ - "clear all content"
594
+
595
+ WARNING: Requires confirm: true. Does NOT affect already-published content.
596
+
597
+ OUTCOME: Empty session, ready for new content creation.`,
598
+ inputSchema: {
599
+ type: 'object',
600
+ properties: {
601
+ confirm: {
602
+ type: 'boolean',
603
+ description: 'Must be true to confirm clearing all content'
604
+ }
605
+ },
606
+ required: ['confirm']
607
+ }
608
+ },
609
+ {
610
+ name: 'list_content',
611
+ description: `List all saved content from disk. Shows past articles that can be loaded back.
612
+
613
+ TRIGGERS - Use when user says:
614
+ - "show my past articles"
615
+ - "list saved content"
616
+ - "what articles do I have"
617
+ - "show previous content"
618
+ - "find my old articles"
619
+
620
+ NOTE: Different from get_session - this shows DISK storage, not current session.
621
+
622
+ OUTCOME: List of saved article folders with titles and dates.`,
623
+ inputSchema: {
624
+ type: 'object',
625
+ properties: {
626
+ limit: {
627
+ type: 'number',
628
+ description: 'Max number of articles to show (default: 20)',
629
+ default: 20
630
+ }
631
+ }
632
+ }
633
+ },
634
+ {
635
+ name: 'load_content',
636
+ description: `Load a saved article back into session for editing or re-publishing.
637
+
638
+ TRIGGERS - Use when user says:
639
+ - "load my article about..."
640
+ - "open the previous article"
641
+ - "bring back that article"
642
+ - "edit my old post about..."
643
+ - "reload article..."
644
+
645
+ WORKFLOW: Run list_content first to see available articles, then load by folder name.
646
+
647
+ OUTCOME: Article loaded into session, ready for optimization or re-publishing.`,
648
+ inputSchema: {
649
+ type: 'object',
650
+ properties: {
651
+ folder_name: {
652
+ type: 'string',
653
+ description: 'Folder name from list_content (e.g., "2026-01-09-my-article-title")'
654
+ }
655
+ },
656
+ required: ['folder_name']
657
+ }
658
+ }
659
+ ]
660
+
661
+ /**
662
+ * Essential tools shown in the tool list
663
+ * MCP protocol requires tools to be listed for clients to call them
664
+ */
665
+ export const VISIBLE_TOOLS = [
666
+ // Essential (5) - Main workflow
667
+ 'create_content', // Main entry point - creates & publishes automatically
668
+ 'keyword_research', // Research keywords separately (on-demand)
669
+ 'generate_image', // Generate/regenerate images (on-demand)
670
+ 'publish_content', // Manual publish trigger (on-demand)
671
+ 'get_session', // Check status (on-demand)
672
+
673
+ // Session Management (5) - Content lifecycle
674
+ 'save_content', // Save article to session
675
+ 'list_content', // List saved content
676
+ 'load_content', // Load past content into session
677
+ 'remove_article', // Remove article from session
678
+ 'clear_session' // Clear all session content
679
+ ]