@dudefactory/payload-plugin-content-planner 3.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/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Payload Content Planner Plugin
2
+
3
+ A Payload CMS plugin that adds content planning collections and integrates with your MCP system.
4
+
5
+ ## What It Does
6
+
7
+ Adds three collections to your Payload CMS:
8
+
9
+ - **Content Tasks** - Work items for agents to execute
10
+ - **Keywords** - SEO keyword database
11
+ - **Instructions** - Writing guidelines and rules
12
+
13
+ Exports MCP tools so agents can query and manage these collections via your MCP interface.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install @dudefactory/payload-plugin-content-planner
19
+ ```
20
+
21
+ ## Setup
22
+
23
+ In your Payload config:
24
+
25
+ ```typescript
26
+ import { buildConfig } from 'payload/config';
27
+ import {
28
+ contentPlannerPlugin,
29
+ contentPlannerTools,
30
+ contentPlannerPrompts,
31
+ } from '@dudefactory/payload-plugin-content-planner';
32
+
33
+ export default buildConfig({
34
+ plugins: [
35
+ contentPlannerPlugin({ enabled: true }),
36
+
37
+ // Add tools/prompts to your MCP plugin
38
+ mcpPlugin({
39
+ tools: [...existingTools, ...contentPlannerTools],
40
+ prompts: [...existingPrompts, ...contentPlannerPrompts],
41
+ }),
42
+ ],
43
+ });
44
+ ```
45
+
46
+ ## Collections
47
+
48
+ ### Content Tasks
49
+
50
+ - `title` - Task name
51
+ - `instructions` - What to do
52
+ - `status` - todo | in-progress | done | blocked
53
+ - `priority` - low | normal | high
54
+ - `deadline` - Due date
55
+ - `tags` - Categories
56
+ - `notes` - Notes/results
57
+
58
+ ### Keywords
59
+
60
+ - `keyword` - The keyword phrase
61
+ - `category` - Content category
62
+ - `searchVolume` - Monthly searches
63
+ - `difficulty` - SEO difficulty
64
+ - `intent` - Search intent type
65
+ - `relatedKeywords` - Related phrases
66
+
67
+ ### Instructions
68
+
69
+ - `title` - Guideline name
70
+ - `type` - Tone, Style, Terminology, etc.
71
+ - `content` - The actual guideline
72
+ - `active` - Whether agents use it
73
+
74
+ ## MCP Tools
75
+
76
+ Available via your `/api/mcp` endpoint:
77
+
78
+ - `contentplanner/get-oldest-task` - Get next todo task
79
+ - `contentplanner/fetch-keywords` - Fetch keywords by category
80
+ - `contentplanner/fetch-instructions` - Fetch guidelines
81
+ - `contentplanner/update-task` - Update task status/notes
82
+
83
+ ## Docs
84
+
85
+ - [Agent Instructions](./AGENT_INITIALIZATION_INSTRUCTION.md) - How agents use the plugin
86
+ - [Architecture](./MCP_ARCHITECTURE.md) - Technical design
87
+
88
+ ## License
89
+
90
+ MIT
@@ -0,0 +1,2 @@
1
+ import { CollectionConfig } from 'payload/types';
2
+ export declare const contentTasksCollection: CollectionConfig;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contentTasksCollection = void 0;
4
+ exports.contentTasksCollection = {
5
+ slug: 'cp-content-tasks',
6
+ admin: {
7
+ useAsTitle: 'title',
8
+ defaultColumns: ['title', 'status', 'priority', 'deadline', 'createdAt'],
9
+ group: 'Content Planning',
10
+ },
11
+ fields: [
12
+ {
13
+ name: 'title',
14
+ label: 'Task Title',
15
+ type: 'text',
16
+ required: true,
17
+ maxLength: 150,
18
+ },
19
+ {
20
+ name: 'instructions',
21
+ label: 'Detailed Instructions',
22
+ type: 'textarea',
23
+ required: true,
24
+ admin: {
25
+ rows: 10,
26
+ },
27
+ },
28
+ {
29
+ name: 'status',
30
+ label: 'Status',
31
+ type: 'select',
32
+ required: true,
33
+ options: [
34
+ { label: 'To Do', value: 'todo' },
35
+ { label: 'In Progress', value: 'in-progress' },
36
+ { label: 'In Review', value: 'review' },
37
+ { label: 'Done', value: 'done' },
38
+ { label: 'Blocked', value: 'blocked' },
39
+ ],
40
+ defaultValue: 'todo',
41
+ },
42
+ {
43
+ name: 'priority',
44
+ label: 'Priority',
45
+ type: 'select',
46
+ required: true,
47
+ options: [
48
+ { label: 'Low', value: 'low' },
49
+ { label: 'Normal', value: 'normal' },
50
+ { label: 'High', value: 'high' },
51
+ ],
52
+ defaultValue: 'normal',
53
+ },
54
+ {
55
+ name: 'deadline',
56
+ label: 'Deadline',
57
+ type: 'date',
58
+ required: true,
59
+ },
60
+ {
61
+ name: 'tags',
62
+ label: 'Tags',
63
+ type: 'array',
64
+ fields: [
65
+ {
66
+ name: 'tag',
67
+ type: 'text',
68
+ },
69
+ ],
70
+ },
71
+ {
72
+ name: 'notes',
73
+ label: 'Completion Notes',
74
+ type: 'textarea',
75
+ admin: {
76
+ rows: 6,
77
+ },
78
+ },
79
+ {
80
+ name: 'assignedTo',
81
+ label: 'Assigned To',
82
+ type: 'text',
83
+ },
84
+ ],
85
+ timestamps: true,
86
+ };
@@ -0,0 +1,2 @@
1
+ import { CollectionConfig } from 'payload/types';
2
+ export declare const instructionsCollection: CollectionConfig;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.instructionsCollection = void 0;
4
+ exports.instructionsCollection = {
5
+ slug: 'cp-instructions',
6
+ admin: {
7
+ useAsTitle: 'title',
8
+ defaultColumns: ['title', 'type', 'category'],
9
+ group: 'Content Planning',
10
+ },
11
+ fields: [
12
+ {
13
+ name: 'title',
14
+ label: 'Instruction Title',
15
+ type: 'text',
16
+ required: true,
17
+ },
18
+ {
19
+ name: 'type',
20
+ label: 'Type',
21
+ type: 'select',
22
+ required: true,
23
+ options: [
24
+ { label: 'Tone & Voice', value: 'tone-voice' },
25
+ { label: 'Writing Style', value: 'writing-style' },
26
+ { label: 'Quality Standards', value: 'quality-standards' },
27
+ { label: 'Industry Terminology', value: 'terminology' },
28
+ { label: 'Brand Guidelines', value: 'brand-guidelines' },
29
+ { label: 'Content Format', value: 'content-format' },
30
+ { label: 'MCP Prompt', value: 'mcp-prompt' },
31
+ { label: 'Other', value: 'other' },
32
+ ],
33
+ },
34
+ {
35
+ name: 'category',
36
+ label: 'Category',
37
+ type: 'text',
38
+ },
39
+ {
40
+ name: 'content',
41
+ label: 'Instruction Content',
42
+ type: 'textarea',
43
+ required: true,
44
+ admin: {
45
+ rows: 12,
46
+ },
47
+ },
48
+ {
49
+ name: 'examples',
50
+ label: 'Examples',
51
+ type: 'array',
52
+ fields: [
53
+ {
54
+ name: 'example',
55
+ type: 'textarea',
56
+ },
57
+ ],
58
+ },
59
+ {
60
+ name: 'active',
61
+ label: 'Active (Use in MCP)',
62
+ type: 'checkbox',
63
+ defaultValue: true,
64
+ },
65
+ ],
66
+ timestamps: true,
67
+ };
@@ -0,0 +1,2 @@
1
+ import { CollectionConfig } from 'payload/types';
2
+ export declare const keywordsCollection: CollectionConfig;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.keywordsCollection = void 0;
4
+ exports.keywordsCollection = {
5
+ slug: 'cp-keywords',
6
+ admin: {
7
+ useAsTitle: 'keyword',
8
+ defaultColumns: ['keyword', 'category', 'searchVolume', 'difficulty'],
9
+ group: 'Content Planning',
10
+ },
11
+ fields: [
12
+ {
13
+ name: 'keyword',
14
+ label: 'Keyword/Phrase',
15
+ type: 'text',
16
+ required: true,
17
+ unique: true,
18
+ },
19
+ {
20
+ name: 'category',
21
+ label: 'Category',
22
+ type: 'text',
23
+ },
24
+ {
25
+ name: 'searchVolume',
26
+ label: 'Monthly Search Volume',
27
+ type: 'number',
28
+ },
29
+ {
30
+ name: 'difficulty',
31
+ label: 'SEO Difficulty',
32
+ type: 'select',
33
+ options: [
34
+ { label: 'Easy', value: 'easy' },
35
+ { label: 'Medium', value: 'medium' },
36
+ { label: 'Hard', value: 'hard' },
37
+ ],
38
+ },
39
+ {
40
+ name: 'intent',
41
+ label: 'Search Intent',
42
+ type: 'select',
43
+ options: [
44
+ { label: 'Informational', value: 'informational' },
45
+ { label: 'Navigational', value: 'navigational' },
46
+ { label: 'Commercial', value: 'commercial' },
47
+ { label: 'Transactional', value: 'transactional' },
48
+ ],
49
+ },
50
+ {
51
+ name: 'relatedKeywords',
52
+ label: 'Related Keywords',
53
+ type: 'array',
54
+ fields: [
55
+ {
56
+ name: 'keyword',
57
+ type: 'text',
58
+ },
59
+ ],
60
+ },
61
+ {
62
+ name: 'notes',
63
+ label: 'Notes',
64
+ type: 'textarea',
65
+ },
66
+ ],
67
+ timestamps: true,
68
+ };
@@ -0,0 +1,153 @@
1
+ import { Config } from 'payload/config';
2
+ import { generateInitInstruction, warmupInitialization, setupInstructions, generateContentTask, executeContentTask } from './mcp/prompts-handlers';
3
+ export declare const contentPlannerPrompts: ({
4
+ name: string;
5
+ title: string;
6
+ description: string;
7
+ argsSchema: {
8
+ type: "object";
9
+ properties: {
10
+ projectName: {
11
+ type: string;
12
+ description: string;
13
+ };
14
+ projectPurpose: {
15
+ type: string;
16
+ description: string;
17
+ };
18
+ };
19
+ required: string[];
20
+ };
21
+ handler: (args: any) => {
22
+ messages: {
23
+ role: string;
24
+ content: {
25
+ type: string;
26
+ text: string;
27
+ };
28
+ }[];
29
+ };
30
+ } | {
31
+ name: string;
32
+ title: string;
33
+ description: string;
34
+ argsSchema: {
35
+ type: "object";
36
+ properties: {};
37
+ required: never[];
38
+ };
39
+ handler: () => {
40
+ messages: {
41
+ role: string;
42
+ content: {
43
+ type: string;
44
+ text: string;
45
+ };
46
+ }[];
47
+ };
48
+ } | {
49
+ name: string;
50
+ title: string;
51
+ description: string;
52
+ argsSchema: {
53
+ type: "object";
54
+ properties: {
55
+ brandName: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ category: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ };
64
+ required: string[];
65
+ };
66
+ handler: (args: any) => {
67
+ messages: {
68
+ role: string;
69
+ content: {
70
+ type: string;
71
+ text: string;
72
+ };
73
+ }[];
74
+ };
75
+ } | {
76
+ name: string;
77
+ title: string;
78
+ description: string;
79
+ argsSchema: {
80
+ type: "object";
81
+ properties: {
82
+ taskType: {
83
+ type: string;
84
+ description: string;
85
+ };
86
+ topic: {
87
+ type: string;
88
+ description: string;
89
+ };
90
+ };
91
+ required: string[];
92
+ };
93
+ handler: (args: any) => {
94
+ messages: {
95
+ role: string;
96
+ content: {
97
+ type: string;
98
+ text: string;
99
+ };
100
+ }[];
101
+ };
102
+ } | {
103
+ name: string;
104
+ title: string;
105
+ description: string;
106
+ argsSchema: {
107
+ type: "object";
108
+ properties: {
109
+ taskId: {
110
+ type: string;
111
+ description: string;
112
+ };
113
+ };
114
+ required: string[];
115
+ };
116
+ handler: (args: any) => {
117
+ messages: {
118
+ role: string;
119
+ content: {
120
+ type: string;
121
+ text: string;
122
+ };
123
+ }[];
124
+ };
125
+ })[];
126
+ export { generateInitInstruction, warmupInitialization, setupInstructions, generateContentTask, executeContentTask, };
127
+ export interface ContentPlannerPluginConfig {
128
+ enabled?: boolean;
129
+ }
130
+ /**
131
+ * Payload Content Planner Plugin
132
+ *
133
+ * Extends your existing Payload MCP plugin with:
134
+ * - ContentTasks, Keywords, Instructions collections
135
+ * - MCP tools and prompts (register with your MCP plugin)
136
+ *
137
+ * Each project installs independently. No cross-project sync.
138
+ *
139
+ * Usage:
140
+ * ```typescript
141
+ * import { buildConfig } from 'payload/config'
142
+ * import { contentPlannerPlugin, contentPlannerTools, contentPlannerPrompts } from '@dudefactory/payload-plugin-content-planner'
143
+ *
144
+ * export default buildConfig({
145
+ * plugins: [
146
+ * contentPlannerPlugin({ enabled: true }),
147
+ * // Add to your existing MCP plugin:
148
+ * // mcpPlugin({ tools: contentPlannerTools, prompts: contentPlannerPrompts })
149
+ * ],
150
+ * })
151
+ * ```
152
+ */
153
+ export declare const contentPlannerPlugin: (config?: ContentPlannerPluginConfig) => (incomingConfig: Config) => Config;
package/dist/index.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contentPlannerPlugin = exports.executeContentTask = exports.generateContentTask = exports.setupInstructions = exports.warmupInitialization = exports.generateInitInstruction = exports.contentPlannerPrompts = void 0;
4
+ const ContentTasks_1 = require("./collections/ContentTasks");
5
+ const Keywords_1 = require("./collections/Keywords");
6
+ const Instructions_1 = require("./collections/Instructions");
7
+ const prompts_handlers_1 = require("./mcp/prompts-handlers");
8
+ Object.defineProperty(exports, "generateInitInstruction", { enumerable: true, get: function () { return prompts_handlers_1.generateInitInstruction; } });
9
+ Object.defineProperty(exports, "warmupInitialization", { enumerable: true, get: function () { return prompts_handlers_1.warmupInitialization; } });
10
+ Object.defineProperty(exports, "setupInstructions", { enumerable: true, get: function () { return prompts_handlers_1.setupInstructions; } });
11
+ Object.defineProperty(exports, "generateContentTask", { enumerable: true, get: function () { return prompts_handlers_1.generateContentTask; } });
12
+ Object.defineProperty(exports, "executeContentTask", { enumerable: true, get: function () { return prompts_handlers_1.executeContentTask; } });
13
+ // Export MCP prompts as array for mcpPlugin integration
14
+ exports.contentPlannerPrompts = [
15
+ prompts_handlers_1.generateInitInstruction,
16
+ prompts_handlers_1.warmupInitialization,
17
+ prompts_handlers_1.setupInstructions,
18
+ prompts_handlers_1.generateContentTask,
19
+ prompts_handlers_1.executeContentTask,
20
+ ];
21
+ /**
22
+ * Payload Content Planner Plugin
23
+ *
24
+ * Extends your existing Payload MCP plugin with:
25
+ * - ContentTasks, Keywords, Instructions collections
26
+ * - MCP tools and prompts (register with your MCP plugin)
27
+ *
28
+ * Each project installs independently. No cross-project sync.
29
+ *
30
+ * Usage:
31
+ * ```typescript
32
+ * import { buildConfig } from 'payload/config'
33
+ * import { contentPlannerPlugin, contentPlannerTools, contentPlannerPrompts } from '@dudefactory/payload-plugin-content-planner'
34
+ *
35
+ * export default buildConfig({
36
+ * plugins: [
37
+ * contentPlannerPlugin({ enabled: true }),
38
+ * // Add to your existing MCP plugin:
39
+ * // mcpPlugin({ tools: contentPlannerTools, prompts: contentPlannerPrompts })
40
+ * ],
41
+ * })
42
+ * ```
43
+ */
44
+ const contentPlannerPlugin = (config = {}) => (incomingConfig) => {
45
+ const { enabled = true } = config;
46
+ if (!enabled) {
47
+ return incomingConfig;
48
+ }
49
+ return {
50
+ ...incomingConfig,
51
+ collections: [
52
+ ...(incomingConfig.collections || []),
53
+ ContentTasks_1.contentTasksCollection,
54
+ Keywords_1.keywordsCollection,
55
+ Instructions_1.instructionsCollection,
56
+ ],
57
+ };
58
+ };
59
+ exports.contentPlannerPlugin = contentPlannerPlugin;
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Content Planner Plugin MCP Prompts
3
+ *
4
+ * Generic, system-aware prompts that:
5
+ * 1. Check system state (what instructions/tasks exist)
6
+ * 2. Suggest next steps based on what's missing
7
+ * 3. Guide without domain-specific assumptions
8
+ */
9
+ /**
10
+ * Generate project initialization instruction
11
+ * Creates a base instruction that teaches MCP clients how to discover and use this project
12
+ */
13
+ export declare const generateInitInstruction: {
14
+ name: string;
15
+ title: string;
16
+ description: string;
17
+ argsSchema: {
18
+ type: "object";
19
+ properties: {
20
+ projectName: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ projectPurpose: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ };
29
+ required: string[];
30
+ };
31
+ handler: (args: any) => {
32
+ messages: {
33
+ role: string;
34
+ content: {
35
+ type: string;
36
+ text: string;
37
+ };
38
+ }[];
39
+ };
40
+ };
41
+ /**
42
+ * Warm-up prompt for MCP client initialization
43
+ * This is the first prompt AI sees when connecting to understand capabilities
44
+ */
45
+ export declare const warmupInitialization: {
46
+ name: string;
47
+ title: string;
48
+ description: string;
49
+ argsSchema: {
50
+ type: "object";
51
+ properties: {};
52
+ required: never[];
53
+ };
54
+ handler: () => {
55
+ messages: {
56
+ role: string;
57
+ content: {
58
+ type: string;
59
+ text: string;
60
+ };
61
+ }[];
62
+ };
63
+ };
64
+ export declare const setupInstructions: {
65
+ name: string;
66
+ title: string;
67
+ description: string;
68
+ argsSchema: {
69
+ type: "object";
70
+ properties: {
71
+ brandName: {
72
+ type: string;
73
+ description: string;
74
+ };
75
+ category: {
76
+ type: string;
77
+ description: string;
78
+ };
79
+ };
80
+ required: string[];
81
+ };
82
+ handler: (args: any) => {
83
+ messages: {
84
+ role: string;
85
+ content: {
86
+ type: string;
87
+ text: string;
88
+ };
89
+ }[];
90
+ };
91
+ };
92
+ export declare const generateContentTask: {
93
+ name: string;
94
+ title: string;
95
+ description: string;
96
+ argsSchema: {
97
+ type: "object";
98
+ properties: {
99
+ taskType: {
100
+ type: string;
101
+ description: string;
102
+ };
103
+ topic: {
104
+ type: string;
105
+ description: string;
106
+ };
107
+ };
108
+ required: string[];
109
+ };
110
+ handler: (args: any) => {
111
+ messages: {
112
+ role: string;
113
+ content: {
114
+ type: string;
115
+ text: string;
116
+ };
117
+ }[];
118
+ };
119
+ };
120
+ export declare const executeContentTask: {
121
+ name: string;
122
+ title: string;
123
+ description: string;
124
+ argsSchema: {
125
+ type: "object";
126
+ properties: {
127
+ taskId: {
128
+ type: string;
129
+ description: string;
130
+ };
131
+ };
132
+ required: string[];
133
+ };
134
+ handler: (args: any) => {
135
+ messages: {
136
+ role: string;
137
+ content: {
138
+ type: string;
139
+ text: string;
140
+ };
141
+ }[];
142
+ };
143
+ };
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ /**
3
+ * Content Planner Plugin MCP Prompts
4
+ *
5
+ * Generic, system-aware prompts that:
6
+ * 1. Check system state (what instructions/tasks exist)
7
+ * 2. Suggest next steps based on what's missing
8
+ * 3. Guide without domain-specific assumptions
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.executeContentTask = exports.generateContentTask = exports.setupInstructions = exports.warmupInitialization = exports.generateInitInstruction = void 0;
12
+ /**
13
+ * Generate project initialization instruction
14
+ * Creates a base instruction that teaches MCP clients how to discover and use this project
15
+ */
16
+ exports.generateInitInstruction = {
17
+ name: 'cp-generate-init-instruction',
18
+ title: 'Generate Project Initialization Instruction',
19
+ description: 'Create a base instruction that teaches MCP clients how to discover tools and understand this project on first connection.',
20
+ argsSchema: {
21
+ type: 'object',
22
+ properties: {
23
+ projectName: {
24
+ type: 'string',
25
+ description: 'Name of this project/system',
26
+ },
27
+ projectPurpose: {
28
+ type: 'string',
29
+ description: 'What this project does (1-2 sentences)',
30
+ },
31
+ },
32
+ required: ['projectName', 'projectPurpose'],
33
+ },
34
+ handler: (args) => ({
35
+ messages: [
36
+ {
37
+ role: 'user',
38
+ content: {
39
+ type: 'text',
40
+ text: `Generate initialization instruction for: ${args.projectName}
41
+
42
+ Purpose: ${args.projectPurpose}
43
+
44
+ CREATE AN INSTRUCTION THAT TEACHES MCP CLIENTS HOW TO START:
45
+
46
+ This instruction will be stored in the database and shown to MCP clients on first connection.
47
+ It should teach the agent:
48
+
49
+ STEP 0: VALIDATE MCP SERVER (CRITICAL FIRST STEP)
50
+ - "Before proceeding, validate your MCP server connection"
51
+ - Ask the user: "Can you see available prompts and tools? Please confirm by running:"
52
+ • tools/list (should show tools starting with 'contentplanner/')
53
+ • prompts/list (should show prompts starting with 'cp-')
54
+ - If YES: "Great! MCP server is working. Continue to Step 1."
55
+ - If NO: "MCP server issue. Check:"
56
+ • Is MCP plugin configured in payload.config.ts?
57
+ • Is /api/mcp endpoint accessible?
58
+ • Are contentPlannerTools and contentPlannerPrompts registered?
59
+ - DO NOT PROCEED until server validation passes
60
+
61
+ STEP 1: WHERE YOU ARE
62
+ - "You're connected to ${args.projectName}"
63
+ - "${args.projectPurpose}"
64
+
65
+ STEP 2: DISCOVER CAPABILITIES
66
+ - Now that server is validated, call tools/list
67
+ - Look for tools starting with 'contentplanner/' prefix
68
+ - Read their descriptions to understand capabilities
69
+ - Note which tools are available
70
+
71
+ STEP 3: LEARN PROJECT CONTEXT
72
+ - Fetch active instructions: GET /api/cp-instructions?where[active][equals]=true
73
+ - These instructions contain project-specific guidelines, prompts, and workflows
74
+ - Read ALL active instructions to understand how to help in this project
75
+ - Instructions with type='mcp-prompt' are especially important
76
+
77
+ STEP 4: READY TO WORK
78
+ - After reading instructions, you'll know:
79
+ * What tasks you can execute
80
+ * What content you can generate
81
+ * What workflows to follow
82
+ - Ask the user: "What would you like help with?"
83
+
84
+ Now create a cp-instruction record:
85
+
86
+ POST /api/cp-instructions
87
+ {
88
+ "title": "MCP Client Initialization - ${args.projectName}",
89
+ "type": "mcp-prompt",
90
+ "category": "system",
91
+ "content": "[Generate the full initialization instruction text here - be specific, clear, step-by-step. START WITH SERVER VALIDATION]",
92
+ "examples": [],
93
+ "active": true
94
+ }
95
+
96
+ CRITICAL:
97
+ - Make the content field a complete, standalone instruction
98
+ - ALWAYS start with MCP server validation
99
+ - Assume the agent knows NOTHING about this project
100
+ - Include exact API endpoints and tool names
101
+
102
+ Generate the instruction now.`,
103
+ },
104
+ },
105
+ ],
106
+ }),
107
+ };
108
+ /**
109
+ * Warm-up prompt for MCP client initialization
110
+ * This is the first prompt AI sees when connecting to understand capabilities
111
+ */
112
+ exports.warmupInitialization = {
113
+ name: 'cp-warmup-initialization',
114
+ title: 'Content Planner Warm-Up',
115
+ description: 'Initialize and warm up with Content Planner. Discover available tools and current system state.',
116
+ argsSchema: {
117
+ type: 'object',
118
+ properties: {},
119
+ required: [],
120
+ },
121
+ handler: () => ({
122
+ messages: [
123
+ {
124
+ role: 'user',
125
+ content: {
126
+ type: 'text',
127
+ text: `Welcome to Content Planner MCP Plugin!
128
+
129
+ You now have access to content planning and management tools. Let's warm up and understand what's available.
130
+
131
+ WARM-UP TASKS:
132
+
133
+ 1. DISCOVER AVAILABLE TOOLS
134
+ - Call: tools/list
135
+ - Look for tools starting with "contentplanner/"
136
+ - You should see tools like:
137
+ • contentplanner/get-oldest-task
138
+ • contentplanner/fetch-keywords
139
+ • contentplanner/fetch-instructions
140
+ • contentplanner/update-task
141
+
142
+ 2. CHECK SYSTEM STATE
143
+ Once you identify the tools, check the current state:
144
+
145
+ a) Check if Instructions exist:
146
+ - GET /api/cp-instructions?where[active][equals]=true
147
+ - If empty: System needs guidelines to be set up
148
+ - If exist: System is ready to create content
149
+
150
+ b) Check Content Tasks:
151
+ - GET /api/cp-content-tasks
152
+ - If empty: No tasks in queue
153
+ - If exist: Tasks available to execute
154
+
155
+ c) Check Keywords:
156
+ - GET /api/cp-keywords
157
+ - If empty: No keyword database
158
+ - If exist: Keywords available for content
159
+
160
+ 3. REPORT FINDINGS
161
+ After checking state, provide a summary:
162
+ - [ ] Which tools are available?
163
+ - [ ] Are instructions set up? (Y/N)
164
+ - [ ] Are there content tasks? (Y/N)
165
+ - [ ] Is keyword database populated? (Y/N)
166
+
167
+ 4. SUGGEST NEXT STEP
168
+ Based on what's missing:
169
+ - If NO instructions: Suggest running "cp-setup-instructions"
170
+ - If NO tasks: Suggest using "cp-generate-content-task"
171
+ - If NO keywords: Suggest populating keywords database
172
+ - If ready: Suggest executing "cp-execute-content-task"
173
+
174
+ GUIDELINES:
175
+ ✓ You are an AI content assistant with access to planning and management tools
176
+ ✓ You can discover, create, and execute content tasks
177
+ ✓ You should follow all guidelines and instructions stored in the system
178
+ ✓ Always mark tasks as done/blocked with appropriate notes
179
+ ✓ Ask clarifying questions if system state requires user input
180
+
181
+ Let's start! First, discover what tools are available.
182
+ `,
183
+ },
184
+ },
185
+ ],
186
+ }),
187
+ };
188
+ exports.setupInstructions = {
189
+ name: 'cp-setup-instructions',
190
+ title: 'Setup Content Planner',
191
+ description: 'Initialize content planning. Checks existing instructions and suggests what to create.',
192
+ argsSchema: {
193
+ type: 'object',
194
+ properties: {
195
+ brandName: {
196
+ type: 'string',
197
+ description: 'Your brand/company name',
198
+ },
199
+ category: {
200
+ type: 'string',
201
+ description: 'Content category (e.g., general, blog, product, social-media)',
202
+ },
203
+ },
204
+ required: ['brandName', 'category'],
205
+ },
206
+ handler: (args) => ({
207
+ messages: [
208
+ {
209
+ role: 'user',
210
+ content: {
211
+ type: 'text',
212
+ text: `Check and initialize content planner for: ${args.brandName} (${args.category})
213
+
214
+ STEP 1: Check existing instructions
215
+ - GET /api/cp-instructions?where[active][equals]=true
216
+ - If instructions exist, list them and suggest next step
217
+ - If none exist, ask what instruction types to create
218
+
219
+ STEP 2: If instructions exist
220
+ - User has guidelines established
221
+ - Next: Check if content tasks exist
222
+ - GET /api/cp-content-tasks
223
+ - If empty: suggest planning content
224
+ - If tasks exist: suggest executing them
225
+
226
+ STEP 3: If no instructions exist
227
+ - List available instruction types: tone-voice, writing-style, quality-standards, terminology, brand-guidelines, content-format
228
+ - Ask user which types they need
229
+ - For each type, ask them to define the content
230
+
231
+ RESPOND WITH:
232
+ 1. Current state (what instructions exist)
233
+ 2. If instructions exist: What to do next
234
+ 3. If instructions missing: What types are available + ask for content
235
+
236
+ Keep it generic - don't assume specific tone or standards. Let user define them.
237
+ `,
238
+ },
239
+ },
240
+ ],
241
+ }),
242
+ };
243
+ exports.generateContentTask = {
244
+ name: 'cp-generate-content-task',
245
+ title: 'Create Content Task',
246
+ description: 'Create a content task. Checks existing state and suggests planning if needed.',
247
+ argsSchema: {
248
+ type: 'object',
249
+ properties: {
250
+ taskType: {
251
+ type: 'string',
252
+ description: 'Type of task (e.g., Article, Review, Media, Translation, Audit)',
253
+ },
254
+ topic: {
255
+ type: 'string',
256
+ description: 'What the task is about',
257
+ },
258
+ },
259
+ required: ['taskType', 'topic'],
260
+ },
261
+ handler: (args) => ({
262
+ messages: [
263
+ {
264
+ role: 'user',
265
+ content: {
266
+ type: 'text',
267
+ text: `Create a content task.
268
+
269
+ Task: ${args.taskType} - ${args.topic}
270
+
271
+ STEP 1: Check system state
272
+ - GET /api/cp-instructions?where[active][equals]=true
273
+ - If empty: stop, user needs to run cp-setup-instructions first
274
+ - If exist: continue to step 2
275
+
276
+ - GET /api/cp-content-tasks
277
+ - If empty: this is first task, suggest user plan out a schedule
278
+ - If tasks exist: continue to step 2
279
+
280
+ STEP 2: Ask user for task details
281
+ Required fields:
282
+ - title (string, concise description)
283
+ - instructions (string, detailed steps to complete)
284
+ - priority (enum: low, normal, high)
285
+ - deadline (ISO date)
286
+ - tags (array of strings, for categorization)
287
+
288
+ Optional fields:
289
+ - assignedTo (user ID or name)
290
+ - notes (context or additional info)
291
+ - status (default: "todo")
292
+
293
+ STEP 3: Create task
294
+ - POST /api/cp-content-tasks
295
+ - Include all fields provided
296
+
297
+ RESPOND WITH:
298
+ 1. Check if instructions exist
299
+ 2. If no instructions: "Need to run cp-setup-instructions first"
300
+ 3. If instructions exist: Ask for task details above
301
+ 4. If no prior tasks: Suggest user plan out a content schedule
302
+ 5. Once details provided: Create task and return ID
303
+ `,
304
+ },
305
+ },
306
+ ],
307
+ }),
308
+ };
309
+ exports.executeContentTask = {
310
+ name: 'cp-execute-content-task',
311
+ title: 'Execute Content Task',
312
+ description: 'Execute a content task. Fetches guidelines, follows instructions, updates status.',
313
+ argsSchema: {
314
+ type: 'object',
315
+ properties: {
316
+ taskId: {
317
+ type: 'string',
318
+ description: 'ID of the cp-content-tasks record to execute',
319
+ },
320
+ },
321
+ required: ['taskId'],
322
+ },
323
+ handler: (args) => ({
324
+ messages: [
325
+ {
326
+ role: 'user',
327
+ content: {
328
+ type: 'text',
329
+ text: `Execute content task: ${args.taskId}
330
+
331
+ EXECUTION WORKFLOW:
332
+
333
+ STEP 1: Fetch Task
334
+ - GET /api/cp-content-tasks/${args.taskId}
335
+ - Extract: title, instructions, tags, status
336
+ - Verify status is "todo" or "in-progress"
337
+
338
+ STEP 2: Fetch Guidelines
339
+ - GET /api/cp-instructions?where[active][equals]=true
340
+ - Get all active instructions (tone, style, quality, terminology, etc)
341
+ - These guide your content generation
342
+
343
+ STEP 3: Update Status
344
+ - PATCH /api/cp-content-tasks/${args.taskId}
345
+ - Set: status: "in-progress"
346
+
347
+ STEP 4: Execute Task
348
+ - Follow the instructions field step-by-step
349
+ - Apply guidelines from cp-instructions
350
+ - Generate content according to task specs
351
+ - Use available Payload collections as needed
352
+
353
+ STEP 5: Handle Result
354
+
355
+ ON SUCCESS:
356
+ - PATCH /api/cp-content-tasks/${args.taskId}
357
+ - Set: status: "done"
358
+ - Add notes: "Completed. [Summary of what was created/done]"
359
+
360
+ ON FAILURE/BLOCKED:
361
+ - PATCH /api/cp-content-tasks/${args.taskId}
362
+ - Set: status: "blocked"
363
+ - Add notes: "[What went wrong]. [Required to unblock]"
364
+
365
+ CRITICAL RULES:
366
+ ✓ Follow instructions exactly
367
+ ✓ Apply all guidelines
368
+ ✓ Document results in notes
369
+ ✓ If resources missing, mark blocked with clear reason
370
+ `,
371
+ },
372
+ },
373
+ ],
374
+ }),
375
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@dudefactory/payload-plugin-content-planner",
3
+ "version": "3.0.0",
4
+ "description": "Payload CMS plugin that extends MCP with content planning collections and data sources",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "package.json"
18
+ ],
19
+ "keywords": [
20
+ "payload",
21
+ "cms",
22
+ "plugin",
23
+ "mcp",
24
+ "content",
25
+ "planner",
26
+ "scheduler",
27
+ "ai"
28
+ ],
29
+ "author": "DudeFactory",
30
+ "license": "MIT",
31
+ "peerDependencies": {
32
+ "payload": "^2.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "^5.0.0",
36
+ "@types/node": "^20.0.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/DudeFactory/payload-plugin-content-planner.git"
41
+ }
42
+ }