myaidev-method 0.2.19 โ 0.2.23
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/CHANGELOG.md +123 -5
- package/README.md +205 -13
- package/TECHNICAL_ARCHITECTURE.md +64 -2
- package/USER_GUIDE.md +453 -48
- package/bin/cli.js +187 -2
- package/content-rules.example.md +80 -0
- package/dist/mcp/mcp-config.json +138 -1
- package/dist/mcp/mcp-launcher.js +237 -0
- package/dist/mcp/openstack-server.js +1607 -0
- package/dist/server/.tsbuildinfo +1 -1
- package/dist/server/auth/layers.d.ts +1 -1
- package/dist/server/auth/services/AuthService.d.ts +1 -1
- package/dist/server/auth/services/TokenService.js.map +1 -1
- package/dist/server/auth/services/example.d.ts +5 -5
- package/package.json +17 -17
- package/src/config/workflows.js +532 -0
- package/src/index.js +21 -8
- package/src/lib/payloadcms-utils.js +206 -0
- package/src/lib/update-manager.js +2 -1
- package/src/lib/visual-config-utils.js +321 -295
- package/src/lib/visual-generation-utils.js +1080 -740
- package/src/lib/workflow-installer.js +512 -0
- package/src/libs/security/authorization-checker.js +606 -0
- package/src/mcp/openstack-server.js +1607 -0
- package/src/scripts/configure-wordpress-mcp.js +8 -3
- package/src/scripts/generate-visual-cli.js +365 -235
- package/src/scripts/openstack-setup.sh +110 -0
- package/src/scripts/ping.js +250 -0
- package/src/scripts/security/environment-detect.js +425 -0
- package/src/scripts/wordpress/publish-to-wordpress.js +165 -0
- package/src/server/auth/services/TokenService.ts +1 -1
- package/src/templates/claude/agents/content-rules-setup.md +657 -0
- package/src/templates/claude/agents/content-writer.md +328 -1
- package/src/templates/claude/agents/openstack-vm-manager.md +281 -0
- package/src/templates/claude/agents/osint-researcher.md +1075 -0
- package/src/templates/claude/agents/penetration-tester.md +908 -0
- package/src/templates/claude/agents/security-auditor.md +244 -0
- package/src/templates/claude/agents/security-setup.md +1094 -0
- package/src/templates/claude/agents/visual-content-generator.md +182 -4
- package/src/templates/claude/agents/webapp-security-tester.md +581 -0
- package/src/templates/claude/commands/myai-configure.md +85 -1
- package/src/templates/claude/commands/myai-content-rules-setup.md +204 -0
- package/src/templates/claude/commands/myai-openstack.md +229 -0
- package/src/templates/claude/commands/sc:security-exploit.md +464 -0
- package/src/templates/claude/commands/sc:security-recon.md +281 -0
- package/src/templates/claude/commands/sc:security-report.md +756 -0
- package/src/templates/claude/commands/sc:security-scan.md +441 -0
- package/src/templates/claude/commands/sc:security-setup.md +501 -0
- package/src/templates/codex/commands/myai-content-rules-setup.md +85 -0
- package/src/templates/gemini/commands/myai-content-rules-setup.toml +57 -0
- package/.claude/mcp/sparc-orchestrator-server.js +0 -607
- package/.claude/mcp/wordpress-server.js +0 -1277
- package/src/agents/content-writer-prompt.md +0 -164
- package/src/agents/content-writer.json +0 -70
- package/src/templates/claude/mcp_config.json +0 -30
- package/src/templates/claude/slash_commands.json +0 -166
- package/src/templates/scripts/configure-wordpress-mcp.js +0 -181
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# Content Writer Agent Prompt
|
|
2
|
-
|
|
3
|
-
You are a professional content writer with expertise in creating high-quality, engaging, and SEO-optimized content. Your role is to produce well-researched articles, blog posts, and web content that serves the target audience while meeting business objectives.
|
|
4
|
-
|
|
5
|
-
## Core Competencies
|
|
6
|
-
|
|
7
|
-
1. **Writing Excellence**
|
|
8
|
-
- Clear, concise, and engaging prose
|
|
9
|
-
- Proper grammar, spelling, and punctuation
|
|
10
|
-
- Varied sentence structure and rhythm
|
|
11
|
-
- Active voice preference
|
|
12
|
-
- Storytelling when appropriate
|
|
13
|
-
|
|
14
|
-
2. **SEO Optimization**
|
|
15
|
-
- Natural keyword integration
|
|
16
|
-
- Proper heading hierarchy (H1, H2, H3)
|
|
17
|
-
- Meta descriptions (150-160 characters)
|
|
18
|
-
- Internal and external linking suggestions
|
|
19
|
-
- URL-friendly slugs
|
|
20
|
-
- Alt text recommendations for images
|
|
21
|
-
|
|
22
|
-
3. **Content Structure**
|
|
23
|
-
- Compelling introductions with hooks
|
|
24
|
-
- Logical flow and transitions
|
|
25
|
-
- Scannable formatting (bullets, lists, short paragraphs)
|
|
26
|
-
- Strong conclusions with CTAs when appropriate
|
|
27
|
-
- Pull quotes and highlights for emphasis
|
|
28
|
-
|
|
29
|
-
4. **Research & Accuracy**
|
|
30
|
-
- Fact-checking all claims
|
|
31
|
-
- Citing credible sources
|
|
32
|
-
- Staying current with industry trends
|
|
33
|
-
- Understanding the target audience
|
|
34
|
-
- Competitive content analysis
|
|
35
|
-
|
|
36
|
-
## Writing Process
|
|
37
|
-
|
|
38
|
-
### Phase 1: Understanding
|
|
39
|
-
- Identify the content purpose and goals
|
|
40
|
-
- Define the target audience
|
|
41
|
-
- Determine the desired tone and style
|
|
42
|
-
- Clarify key messages and takeaways
|
|
43
|
-
|
|
44
|
-
### Phase 2: Research
|
|
45
|
-
- Conduct thorough topic research
|
|
46
|
-
- Analyze competitor content
|
|
47
|
-
- Identify knowledge gaps to fill
|
|
48
|
-
- Gather statistics and expert quotes
|
|
49
|
-
- Find relevant examples and case studies
|
|
50
|
-
|
|
51
|
-
### Phase 3: Planning
|
|
52
|
-
- Create a detailed outline
|
|
53
|
-
- Organize information logically
|
|
54
|
-
- Plan keyword placement
|
|
55
|
-
- Identify supporting media needs
|
|
56
|
-
|
|
57
|
-
### Phase 4: Writing
|
|
58
|
-
- Craft an attention-grabbing headline
|
|
59
|
-
- Write a compelling introduction
|
|
60
|
-
- Develop body content with proper structure
|
|
61
|
-
- Include relevant examples and data
|
|
62
|
-
- Create a memorable conclusion
|
|
63
|
-
|
|
64
|
-
### Phase 5: Optimization
|
|
65
|
-
- Review for SEO best practices
|
|
66
|
-
- Ensure readability (Flesch score 60+)
|
|
67
|
-
- Add internal/external link suggestions
|
|
68
|
-
- Include meta description
|
|
69
|
-
- Suggest related content
|
|
70
|
-
|
|
71
|
-
### Phase 6: Final Review
|
|
72
|
-
- Proofread for errors
|
|
73
|
-
- Check factual accuracy
|
|
74
|
-
- Verify tone consistency
|
|
75
|
-
- Ensure goal alignment
|
|
76
|
-
|
|
77
|
-
## Content Guidelines
|
|
78
|
-
|
|
79
|
-
### Tone and Voice
|
|
80
|
-
- Professional yet approachable
|
|
81
|
-
- Confident without being condescending
|
|
82
|
-
- Informative and educational
|
|
83
|
-
- Engaging and conversational when appropriate
|
|
84
|
-
|
|
85
|
-
### Formatting Standards
|
|
86
|
-
- Use Markdown for all content
|
|
87
|
-
- Headers: H1 for title, H2 for main sections, H3 for subsections
|
|
88
|
-
- Paragraphs: 2-4 sentences maximum
|
|
89
|
-
- Lists: Use when presenting 3+ related items
|
|
90
|
-
- Emphasis: Bold for key terms, italics for emphasis
|
|
91
|
-
- Links: Descriptive anchor text
|
|
92
|
-
|
|
93
|
-
### SEO Best Practices
|
|
94
|
-
- Primary keyword in title, first paragraph, and H2s
|
|
95
|
-
- Related keywords throughout naturally
|
|
96
|
-
- Answer user intent clearly
|
|
97
|
-
- Include LSI (Latent Semantic Indexing) keywords
|
|
98
|
-
- Optimize for featured snippets when relevant
|
|
99
|
-
|
|
100
|
-
## Output Requirements
|
|
101
|
-
|
|
102
|
-
For each content piece, provide:
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"title": "Compelling, keyword-rich title",
|
|
107
|
-
"meta_description": "150-160 character summary for search results",
|
|
108
|
-
"slug": "url-friendly-version-of-title",
|
|
109
|
-
"content": "Full markdown-formatted content",
|
|
110
|
-
"tags": ["relevant", "topic", "tags"],
|
|
111
|
-
"category": "Primary category",
|
|
112
|
-
"featured_image_suggestion": "Description of ideal hero image",
|
|
113
|
-
"word_count": 800,
|
|
114
|
-
"reading_time": "4 minutes",
|
|
115
|
-
"keywords": {
|
|
116
|
-
"primary": "main keyword",
|
|
117
|
-
"secondary": ["supporting", "keywords"]
|
|
118
|
-
},
|
|
119
|
-
"internal_links": [
|
|
120
|
-
{
|
|
121
|
-
"anchor_text": "relevant text",
|
|
122
|
-
"suggested_url": "/path/to/related/content"
|
|
123
|
-
}
|
|
124
|
-
],
|
|
125
|
-
"external_links": [
|
|
126
|
-
{
|
|
127
|
-
"anchor_text": "source or reference",
|
|
128
|
-
"url": "https://authoritative-source.com"
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Quality Checklist
|
|
135
|
-
|
|
136
|
-
Before finalizing any content, ensure:
|
|
137
|
-
|
|
138
|
-
- [ ] Title is compelling and includes primary keyword
|
|
139
|
-
- [ ] Introduction hooks the reader within first 2 sentences
|
|
140
|
-
- [ ] Content thoroughly addresses user intent
|
|
141
|
-
- [ ] All facts are accurate and verifiable
|
|
142
|
-
- [ ] Proper heading hierarchy is maintained
|
|
143
|
-
- [ ] Content is scannable with varied formatting
|
|
144
|
-
- [ ] Keywords are naturally integrated
|
|
145
|
-
- [ ] Meta description summarizes content effectively
|
|
146
|
-
- [ ] Conclusion provides value and next steps
|
|
147
|
-
- [ ] No spelling or grammar errors
|
|
148
|
-
- [ ] Tone is consistent throughout
|
|
149
|
-
- [ ] Content is original and adds unique value
|
|
150
|
-
|
|
151
|
-
## Special Instructions
|
|
152
|
-
|
|
153
|
-
When creating content:
|
|
154
|
-
|
|
155
|
-
1. Always prioritize user value over keyword density
|
|
156
|
-
2. Write for humans first, search engines second
|
|
157
|
-
3. Include actionable takeaways when relevant
|
|
158
|
-
4. Use data and examples to support claims
|
|
159
|
-
5. Address common questions and objections
|
|
160
|
-
6. Consider content repurposing opportunities
|
|
161
|
-
7. Suggest complementary content pieces
|
|
162
|
-
8. Include social media snippets when requested
|
|
163
|
-
|
|
164
|
-
Remember: Quality content builds trust, authority, and engagement. Every piece should serve the reader while achieving business objectives.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content-writer",
|
|
3
|
-
"description": "Professional content writer agent for creating high-quality articles, blog posts, and web content",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"tools": ["Read", "Write", "Edit", "WebSearch", "WebFetch"],
|
|
6
|
-
"prompt": {
|
|
7
|
-
"role": "You are a professional content writer specializing in creating engaging, SEO-optimized content.",
|
|
8
|
-
"instructions": [
|
|
9
|
-
"Write in a clear, engaging, and professional tone",
|
|
10
|
-
"Structure content with proper headings (H1, H2, H3)",
|
|
11
|
-
"Include relevant keywords naturally throughout the content",
|
|
12
|
-
"Ensure content is factually accurate and well-researched",
|
|
13
|
-
"Create compelling introductions and conclusions",
|
|
14
|
-
"Use bullet points and numbered lists where appropriate",
|
|
15
|
-
"Maintain a consistent voice and style throughout",
|
|
16
|
-
"Optimize for readability with short paragraphs and varied sentence structure",
|
|
17
|
-
"Include a meta description suggestion when appropriate",
|
|
18
|
-
"Format content in Markdown for easy conversion to HTML"
|
|
19
|
-
],
|
|
20
|
-
"workflow": [
|
|
21
|
-
{
|
|
22
|
-
"step": 1,
|
|
23
|
-
"action": "Understand the topic and target audience",
|
|
24
|
-
"description": "Analyze the content request to identify key topics, audience, and goals"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"step": 2,
|
|
28
|
-
"action": "Research and gather information",
|
|
29
|
-
"description": "Use WebSearch and WebFetch to gather relevant, up-to-date information"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"step": 3,
|
|
33
|
-
"action": "Create content outline",
|
|
34
|
-
"description": "Structure the content with logical flow and proper headings"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"step": 4,
|
|
38
|
-
"action": "Write the content",
|
|
39
|
-
"description": "Create the full content following SEO best practices"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"step": 5,
|
|
43
|
-
"action": "Review and optimize",
|
|
44
|
-
"description": "Review for clarity, accuracy, and SEO optimization"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"step": 6,
|
|
48
|
-
"action": "Format and finalize",
|
|
49
|
-
"description": "Ensure proper Markdown formatting and prepare for publishing"
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
"output_format": {
|
|
53
|
-
"title": "string",
|
|
54
|
-
"meta_description": "string (150-160 characters)",
|
|
55
|
-
"slug": "string (URL-friendly)",
|
|
56
|
-
"content": "markdown string",
|
|
57
|
-
"tags": ["array", "of", "relevant", "tags"],
|
|
58
|
-
"category": "string",
|
|
59
|
-
"featured_image_suggestion": "string (description for image selection)"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"configuration": {
|
|
63
|
-
"default_word_count": 800,
|
|
64
|
-
"min_word_count": 300,
|
|
65
|
-
"max_word_count": 2500,
|
|
66
|
-
"seo_optimization": true,
|
|
67
|
-
"include_meta": true,
|
|
68
|
-
"markdown_output": true
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mcpServers": {
|
|
3
|
-
"wordpress": {
|
|
4
|
-
"command": "node",
|
|
5
|
-
"args": ["../../mcp/wordpress-server.js"],
|
|
6
|
-
"env": {
|
|
7
|
-
"WORDPRESS_URL": "${WORDPRESS_URL}",
|
|
8
|
-
"WORDPRESS_USERNAME": "${WORDPRESS_USERNAME}",
|
|
9
|
-
"WORDPRESS_APP_PASSWORD": "${WORDPRESS_APP_PASSWORD}"
|
|
10
|
-
},
|
|
11
|
-
"autoStart": false,
|
|
12
|
-
"description": "WordPress MCP server for content management",
|
|
13
|
-
"tools": [
|
|
14
|
-
"wp_create_post",
|
|
15
|
-
"wp_update_post",
|
|
16
|
-
"wp_get_post",
|
|
17
|
-
"wp_list_posts",
|
|
18
|
-
"wp_upload_media",
|
|
19
|
-
"wp_create_category",
|
|
20
|
-
"wp_create_tag"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"configuration": {
|
|
25
|
-
"auto_connect": false,
|
|
26
|
-
"retry_on_failure": true,
|
|
27
|
-
"max_retries": 3,
|
|
28
|
-
"timeout": 30000
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"commands": [
|
|
3
|
-
{
|
|
4
|
-
"name": "myai-content-writer",
|
|
5
|
-
"description": "Launch the professional content writer agent for creating articles and blog posts",
|
|
6
|
-
"handler": "content-writer",
|
|
7
|
-
"configuration": {
|
|
8
|
-
"agent_file": "../../agents/content-writer.json",
|
|
9
|
-
"prompt_file": "../../agents/content-writer-prompt.md",
|
|
10
|
-
"tools": ["Read", "Write", "Edit", "WebSearch", "WebFetch", "Task"],
|
|
11
|
-
"parameters": {
|
|
12
|
-
"topic": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"required": true,
|
|
15
|
-
"description": "The topic or title for the content"
|
|
16
|
-
},
|
|
17
|
-
"word_count": {
|
|
18
|
-
"type": "number",
|
|
19
|
-
"required": false,
|
|
20
|
-
"default": 800,
|
|
21
|
-
"description": "Target word count for the content"
|
|
22
|
-
},
|
|
23
|
-
"audience": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"required": false,
|
|
26
|
-
"description": "Target audience for the content"
|
|
27
|
-
},
|
|
28
|
-
"tone": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"required": false,
|
|
31
|
-
"default": "professional",
|
|
32
|
-
"options": ["professional", "casual", "technical", "conversational", "academic"],
|
|
33
|
-
"description": "Tone of voice for the content"
|
|
34
|
-
},
|
|
35
|
-
"seo_keywords": {
|
|
36
|
-
"type": "array",
|
|
37
|
-
"required": false,
|
|
38
|
-
"description": "Primary and secondary keywords for SEO"
|
|
39
|
-
},
|
|
40
|
-
"publish_to_wordpress": {
|
|
41
|
-
"type": "boolean",
|
|
42
|
-
"required": false,
|
|
43
|
-
"default": false,
|
|
44
|
-
"description": "Automatically publish as draft to WordPress"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"examples": [
|
|
49
|
-
{
|
|
50
|
-
"command": "/myai-content-writer \"10 Best Practices for Remote Work\"",
|
|
51
|
-
"description": "Create an article about remote work best practices"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"command": "/myai-content-writer \"AI in Healthcare\" --word_count 1500 --tone technical --audience \"healthcare professionals\"",
|
|
55
|
-
"description": "Create a technical article about AI in healthcare for professionals"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"command": "/myai-content-writer \"Summer Garden Tips\" --seo_keywords \"garden tips,summer gardening,outdoor plants\" --publish_to_wordpress true",
|
|
59
|
-
"description": "Create SEO-optimized garden content and publish to WordPress"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
"workflow": {
|
|
63
|
-
"steps": [
|
|
64
|
-
{
|
|
65
|
-
"step": 1,
|
|
66
|
-
"action": "Parse command parameters",
|
|
67
|
-
"description": "Extract topic, word count, and other parameters from the command"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"step": 2,
|
|
71
|
-
"action": "Load agent configuration",
|
|
72
|
-
"description": "Load the content-writer agent configuration and prompt"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"step": 3,
|
|
76
|
-
"action": "Initialize agent with prompt",
|
|
77
|
-
"description": "Initialize the agent with the specialized content writer prompt"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"step": 4,
|
|
81
|
-
"action": "Execute content creation",
|
|
82
|
-
"description": "Agent researches and creates the content following the workflow"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"step": 5,
|
|
86
|
-
"action": "Save content locally",
|
|
87
|
-
"description": "Save the generated content to a markdown file"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"step": 6,
|
|
91
|
-
"action": "Publish to WordPress (optional)",
|
|
92
|
-
"description": "If requested, publish the content as a draft to WordPress"
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"name": "myai-wordpress-publish",
|
|
99
|
-
"description": "Publish existing content to WordPress as a draft",
|
|
100
|
-
"handler": "wordpress-publisher",
|
|
101
|
-
"configuration": {
|
|
102
|
-
"mcp_config": "../../mcp/wordpress-mcp.json",
|
|
103
|
-
"tools": ["Read", "Task"],
|
|
104
|
-
"parameters": {
|
|
105
|
-
"file": {
|
|
106
|
-
"type": "string",
|
|
107
|
-
"required": true,
|
|
108
|
-
"description": "Path to the markdown file to publish"
|
|
109
|
-
},
|
|
110
|
-
"status": {
|
|
111
|
-
"type": "string",
|
|
112
|
-
"required": false,
|
|
113
|
-
"default": "draft",
|
|
114
|
-
"options": ["draft", "publish", "pending", "private"],
|
|
115
|
-
"description": "WordPress post status"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"examples": [
|
|
120
|
-
{
|
|
121
|
-
"command": "/myai-wordpress-publish \"content/my-article.md\"",
|
|
122
|
-
"description": "Publish a markdown file to WordPress as draft"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"command": "/myai-wordpress-publish \"blog-post.md\" --status publish",
|
|
126
|
-
"description": "Publish directly to WordPress (live)"
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"name": "myai-configure",
|
|
132
|
-
"description": "Configure MyAI settings including WordPress credentials",
|
|
133
|
-
"handler": "configuration",
|
|
134
|
-
"configuration": {
|
|
135
|
-
"tools": ["Read", "Write", "Edit"],
|
|
136
|
-
"parameters": {
|
|
137
|
-
"setting": {
|
|
138
|
-
"type": "string",
|
|
139
|
-
"required": true,
|
|
140
|
-
"options": ["wordpress", "defaults", "agents"],
|
|
141
|
-
"description": "Which setting to configure"
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"examples": [
|
|
146
|
-
{
|
|
147
|
-
"command": "/myai-configure wordpress",
|
|
148
|
-
"description": "Configure WordPress connection settings"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"command": "/myai-configure defaults",
|
|
152
|
-
"description": "Configure default settings for content creation"
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
"global_configuration": {
|
|
158
|
-
"prefix": "myai",
|
|
159
|
-
"version": "1.0.0",
|
|
160
|
-
"auto_load": true,
|
|
161
|
-
"requirements": {
|
|
162
|
-
"claude_code_version": ">=1.0.0",
|
|
163
|
-
"node_version": ">=18.0.0"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Configure WordPress MCP integration for Claude Code
|
|
13
|
-
* This script creates the .mcp.json file required for Claude Code to recognize
|
|
14
|
-
* and use the WordPress MCP server
|
|
15
|
-
*/
|
|
16
|
-
export async function configureWordPressMCP(projectDir = process.cwd()) {
|
|
17
|
-
try {
|
|
18
|
-
console.log('๐ง Configuring WordPress MCP integration...');
|
|
19
|
-
|
|
20
|
-
// Load environment variables from .env file
|
|
21
|
-
const envPath = path.join(projectDir, '.env');
|
|
22
|
-
if (!fs.existsSync(envPath)) {
|
|
23
|
-
throw new Error('.env file not found. Please run WordPress configuration first.');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
dotenv.config({ path: envPath });
|
|
27
|
-
|
|
28
|
-
// Validate required environment variables
|
|
29
|
-
const requiredVars = ['WORDPRESS_URL', 'WORDPRESS_USERNAME', 'WORDPRESS_APP_PASSWORD'];
|
|
30
|
-
const missing = requiredVars.filter(varName => !process.env[varName]);
|
|
31
|
-
|
|
32
|
-
if (missing.length > 0) {
|
|
33
|
-
throw new Error(`Missing required environment variables: ${missing.join(', ')}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Check if MCP server files exist
|
|
37
|
-
const mcpServerPath = path.join(projectDir, '.claude/mcp/wordpress-server.js');
|
|
38
|
-
const gutenbergConverterPath = path.join(projectDir, '.claude/mcp/gutenberg-converter.js');
|
|
39
|
-
|
|
40
|
-
if (!fs.existsSync(mcpServerPath)) {
|
|
41
|
-
throw new Error(`WordPress MCP server not found at: ${mcpServerPath}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(gutenbergConverterPath)) {
|
|
45
|
-
throw new Error(`Gutenberg converter not found at: ${gutenbergConverterPath}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Create MCP configuration
|
|
49
|
-
const mcpConfigPath = path.join(projectDir, '.mcp.json');
|
|
50
|
-
|
|
51
|
-
// Use relative path for portability across different environments
|
|
52
|
-
const relativeMcpServerPath = ".claude/mcp/wordpress-server.js";
|
|
53
|
-
|
|
54
|
-
const mcpConfig = {
|
|
55
|
-
mcpServers: {
|
|
56
|
-
wordpress: {
|
|
57
|
-
command: "node",
|
|
58
|
-
args: [relativeMcpServerPath],
|
|
59
|
-
env: {
|
|
60
|
-
WORDPRESS_URL: process.env.WORDPRESS_URL,
|
|
61
|
-
WORDPRESS_USERNAME: process.env.WORDPRESS_USERNAME,
|
|
62
|
-
WORDPRESS_APP_PASSWORD: process.env.WORDPRESS_APP_PASSWORD,
|
|
63
|
-
WORDPRESS_USE_GUTENBERG: process.env.WORDPRESS_USE_GUTENBERG || "false"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// If .mcp.json already exists, merge with existing configuration
|
|
70
|
-
let existingConfig = {};
|
|
71
|
-
if (fs.existsSync(mcpConfigPath)) {
|
|
72
|
-
try {
|
|
73
|
-
existingConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
74
|
-
console.log('๐ Found existing .mcp.json file, merging configuration...');
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.warn('โ ๏ธ Existing .mcp.json file is invalid, creating new one...');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Merge configurations
|
|
81
|
-
const finalConfig = {
|
|
82
|
-
...existingConfig,
|
|
83
|
-
mcpServers: {
|
|
84
|
-
...existingConfig.mcpServers,
|
|
85
|
-
...mcpConfig.mcpServers
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// Write MCP configuration file
|
|
90
|
-
fs.writeFileSync(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
91
|
-
console.log('โ
Created .mcp.json configuration file');
|
|
92
|
-
|
|
93
|
-
// Set executable permissions on MCP server
|
|
94
|
-
try {
|
|
95
|
-
fs.chmodSync(mcpServerPath, 0o755);
|
|
96
|
-
console.log('โ
Set executable permissions on WordPress MCP server');
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.warn('โ ๏ธ Could not set executable permissions:', error.message);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Test MCP server startup
|
|
102
|
-
console.log('๐งช Testing MCP server startup...');
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
const { spawn } = await import('child_process');
|
|
106
|
-
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
const testProcess = spawn('node', [relativeMcpServerPath], {
|
|
109
|
-
cwd: projectDir, // Set working directory to project root
|
|
110
|
-
env: { ...process.env, ...mcpConfig.mcpServers.wordpress.env },
|
|
111
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
let stderr = '';
|
|
115
|
-
testProcess.stderr.on('data', (data) => {
|
|
116
|
-
stderr += data.toString();
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// Give the server 3 seconds to start up
|
|
120
|
-
setTimeout(() => {
|
|
121
|
-
testProcess.kill('SIGTERM');
|
|
122
|
-
|
|
123
|
-
if (stderr.includes('WordPress MCP Server running') || stderr.includes('Server running')) {
|
|
124
|
-
console.log('โ
MCP server startup test successful');
|
|
125
|
-
resolve(true);
|
|
126
|
-
} else if (stderr.includes('Error') || stderr.includes('Missing required environment')) {
|
|
127
|
-
console.error('โ MCP server startup failed:', stderr);
|
|
128
|
-
reject(new Error('MCP server failed to start'));
|
|
129
|
-
} else {
|
|
130
|
-
console.log('โ
MCP server appears to be working');
|
|
131
|
-
resolve(true);
|
|
132
|
-
}
|
|
133
|
-
}, 3000);
|
|
134
|
-
|
|
135
|
-
testProcess.on('error', (error) => {
|
|
136
|
-
reject(new Error(`Failed to start MCP server: ${error.message}`));
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
} catch (testError) {
|
|
140
|
-
console.warn('โ ๏ธ Could not test MCP server startup:', testError.message);
|
|
141
|
-
console.log(' MCP configuration created, but please test manually if needed');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
console.log('\n๐ WordPress MCP integration configured successfully!');
|
|
145
|
-
console.log('\n๐ Configuration Summary:');
|
|
146
|
-
console.log(` โข WordPress URL: ${process.env.WORDPRESS_URL}`);
|
|
147
|
-
console.log(` โข Username: ${process.env.WORDPRESS_USERNAME}`);
|
|
148
|
-
console.log(` โข Gutenberg mode: ${process.env.WORDPRESS_USE_GUTENBERG || 'false'}`);
|
|
149
|
-
console.log(` โข MCP config: ${mcpConfigPath}`);
|
|
150
|
-
console.log(` โข MCP server: ${relativeMcpServerPath}`);
|
|
151
|
-
|
|
152
|
-
console.log('\n๐ Next steps:');
|
|
153
|
-
console.log(' 1. Restart Claude Code to load the new MCP configuration');
|
|
154
|
-
console.log(' 2. Use WordPress MCP tools in your agents and commands');
|
|
155
|
-
console.log(' 3. Test with: /myai-wordpress-admin or /myai-wordpress-publish');
|
|
156
|
-
|
|
157
|
-
return true;
|
|
158
|
-
|
|
159
|
-
} catch (error) {
|
|
160
|
-
console.error('โ WordPress MCP configuration failed:', error.message);
|
|
161
|
-
console.log('\n๐ ๏ธ Troubleshooting:');
|
|
162
|
-
console.log(' โข Ensure WordPress credentials are configured in .env');
|
|
163
|
-
console.log(' โข Check that .claude/mcp/wordpress-server.js exists');
|
|
164
|
-
console.log(' โข Verify Node.js version is 18+ (required for MCP SDK)');
|
|
165
|
-
console.log(' โข Run: npm install to ensure dependencies are installed');
|
|
166
|
-
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Allow running as standalone script
|
|
172
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
173
|
-
configureWordPressMCP()
|
|
174
|
-
.then((success) => {
|
|
175
|
-
process.exit(success ? 0 : 1);
|
|
176
|
-
})
|
|
177
|
-
.catch((error) => {
|
|
178
|
-
console.error('Configuration script error:', error);
|
|
179
|
-
process.exit(1);
|
|
180
|
-
});
|
|
181
|
-
}
|