0xray 2.1.2 → 2.1.4

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.
Files changed (250) hide show
  1. package/.opencode/codex.codex +1 -1
  2. package/.opencode/commands/dependency-audit.md +3 -3
  3. package/.opencode/enforcer-config.json +2 -2
  4. package/AGENTS.md +2 -1
  5. package/README.md +12 -11
  6. package/dist/AGENTS.md +2 -1
  7. package/dist/CHANGELOG.md +38 -0
  8. package/dist/README.md +12 -11
  9. package/dist/agents/code-reviewer.js +1 -1
  10. package/dist/analytics/routing-refiner.js +1 -1
  11. package/dist/cli/index.js +11 -1
  12. package/dist/cli/server.js +3 -3
  13. package/dist/core/activity-logger.d.ts +2 -2
  14. package/dist/core/activity-logger.js +4 -4
  15. package/dist/core/boot-orchestrator.d.ts +1 -1
  16. package/dist/core/boot-orchestrator.js +13 -28
  17. package/dist/core/bridge.mjs +3 -3
  18. package/dist/core/codex-formatter.js +2 -2
  19. package/dist/core/codex-injector.d.ts +0 -1
  20. package/dist/core/codex-injector.js +2 -3
  21. package/dist/core/config-loader.d.ts +1 -1
  22. package/dist/core/config-loader.js +1 -1
  23. package/dist/core/config-paths.d.ts +0 -2
  24. package/dist/core/config-paths.js +7 -8
  25. package/dist/core/context-loader.d.ts +1 -1
  26. package/dist/core/context-loader.js +1 -1
  27. package/dist/core/errors.d.ts +3 -0
  28. package/dist/core/errors.js +10 -0
  29. package/dist/core/features-config.js +1 -1
  30. package/dist/core/framework-logger.d.ts +3 -3
  31. package/dist/core/framework-logger.js +17 -9
  32. package/dist/core/index.d.ts +2 -2
  33. package/dist/core/index.js +4 -2
  34. package/dist/core/logging-config.d.ts +2 -1
  35. package/dist/core/logging-config.js +7 -7
  36. package/dist/enforcement/loaders/codex-loader.js +1 -1
  37. package/dist/execution/opencode-cli-invoker.js +5 -5
  38. package/dist/governance/governance-service.js +1 -1
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +3 -3
  41. package/dist/inference/inference-cycle.d.ts +1 -1
  42. package/dist/inference/inference-cycle.js +10 -10
  43. package/dist/integrations/base/Integration.js +1 -1
  44. package/dist/integrations/base/registry.js +19 -19
  45. package/dist/integrations/grok/grok-cli.js +17 -17
  46. package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
  47. package/dist/integrations/hermes-agent/bridge.mjs +1 -1
  48. package/dist/integrations/openclaw/api-server.d.ts +0 -1
  49. package/dist/integrations/openclaw/api-server.js +7 -10
  50. package/dist/integrations/openclaw/client.d.ts +0 -1
  51. package/dist/integrations/openclaw/client.js +22 -24
  52. package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
  53. package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
  54. package/dist/integrations/plugins/plugin-registry.js +5 -5
  55. package/dist/mcps/architect-tools.server.d.ts +2 -4
  56. package/dist/mcps/architect-tools.server.js +112 -195
  57. package/dist/mcps/auto-format.server.d.ts +2 -4
  58. package/dist/mcps/auto-format.server.js +49 -95
  59. package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
  60. package/dist/mcps/boot-orchestrator.server.js +73 -105
  61. package/dist/mcps/config/server-config-registry.js +3 -3
  62. package/dist/mcps/enforcer-tools.server.d.ts +2 -4
  63. package/dist/mcps/enforcer-tools.server.js +202 -285
  64. package/dist/mcps/estimation.server.d.ts +2 -4
  65. package/dist/mcps/estimation.server.js +63 -107
  66. package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
  67. package/dist/mcps/framework-compliance-audit.server.js +53 -82
  68. package/dist/mcps/framework-help.server.d.ts +2 -4
  69. package/dist/mcps/framework-help.server.js +63 -101
  70. package/dist/mcps/governance.server.js +2 -2
  71. package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
  72. package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
  73. package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
  74. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
  75. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
  76. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
  77. package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
  78. package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
  79. package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
  80. package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
  81. package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
  82. package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
  83. package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
  84. package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
  85. package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
  86. package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
  87. package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
  88. package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
  89. package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
  90. package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
  91. package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
  92. package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
  93. package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
  94. package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
  95. package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
  96. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
  97. package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
  98. package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
  99. package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
  100. package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
  101. package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
  102. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
  103. package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
  104. package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
  105. package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
  106. package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
  107. package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
  108. package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
  109. package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
  110. package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
  111. package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
  112. package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
  113. package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
  114. package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
  115. package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
  116. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
  117. package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
  118. package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
  119. package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
  120. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
  121. package/dist/mcps/lint.server.d.ts +2 -4
  122. package/dist/mcps/lint.server.js +51 -92
  123. package/dist/mcps/mcp-client.js +2 -2
  124. package/dist/mcps/model-health-check.server.d.ts +2 -4
  125. package/dist/mcps/model-health-check.server.js +32 -60
  126. package/dist/mcps/performance-analysis.server.d.ts +2 -4
  127. package/dist/mcps/performance-analysis.server.js +57 -88
  128. package/dist/mcps/processor-pipeline.server.d.ts +2 -4
  129. package/dist/mcps/processor-pipeline.server.js +69 -100
  130. package/dist/mcps/registry.json +1 -1
  131. package/dist/mcps/researcher.server.d.ts +3 -5
  132. package/dist/mcps/researcher.server.js +81 -154
  133. package/dist/mcps/security-scan.server.d.ts +2 -4
  134. package/dist/mcps/security-scan.server.js +54 -96
  135. package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
  136. package/dist/mcps/shared/knowledge-skill-base.js +45 -0
  137. package/dist/{security → mcps/shared}/security-scanner.js +1 -1
  138. package/dist/mcps/state-manager.server.d.ts +2 -4
  139. package/dist/mcps/state-manager.server.js +115 -160
  140. package/dist/orchestrator/orchestrator.d.ts +1 -1
  141. package/dist/orchestrator/orchestrator.js +1 -1
  142. package/dist/orchestrator/universal-registry-bridge.js +1 -1
  143. package/dist/plugin/xray-codex-injection.d.ts +1 -1
  144. package/dist/plugin/xray-codex-injection.js +1 -1
  145. package/dist/postprocessor/PostProcessor.d.ts +4 -44
  146. package/dist/postprocessor/PostProcessor.js +39 -553
  147. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
  148. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
  149. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
  150. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
  151. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
  152. package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
  153. package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
  154. package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
  155. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
  156. package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
  157. package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
  158. package/dist/processors/processor-manager.js +346 -314
  159. package/dist/reporting/report-formatter.js +1 -1
  160. package/dist/security/security-hardener.d.ts +69 -2
  161. package/dist/security/security-hardener.js +129 -1
  162. package/dist/skills/registry.json +1 -1
  163. package/dist/state/index.d.ts +3 -5
  164. package/dist/state/index.js +1 -7
  165. package/dist/state/state-manager.d.ts +1 -1
  166. package/dist/state/state-manager.js +2 -3
  167. package/package.json +13 -10
  168. package/scripts/node/universal-version-manager.js +11 -11
  169. package/src/mcps/architect-tools.server.ts +112 -215
  170. package/src/mcps/auto-format.server.ts +50 -110
  171. package/src/mcps/boot-orchestrator.server.ts +75 -121
  172. package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
  173. package/src/mcps/config/server-config-registry.ts +3 -3
  174. package/src/mcps/enforcer-tools.server.ts +212 -310
  175. package/src/mcps/estimation.server.ts +62 -122
  176. package/src/mcps/framework-compliance-audit.server.ts +52 -97
  177. package/src/mcps/framework-help.server.ts +64 -114
  178. package/src/mcps/governance.server.ts +2 -2
  179. package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
  180. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
  181. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
  182. package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
  183. package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
  184. package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
  185. package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
  186. package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
  187. package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
  188. package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
  189. package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
  190. package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
  191. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
  192. package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
  193. package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
  194. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
  195. package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
  196. package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
  197. package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
  198. package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
  199. package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
  200. package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
  201. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
  202. package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
  203. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
  204. package/src/mcps/lint.server.ts +53 -107
  205. package/src/mcps/mcp-client.ts +2 -2
  206. package/src/mcps/model-health-check.server.ts +34 -71
  207. package/src/mcps/performance-analysis.server.ts +60 -104
  208. package/src/mcps/processor-pipeline.server.ts +72 -110
  209. package/src/mcps/registry.json +1 -1
  210. package/src/mcps/researcher.server.ts +88 -177
  211. package/src/mcps/security-scan.server.ts +55 -104
  212. package/src/mcps/shared/knowledge-skill-base.ts +62 -0
  213. package/src/mcps/shared/prompt-security-validator.ts +199 -0
  214. package/src/mcps/shared/security-scanner.ts +599 -0
  215. package/src/mcps/state-manager.server.ts +117 -175
  216. package/src/opencode/codex.codex +1 -1
  217. package/src/opencode/commands/dependency-audit.md +3 -3
  218. package/src/opencode/enforcer-config.json +2 -2
  219. package/src/skills/registry.json +1 -1
  220. package/xray/codex.json +1 -1
  221. package/xray/config.json +1 -1
  222. package/xray/features.json +1 -1
  223. package/xray/integrations.json +3 -3
  224. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  225. package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  226. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  227. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
  228. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
  229. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  230. package/dist/integrations/hermes-agent/conftest.py +0 -14
  231. package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
  232. package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
  233. package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
  234. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  235. package/dist/processors/implementations/session-capture-processor.js +0 -37
  236. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  237. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  238. package/dist/security/index.d.ts +0 -13
  239. package/dist/security/index.js +0 -13
  240. package/dist/security/security-agent-coordinator.d.ts +0 -72
  241. package/dist/security/security-agent-coordinator.js +0 -204
  242. package/dist/security/security-auditor.d.ts +0 -56
  243. package/dist/security/security-auditor.js +0 -584
  244. package/dist/security/security-hardening-system.d.ts +0 -239
  245. package/dist/security/security-hardening-system.js +0 -727
  246. package/dist/security/security-orchestration-layer.d.ts +0 -119
  247. package/dist/security/security-orchestration-layer.js +0 -496
  248. /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
  249. /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
  250. /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
@@ -5,296 +5,259 @@
5
5
  * Provides keyword optimization, meta descriptions, headlines, and conversion copy.
6
6
  */
7
7
 
8
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
- import {
11
- CallToolRequestSchema,
12
- ListToolsRequestSchema,
13
- } from "@modelcontextprotocol/sdk/types.js";
14
8
  import * as path from "path";
15
9
  import { fileURLToPath } from "url";
10
+ import { XrayKnowledgeSkillBase } from "../shared/knowledge-skill-base.js";
11
+ import { frameworkLogger } from "../../core/framework-logger.js";
16
12
 
17
- interface Tool {
18
- name: string;
19
- description: string;
20
- inputSchema: object;
21
- }
22
-
23
- class SEOCopywriterServer {
24
- private server: Server;
25
- private tools: Tool[] = [
26
- {
27
- name: "seo_content_generation",
28
- description:
29
- "Generate SEO-optimized content for blogs, product pages, landing pages",
30
- inputSchema: {
31
- type: "object",
32
- properties: {
33
- topic: { type: "string", description: "Main topic/keyword" },
34
- contentType: {
35
- type: "string",
36
- enum: ["blog", "product", "landing", "email", "social"],
37
- },
38
- wordCount: { type: "number", description: "Target word count" },
39
- targetAudience: {
40
- type: "string",
41
- description: "Target audience description",
13
+ class SEOCopywriterServer extends XrayKnowledgeSkillBase {
14
+ constructor() {
15
+ super("content-creator", "2.0.1");
16
+ this.tools = [
17
+ {
18
+ name: "seo_content_generation",
19
+ description:
20
+ "Generate SEO-optimized content for blogs, product pages, landing pages",
21
+ inputSchema: {
22
+ type: "object",
23
+ properties: {
24
+ topic: { type: "string", description: "Main topic/keyword" },
25
+ contentType: {
26
+ type: "string",
27
+ enum: ["blog", "product", "landing", "email", "social"],
28
+ },
29
+ wordCount: { type: "number", description: "Target word count" },
30
+ targetAudience: {
31
+ type: "string",
32
+ description: "Target audience description",
33
+ },
42
34
  },
35
+ required: ["topic", "contentType"],
43
36
  },
44
- required: ["topic", "contentType"],
45
37
  },
46
- },
47
- {
48
- name: "keyword_optimization",
49
- description:
50
- "Optimize existing content with relevant keywords and semantic variations",
51
- inputSchema: {
52
- type: "object",
53
- properties: {
54
- content: { type: "string", description: "Content to optimize" },
55
- primaryKeyword: {
56
- type: "string",
57
- description: "Primary keyword to target",
38
+ {
39
+ name: "keyword_optimization",
40
+ description:
41
+ "Optimize existing content with relevant keywords and semantic variations",
42
+ inputSchema: {
43
+ type: "object",
44
+ properties: {
45
+ content: { type: "string", description: "Content to optimize" },
46
+ primaryKeyword: {
47
+ type: "string",
48
+ description: "Primary keyword to target",
49
+ },
58
50
  },
51
+ required: ["content", "primaryKeyword"],
59
52
  },
60
- required: ["content", "primaryKeyword"],
61
53
  },
62
- },
63
- {
64
- name: "meta_description_generator",
65
- description: "Generate compelling meta descriptions that improve CTR",
66
- inputSchema: {
67
- type: "object",
68
- properties: {
69
- pageTitle: { type: "string", description: "Page title" },
70
- pageContent: { type: "string", description: "Page content summary" },
71
- targetKeyword: { type: "string", description: "Primary keyword" },
54
+ {
55
+ name: "meta_description_generator",
56
+ description: "Generate compelling meta descriptions that improve CTR",
57
+ inputSchema: {
58
+ type: "object",
59
+ properties: {
60
+ pageTitle: { type: "string", description: "Page title" },
61
+ pageContent: { type: "string", description: "Page content summary" },
62
+ targetKeyword: { type: "string", description: "Primary keyword" },
63
+ },
64
+ required: ["pageTitle", "pageContent"],
72
65
  },
73
- required: ["pageTitle", "pageContent"],
74
66
  },
75
- },
76
- {
77
- name: "headline_analyzer",
78
- description: "Analyze and optimize headlines for SEO and conversion",
79
- inputSchema: {
80
- type: "object",
81
- properties: {
82
- headline: { type: "string", description: "Headline to analyze" },
83
- context: { type: "string", description: "Content context" },
67
+ {
68
+ name: "headline_analyzer",
69
+ description: "Analyze and optimize headlines for SEO and conversion",
70
+ inputSchema: {
71
+ type: "object",
72
+ properties: {
73
+ headline: { type: "string", description: "Headline to analyze" },
74
+ context: { type: "string", description: "Content context" },
75
+ },
76
+ required: ["headline"],
84
77
  },
85
- required: ["headline"],
86
78
  },
87
- },
88
- {
89
- name: "ai_search_content_optimization",
90
- description:
91
- "Optimize content specifically for AI search engines (ChatGPT, Perplexity, Grok)",
92
- inputSchema: {
93
- type: "object",
94
- properties: {
95
- content: { type: "string", description: "Content to optimize" },
96
- query: { type: "string", description: "Target search query" },
79
+ {
80
+ name: "ai_search_content_optimization",
81
+ description:
82
+ "Optimize content specifically for AI search engines (ChatGPT, Perplexity, Grok)",
83
+ inputSchema: {
84
+ type: "object",
85
+ properties: {
86
+ content: { type: "string", description: "Content to optimize" },
87
+ query: { type: "string", description: "Target search query" },
88
+ },
89
+ required: ["content", "query"],
97
90
  },
98
- required: ["content", "query"],
99
91
  },
100
- },
101
- ];
102
-
103
- constructor() {
104
- this.server = new Server(
105
- { name: "content-creator", version: "2.0.1" },
106
- { capabilities: { tools: {} } },
107
- );
108
-
109
- this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
110
- tools: this.tools,
111
- }));
112
-
113
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
114
- const { name, arguments: args = {} } = request.params;
115
-
116
- try {
117
- switch (name) {
118
- case "seo_content_generation": {
119
- const argsObj = args as Record<string, unknown>;
120
- const topic = (argsObj.topic as string) || "";
121
- const contentType = (argsObj.contentType as string) || "blog";
122
- const wordCount = (argsObj.wordCount as number) || 500;
123
- const targetAudience =
124
- (argsObj.targetAudience as string) || "general";
125
- return {
126
- content: [
92
+ ];
93
+ this.handlers = {
94
+ "seo_content_generation": async (args) => {
95
+ const argsObj = args as Record<string, unknown>;
96
+ const topic = (argsObj.topic as string) || "";
97
+ const contentType = (argsObj.contentType as string) || "blog";
98
+ const wordCount = (argsObj.wordCount as number) || 500;
99
+ const targetAudience =
100
+ (argsObj.targetAudience as string) || "general";
101
+ return {
102
+ content: [
103
+ {
104
+ type: "text",
105
+ text: JSON.stringify(
127
106
  {
128
- type: "text",
129
- text: JSON.stringify(
107
+ topic,
108
+ contentType,
109
+ wordCount,
110
+ targetAudience,
111
+ optimized: true,
112
+ sections: [
130
113
  {
131
- topic,
132
- contentType,
133
- wordCount,
134
- targetAudience,
135
- optimized: true,
136
- sections: [
137
- {
138
- heading: "Introduction",
139
- words: Math.floor(wordCount * 0.2),
140
- },
141
- {
142
- heading: "Main Content",
143
- words: Math.floor(wordCount * 0.5),
144
- },
145
- {
146
- heading: "Conclusion",
147
- words: Math.floor(wordCount * 0.3),
148
- },
149
- ],
150
- keywords: [
151
- topic,
152
- `${topic} guide`,
153
- `best ${topic}`,
154
- `how to ${topic}`,
155
- ],
156
- metaDescription: `Learn everything about ${topic} in our comprehensive guide. Expert tips for ${targetAudience}.`,
114
+ heading: "Introduction",
115
+ words: Math.floor(wordCount * 0.2),
157
116
  },
158
- null,
159
- 2,
160
- ),
161
- },
162
- ],
163
- };
164
- }
165
- case "keyword_optimization": {
166
- const argsObj = args as Record<string, string>;
167
- const content = argsObj.content || "";
168
- const primaryKeyword = argsObj.primaryKeyword || "";
169
- return {
170
- content: [
171
- {
172
- type: "text",
173
- text: JSON.stringify(
174
117
  {
175
- originalLength: content.length,
176
- optimized: true,
177
- keywordDensity: 2.1,
178
- suggestions: [
179
- `Add "${primaryKeyword}" to first paragraph`,
180
- `Include in H2 heading`,
181
- `Add to meta description`,
182
- `Include semantic variations`,
183
- ],
118
+ heading: "Main Content",
119
+ words: Math.floor(wordCount * 0.5),
184
120
  },
185
- null,
186
- 2,
187
- ),
188
- },
189
- ],
190
- };
191
- }
192
- case "meta_description_generator": {
193
- const argsObj = args as Record<string, string>;
194
- const pageTitle = argsObj.pageTitle || "";
195
- const pageContent = argsObj.pageContent || "";
196
- const targetKeyword = argsObj.targetKeyword || "";
197
- return {
198
- content: [
199
- {
200
- type: "text",
201
- text: JSON.stringify(
202
121
  {
203
- title: pageTitle,
204
- metaDescription: `${pageTitle}: ${pageContent.slice(0, 100)}... Expert guide on ${targetKeyword}.`,
205
- characterCount: 155,
206
- optimized: true,
122
+ heading: "Conclusion",
123
+ words: Math.floor(wordCount * 0.3),
207
124
  },
208
- null,
209
- 2,
210
- ),
125
+ ],
126
+ keywords: [
127
+ topic,
128
+ `${topic} guide`,
129
+ `best ${topic}`,
130
+ `how to ${topic}`,
131
+ ],
132
+ metaDescription: `Learn everything about ${topic} in our comprehensive guide. Expert tips for ${targetAudience}.`,
211
133
  },
212
- ],
213
- };
214
- }
215
- case "headline_analyzer": {
216
- const { headline, context } = args as Record<string, string>;
217
- return {
218
- content: [
134
+ null,
135
+ 2,
136
+ ),
137
+ },
138
+ ],
139
+ };
140
+ },
141
+ "keyword_optimization": async (args) => {
142
+ const argsObj = args as Record<string, string>;
143
+ const content = argsObj.content || "";
144
+ const primaryKeyword = argsObj.primaryKeyword || "";
145
+ return {
146
+ content: [
147
+ {
148
+ type: "text",
149
+ text: JSON.stringify(
219
150
  {
220
- type: "text",
221
- text: JSON.stringify(
222
- {
223
- headline,
224
- context,
225
- score: 85,
226
- analysis: {
227
- clarity: "Good",
228
- emotion: "Moderate",
229
- power: "Strong",
230
- length: "Optimal",
231
- },
232
- suggestions: [
233
- "Add numbers for better CTR",
234
- "Include power words",
235
- "Consider emotional triggers",
236
- ],
237
- },
238
- null,
239
- 2,
240
- ),
151
+ originalLength: content.length,
152
+ optimized: true,
153
+ keywordDensity: 2.1,
154
+ suggestions: [
155
+ `Add "${primaryKeyword}" to first paragraph`,
156
+ `Include in H2 heading`,
157
+ `Add to meta description`,
158
+ `Include semantic variations`,
159
+ ],
241
160
  },
242
- ],
243
- };
244
- }
245
- case "ai_search_content_optimization": {
246
- const { content, query } = args as Record<string, string>;
247
- return {
248
- content: [
161
+ null,
162
+ 2,
163
+ ),
164
+ },
165
+ ],
166
+ };
167
+ },
168
+ "meta_description_generator": async (args) => {
169
+ const argsObj = args as Record<string, string>;
170
+ const pageTitle = argsObj.pageTitle || "";
171
+ const pageContent = argsObj.pageContent || "";
172
+ const targetKeyword = argsObj.targetKeyword || "";
173
+ return {
174
+ content: [
175
+ {
176
+ type: "text",
177
+ text: JSON.stringify(
249
178
  {
250
- type: "text",
251
- text: JSON.stringify(
252
- {
253
- query,
254
- optimized: true,
255
- structured: true,
256
- sections: [
257
- "Direct answer to query",
258
- "Step-by-step explanation",
259
- "Key points with examples",
260
- "Summary with call to action",
261
- ],
262
- recommendations: [
263
- "Use clear H2-H4 headings",
264
- "Include numbered lists for citations",
265
- "Add specific statistics",
266
- "E-E-A-T signals (author, dates)",
267
- ],
268
- },
269
- null,
270
- 2,
271
- ),
179
+ title: pageTitle,
180
+ metaDescription: `${pageTitle}: ${pageContent.slice(0, 100)}... Expert guide on ${targetKeyword}.`,
181
+ characterCount: 155,
182
+ optimized: true,
272
183
  },
273
- ],
274
- };
275
- }
276
- default:
277
- throw new Error(`Unknown tool: ${name}`);
278
- }
279
- } catch (error) {
184
+ null,
185
+ 2,
186
+ ),
187
+ },
188
+ ],
189
+ };
190
+ },
191
+ "headline_analyzer": async (args) => {
192
+ const { headline, context } = args as Record<string, string>;
280
193
  return {
281
- content: [{ type: "text", text: `Error: ${error}` }],
282
- isError: true,
194
+ content: [
195
+ {
196
+ type: "text",
197
+ text: JSON.stringify(
198
+ {
199
+ headline,
200
+ context,
201
+ score: 85,
202
+ analysis: {
203
+ clarity: "Good",
204
+ emotion: "Moderate",
205
+ power: "Strong",
206
+ length: "Optimal",
207
+ },
208
+ suggestions: [
209
+ "Add numbers for better CTR",
210
+ "Include power words",
211
+ "Consider emotional triggers",
212
+ ],
213
+ },
214
+ null,
215
+ 2,
216
+ ),
217
+ },
218
+ ],
283
219
  };
284
- }
285
- });
286
- }
287
-
288
- async run() {
289
- const transport = new StdioServerTransport();
290
- await this.server.connect(transport);
220
+ },
221
+ "ai_search_content_optimization": async (args) => {
222
+ const { content, query } = args as Record<string, string>;
223
+ return {
224
+ content: [
225
+ {
226
+ type: "text",
227
+ text: JSON.stringify(
228
+ {
229
+ query,
230
+ optimized: true,
231
+ structured: true,
232
+ sections: [
233
+ "Direct answer to query",
234
+ "Step-by-step explanation",
235
+ "Key points with examples",
236
+ "Summary with call to action",
237
+ ],
238
+ recommendations: [
239
+ "Use clear H2-H4 headings",
240
+ "Include numbered lists for citations",
241
+ "Add specific statistics",
242
+ "E-E-A-T signals (author, dates)",
243
+ ],
244
+ },
245
+ null,
246
+ 2,
247
+ ),
248
+ },
249
+ ],
250
+ };
251
+ },
252
+ };
253
+ this.setupToolHandlers();
291
254
  }
292
255
  }
293
256
 
294
257
  const entryPoint = path.resolve(process.argv[1] ?? "");
295
258
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
296
259
  const server = new SEOCopywriterServer();
297
- server.run();
260
+ server.run("content-creator").catch((err) => { frameworkLogger.log("content-creator", "run", "error", { error: err instanceof Error ? err.message : String(err) }); });
298
261
  }
299
262
 
300
263
  export { SEOCopywriterServer };