mcp-wordpress 2.6.4 → 2.7.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.
Files changed (332) hide show
  1. package/README.md +1 -1
  2. package/dist/cache/CacheInvalidation.d.ts +25 -6
  3. package/dist/cache/CacheInvalidation.d.ts.map +1 -1
  4. package/dist/cache/CacheInvalidation.js +168 -16
  5. package/dist/cache/CacheInvalidation.js.map +1 -1
  6. package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
  7. package/dist/cache/HttpCacheWrapper.js +3 -4
  8. package/dist/cache/HttpCacheWrapper.js.map +1 -1
  9. package/dist/cache/SEOCacheManager.d.ts +150 -0
  10. package/dist/cache/SEOCacheManager.d.ts.map +1 -0
  11. package/dist/cache/SEOCacheManager.js +275 -0
  12. package/dist/cache/SEOCacheManager.js.map +1 -0
  13. package/dist/client/SEOWordPressClient.d.ts +164 -0
  14. package/dist/client/SEOWordPressClient.d.ts.map +1 -0
  15. package/dist/client/SEOWordPressClient.js +674 -0
  16. package/dist/client/SEOWordPressClient.js.map +1 -0
  17. package/dist/client/api.d.ts.map +1 -1
  18. package/dist/client/api.js +50 -20
  19. package/dist/client/api.js.map +1 -1
  20. package/dist/client/auth.js +19 -19
  21. package/dist/client/auth.js.map +1 -1
  22. package/dist/client/index.d.ts +11 -0
  23. package/dist/client/index.d.ts.map +1 -0
  24. package/dist/client/index.js +14 -0
  25. package/dist/client/index.js.map +1 -0
  26. package/dist/client/managers/AuthManager.d.ts +39 -0
  27. package/dist/client/managers/AuthManager.d.ts.map +1 -0
  28. package/dist/client/managers/AuthManager.js +142 -0
  29. package/dist/client/managers/AuthManager.js.map +1 -0
  30. package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
  31. package/dist/client/managers/AuthenticationManager.js +10 -9
  32. package/dist/client/managers/AuthenticationManager.js.map +1 -1
  33. package/dist/client/managers/BaseManager.d.ts.map +1 -1
  34. package/dist/client/managers/BaseManager.js +12 -0
  35. package/dist/client/managers/BaseManager.js.map +1 -1
  36. package/dist/client/managers/ComposedAuthenticationManager.d.ts +94 -0
  37. package/dist/client/managers/ComposedAuthenticationManager.d.ts.map +1 -0
  38. package/dist/client/managers/ComposedAuthenticationManager.js +340 -0
  39. package/dist/client/managers/ComposedAuthenticationManager.js.map +1 -0
  40. package/dist/client/managers/ComposedManagerFactory.d.ts +104 -0
  41. package/dist/client/managers/ComposedManagerFactory.d.ts.map +1 -0
  42. package/dist/client/managers/ComposedManagerFactory.js +180 -0
  43. package/dist/client/managers/ComposedManagerFactory.js.map +1 -0
  44. package/dist/client/managers/ComposedRequestManager.d.ts +82 -0
  45. package/dist/client/managers/ComposedRequestManager.d.ts.map +1 -0
  46. package/dist/client/managers/ComposedRequestManager.js +260 -0
  47. package/dist/client/managers/ComposedRequestManager.js.map +1 -0
  48. package/dist/client/managers/JWTAuthImplementation.d.ts +86 -0
  49. package/dist/client/managers/JWTAuthImplementation.d.ts.map +1 -0
  50. package/dist/client/managers/JWTAuthImplementation.js +240 -0
  51. package/dist/client/managers/JWTAuthImplementation.js.map +1 -0
  52. package/dist/client/managers/ManagersIndex.d.ts +6 -0
  53. package/dist/client/managers/ManagersIndex.d.ts.map +1 -0
  54. package/dist/client/managers/ManagersIndex.js +6 -0
  55. package/dist/client/managers/ManagersIndex.js.map +1 -0
  56. package/dist/client/managers/RequestManager.d.ts.map +1 -1
  57. package/dist/client/managers/RequestManager.js +5 -3
  58. package/dist/client/managers/RequestManager.js.map +1 -1
  59. package/dist/client/managers/composed/MigrationAdapter.d.ts +80 -0
  60. package/dist/client/managers/composed/MigrationAdapter.d.ts.map +1 -0
  61. package/dist/client/managers/composed/MigrationAdapter.js +214 -0
  62. package/dist/client/managers/composed/MigrationAdapter.js.map +1 -0
  63. package/dist/client/managers/composed/index.d.ts +23 -0
  64. package/dist/client/managers/composed/index.d.ts.map +1 -0
  65. package/dist/client/managers/composed/index.js +26 -0
  66. package/dist/client/managers/composed/index.js.map +1 -0
  67. package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts +27 -0
  68. package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts.map +1 -0
  69. package/dist/client/managers/implementations/ConfigurationProviderImpl.js +41 -0
  70. package/dist/client/managers/implementations/ConfigurationProviderImpl.js.map +1 -0
  71. package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts +31 -0
  72. package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts.map +1 -0
  73. package/dist/client/managers/implementations/ErrorHandlerImpl.js +73 -0
  74. package/dist/client/managers/implementations/ErrorHandlerImpl.js.map +1 -0
  75. package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts +47 -0
  76. package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts.map +1 -0
  77. package/dist/client/managers/implementations/ParameterValidatorImpl.js +141 -0
  78. package/dist/client/managers/implementations/ParameterValidatorImpl.js.map +1 -0
  79. package/dist/client/managers/interfaces/ManagerInterfaces.d.ts +147 -0
  80. package/dist/client/managers/interfaces/ManagerInterfaces.d.ts.map +1 -0
  81. package/dist/client/managers/interfaces/ManagerInterfaces.js +6 -0
  82. package/dist/client/managers/interfaces/ManagerInterfaces.js.map +1 -0
  83. package/dist/config/Config.d.ts +30 -0
  84. package/dist/config/Config.d.ts.map +1 -1
  85. package/dist/config/Config.js +30 -0
  86. package/dist/config/Config.js.map +1 -1
  87. package/dist/config/ConfigurationSchema.d.ts +75 -198
  88. package/dist/config/ConfigurationSchema.d.ts.map +1 -1
  89. package/dist/config/ConfigurationSchema.js +17 -17
  90. package/dist/config/ConfigurationSchema.js.map +1 -1
  91. package/dist/config/ServerConfiguration.d.ts +2 -2
  92. package/dist/config/ServerConfiguration.d.ts.map +1 -1
  93. package/dist/config/ServerConfiguration.js +15 -13
  94. package/dist/config/ServerConfiguration.js.map +1 -1
  95. package/dist/config/index.d.ts +8 -0
  96. package/dist/config/index.d.ts.map +1 -0
  97. package/dist/config/index.js +11 -0
  98. package/dist/config/index.js.map +1 -0
  99. package/dist/docs/DocumentationGenerator.js +2 -2
  100. package/dist/docs/DocumentationGenerator.js.map +1 -1
  101. package/dist/dxt-entry.js +3 -3
  102. package/dist/dxt-entry.js.map +1 -1
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +38 -37
  106. package/dist/index.js.map +1 -1
  107. package/dist/performance/MetricsCollector.d.ts.map +1 -1
  108. package/dist/performance/MetricsCollector.js +5 -4
  109. package/dist/performance/MetricsCollector.js.map +1 -1
  110. package/dist/security/AISecurityScanner.js +7 -7
  111. package/dist/security/AISecurityScanner.js.map +1 -1
  112. package/dist/security/AutomatedRemediation.d.ts.map +1 -1
  113. package/dist/security/AutomatedRemediation.js +11 -11
  114. package/dist/security/AutomatedRemediation.js.map +1 -1
  115. package/dist/security/InputValidator.d.ts +50 -126
  116. package/dist/security/InputValidator.d.ts.map +1 -1
  117. package/dist/security/InputValidator.js +9 -9
  118. package/dist/security/InputValidator.js.map +1 -1
  119. package/dist/security/SecurityCIPipeline.d.ts +47 -5
  120. package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
  121. package/dist/security/SecurityCIPipeline.js +390 -49
  122. package/dist/security/SecurityCIPipeline.js.map +1 -1
  123. package/dist/security/SecurityConfigManager.js +10 -10
  124. package/dist/security/SecurityConfigManager.js.map +1 -1
  125. package/dist/security/SecurityMonitoring.js +4 -4
  126. package/dist/security/SecurityMonitoring.js.map +1 -1
  127. package/dist/security/SecurityReviewer.d.ts.map +1 -1
  128. package/dist/security/SecurityReviewer.js +13 -6
  129. package/dist/security/SecurityReviewer.js.map +1 -1
  130. package/dist/security/index.js +3 -3
  131. package/dist/security/index.js.map +1 -1
  132. package/dist/server/ConnectionTester.js +5 -5
  133. package/dist/server/ConnectionTester.js.map +1 -1
  134. package/dist/server/ToolRegistry.d.ts +2 -2
  135. package/dist/server/ToolRegistry.d.ts.map +1 -1
  136. package/dist/server/ToolRegistry.js +7 -6
  137. package/dist/server/ToolRegistry.js.map +1 -1
  138. package/dist/server/index.d.ts +7 -0
  139. package/dist/server/index.d.ts.map +1 -0
  140. package/dist/server/index.js +9 -0
  141. package/dist/server/index.js.map +1 -0
  142. package/dist/tools/BaseToolManager.d.ts.map +1 -1
  143. package/dist/tools/BaseToolManager.js +11 -11
  144. package/dist/tools/BaseToolManager.js.map +1 -1
  145. package/dist/tools/auth.d.ts.map +1 -1
  146. package/dist/tools/auth.js +7 -7
  147. package/dist/tools/auth.js.map +1 -1
  148. package/dist/tools/comments.d.ts.map +1 -1
  149. package/dist/tools/comments.js +14 -14
  150. package/dist/tools/comments.js.map +1 -1
  151. package/dist/tools/index.d.ts +1 -0
  152. package/dist/tools/index.d.ts.map +1 -1
  153. package/dist/tools/index.js +1 -0
  154. package/dist/tools/index.js.map +1 -1
  155. package/dist/tools/media.d.ts.map +1 -1
  156. package/dist/tools/media.js +14 -11
  157. package/dist/tools/media.js.map +1 -1
  158. package/dist/tools/pages.d.ts.map +1 -1
  159. package/dist/tools/pages.js +12 -12
  160. package/dist/tools/pages.js.map +1 -1
  161. package/dist/tools/performance.d.ts.map +1 -1
  162. package/dist/tools/performance.js +13 -11
  163. package/dist/tools/performance.js.map +1 -1
  164. package/dist/tools/posts/PostHandlers.d.ts.map +1 -1
  165. package/dist/tools/posts/PostHandlers.js +16 -16
  166. package/dist/tools/posts/PostHandlers.js.map +1 -1
  167. package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -1
  168. package/dist/tools/posts/index.d.ts.map +1 -1
  169. package/dist/tools/seo/BulkOperations.d.ts +113 -0
  170. package/dist/tools/seo/BulkOperations.d.ts.map +1 -0
  171. package/dist/tools/seo/BulkOperations.js +398 -0
  172. package/dist/tools/seo/BulkOperations.js.map +1 -0
  173. package/dist/tools/seo/SEOHandlers.d.ts +55 -0
  174. package/dist/tools/seo/SEOHandlers.d.ts.map +1 -0
  175. package/dist/tools/seo/SEOHandlers.js +255 -0
  176. package/dist/tools/seo/SEOHandlers.js.map +1 -0
  177. package/dist/tools/seo/SEOToolDefinitions.d.ts +59 -0
  178. package/dist/tools/seo/SEOToolDefinitions.d.ts.map +1 -0
  179. package/dist/tools/seo/SEOToolDefinitions.js +385 -0
  180. package/dist/tools/seo/SEOToolDefinitions.js.map +1 -0
  181. package/dist/tools/seo/SEOTools.d.ts +203 -0
  182. package/dist/tools/seo/SEOTools.d.ts.map +1 -0
  183. package/dist/tools/seo/SEOTools.js +708 -0
  184. package/dist/tools/seo/SEOTools.js.map +1 -0
  185. package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts +94 -0
  186. package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts.map +1 -0
  187. package/dist/tools/seo/analyzers/ContentAnalyzer.js +402 -0
  188. package/dist/tools/seo/analyzers/ContentAnalyzer.js.map +1 -0
  189. package/dist/tools/seo/auditors/SiteAuditor.d.ts +121 -0
  190. package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -0
  191. package/dist/tools/seo/auditors/SiteAuditor.js +600 -0
  192. package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -0
  193. package/dist/tools/seo/generators/MetaGenerator.d.ts +128 -0
  194. package/dist/tools/seo/generators/MetaGenerator.d.ts.map +1 -0
  195. package/dist/tools/seo/generators/MetaGenerator.js +547 -0
  196. package/dist/tools/seo/generators/MetaGenerator.js.map +1 -0
  197. package/dist/tools/seo/generators/SchemaGenerator.d.ts +204 -0
  198. package/dist/tools/seo/generators/SchemaGenerator.d.ts.map +1 -0
  199. package/dist/tools/seo/generators/SchemaGenerator.js +670 -0
  200. package/dist/tools/seo/generators/SchemaGenerator.js.map +1 -0
  201. package/dist/tools/seo/index.d.ts +17 -0
  202. package/dist/tools/seo/index.d.ts.map +1 -0
  203. package/dist/tools/seo/index.js +18 -0
  204. package/dist/tools/seo/index.js.map +1 -0
  205. package/dist/tools/seo/optimizers/InternalLinkingSuggester.d.ts +186 -0
  206. package/dist/tools/seo/optimizers/InternalLinkingSuggester.d.ts.map +1 -0
  207. package/dist/tools/seo/optimizers/InternalLinkingSuggester.js +683 -0
  208. package/dist/tools/seo/optimizers/InternalLinkingSuggester.js.map +1 -0
  209. package/dist/tools/site.d.ts.map +1 -1
  210. package/dist/tools/site.js +12 -12
  211. package/dist/tools/site.js.map +1 -1
  212. package/dist/tools/taxonomies.d.ts.map +1 -1
  213. package/dist/tools/taxonomies.js +20 -20
  214. package/dist/tools/taxonomies.js.map +1 -1
  215. package/dist/tools/users.d.ts.map +1 -1
  216. package/dist/tools/users.js +12 -12
  217. package/dist/tools/users.js.map +1 -1
  218. package/dist/types/client.d.ts +8 -6
  219. package/dist/types/client.d.ts.map +1 -1
  220. package/dist/types/client.js.map +1 -1
  221. package/dist/types/seo.d.ts +473 -0
  222. package/dist/types/seo.d.ts.map +1 -0
  223. package/dist/types/seo.js +94 -0
  224. package/dist/types/seo.js.map +1 -0
  225. package/dist/utils/enhancedError.js +1 -1
  226. package/dist/utils/enhancedError.js.map +1 -1
  227. package/dist/utils/error.d.ts.map +1 -1
  228. package/dist/utils/error.js +0 -1
  229. package/dist/utils/error.js.map +1 -1
  230. package/dist/utils/index.d.ts +12 -0
  231. package/dist/utils/index.d.ts.map +1 -0
  232. package/dist/utils/index.js +18 -0
  233. package/dist/utils/index.js.map +1 -0
  234. package/dist/utils/logger.js +3 -3
  235. package/dist/utils/logger.js.map +1 -1
  236. package/dist/utils/toolWrapper.d.ts +2 -2
  237. package/dist/utils/toolWrapper.js +8 -8
  238. package/dist/utils/toolWrapper.js.map +1 -1
  239. package/dist/utils/validation/core.d.ts.map +1 -1
  240. package/dist/utils/validation/core.js.map +1 -1
  241. package/dist/utils/validation/index.d.ts.map +1 -1
  242. package/dist/utils/validation/index.js.map +1 -1
  243. package/dist/utils/validation/network.js +3 -3
  244. package/dist/utils/validation/network.js.map +1 -1
  245. package/dist/utils/validation/rateLimit.js.map +1 -1
  246. package/dist/utils/validation/security.js.map +1 -1
  247. package/dist/utils/validation/wordpress.js.map +1 -1
  248. package/dist/utils/version.d.ts +144 -0
  249. package/dist/utils/version.d.ts.map +1 -0
  250. package/dist/utils/version.js +318 -0
  251. package/dist/utils/version.js.map +1 -0
  252. package/package.json +21 -55
  253. package/src/cache/CacheInvalidation.ts +183 -20
  254. package/src/cache/HttpCacheWrapper.ts +8 -5
  255. package/src/cache/SEOCacheManager.ts +330 -0
  256. package/src/cache/__tests__/CacheInvalidation.test.ts +6 -11
  257. package/src/cache/__tests__/CachedWordPressClient.test.ts +37 -62
  258. package/src/client/SEOWordPressClient.ts +876 -0
  259. package/src/client/api.ts +50 -21
  260. package/src/client/auth.ts +19 -19
  261. package/src/client/index.ts +16 -0
  262. package/src/client/managers/AuthManager.ts +175 -0
  263. package/src/client/managers/AuthenticationManager.ts +16 -14
  264. package/src/client/managers/BaseManager.ts +24 -5
  265. package/src/client/managers/ComposedAuthenticationManager.ts +409 -0
  266. package/src/client/managers/ComposedManagerFactory.ts +231 -0
  267. package/src/client/managers/ComposedRequestManager.ts +336 -0
  268. package/src/client/managers/JWTAuthImplementation.ts +326 -0
  269. package/src/client/managers/ManagersIndex.ts +6 -0
  270. package/src/client/managers/RequestManager.ts +9 -7
  271. package/src/client/managers/composed/MigrationAdapter.ts +263 -0
  272. package/src/client/managers/composed/index.ts +47 -0
  273. package/src/client/managers/implementations/ConfigurationProviderImpl.ts +52 -0
  274. package/src/client/managers/implementations/ErrorHandlerImpl.ts +102 -0
  275. package/src/client/managers/implementations/ParameterValidatorImpl.ts +221 -0
  276. package/src/client/managers/interfaces/ManagerInterfaces.ts +171 -0
  277. package/src/config/Config.ts +63 -0
  278. package/src/config/ConfigurationSchema.ts +17 -17
  279. package/src/config/ServerConfiguration.ts +18 -16
  280. package/src/config/index.ts +13 -0
  281. package/src/docs/DocumentationGenerator.ts +2 -2
  282. package/src/dxt-entry.ts +3 -3
  283. package/src/index.ts +43 -43
  284. package/src/performance/MetricsCollector.ts +15 -11
  285. package/src/security/AISecurityScanner.ts +7 -7
  286. package/src/security/AutomatedRemediation.ts +13 -11
  287. package/src/security/InputValidator.ts +10 -9
  288. package/src/security/SecurityCIPipeline.ts +494 -56
  289. package/src/security/SecurityConfigManager.ts +10 -10
  290. package/src/security/SecurityMonitoring.ts +5 -5
  291. package/src/security/SecurityReviewer.ts +13 -6
  292. package/src/security/index.ts +3 -3
  293. package/src/server/ConnectionTester.ts +5 -5
  294. package/src/server/ToolRegistry.ts +9 -8
  295. package/src/server/index.ts +10 -0
  296. package/src/tools/BaseToolManager.ts +55 -83
  297. package/src/tools/auth.ts +21 -12
  298. package/src/tools/comments.ts +23 -19
  299. package/src/tools/index.ts +1 -0
  300. package/src/tools/media.ts +23 -20
  301. package/src/tools/pages.ts +20 -13
  302. package/src/tools/performance.ts +101 -32
  303. package/src/tools/posts/PostHandlers.ts +23 -23
  304. package/src/tools/posts/PostToolDefinitions.ts +1 -1
  305. package/src/tools/posts/index.ts +2 -2
  306. package/src/tools/seo/BulkOperations.ts +557 -0
  307. package/src/tools/seo/SEOHandlers.ts +296 -0
  308. package/src/tools/seo/SEOToolDefinitions.ts +402 -0
  309. package/src/tools/seo/SEOTools.ts +871 -0
  310. package/src/tools/seo/analyzers/ContentAnalyzer.ts +493 -0
  311. package/src/tools/seo/auditors/SiteAuditor.ts +787 -0
  312. package/src/tools/seo/generators/MetaGenerator.ts +694 -0
  313. package/src/tools/seo/generators/SchemaGenerator.ts +955 -0
  314. package/src/tools/seo/index.ts +47 -0
  315. package/src/tools/seo/optimizers/InternalLinkingSuggester.ts +934 -0
  316. package/src/tools/site.ts +27 -26
  317. package/src/tools/taxonomies.ts +29 -25
  318. package/src/tools/users.ts +20 -13
  319. package/src/types/client.ts +8 -6
  320. package/src/types/seo.ts +546 -0
  321. package/src/utils/enhancedError.ts +1 -1
  322. package/src/utils/error.ts +1 -2
  323. package/src/utils/index.ts +23 -0
  324. package/src/utils/logger.ts +3 -3
  325. package/src/utils/toolWrapper.ts +10 -10
  326. package/src/utils/validation/core.ts +2 -2
  327. package/src/utils/validation/index.ts +2 -2
  328. package/src/utils/validation/network.ts +5 -5
  329. package/src/utils/validation/rateLimit.ts +1 -1
  330. package/src/utils/validation/security.ts +1 -1
  331. package/src/utils/validation/wordpress.ts +1 -1
  332. package/src/utils/version.ts +402 -0
@@ -247,7 +247,7 @@ const SecurityPolicySchema = z.object({
247
247
  paths: z.array(z.string()).optional(),
248
248
  userRoles: z.array(z.string()).optional(),
249
249
  }),
250
- parameters: z.record(z.unknown()),
250
+ parameters: z.record(z.string(), z.unknown()),
251
251
  exceptions: z.array(z.string()),
252
252
  }),
253
253
  ),
@@ -287,7 +287,7 @@ export class SecurityConfigManager {
287
287
 
288
288
  logger.info("Loaded configurations and policies", {
289
289
  configurationCount: this.configurations.size,
290
- policyCount: this.policies.size
290
+ policyCount: this.policies.size,
291
291
  });
292
292
  }
293
293
 
@@ -309,8 +309,8 @@ export class SecurityConfigManager {
309
309
  // Validate policy
310
310
  try {
311
311
  SecurityPolicySchema.parse(policy);
312
- } catch (error) {
313
- throw new SecurityValidationError("Invalid security policy", [{ message: String(error) }]);
312
+ } catch (_error) {
313
+ throw new SecurityValidationError("Invalid security policy", [{ message: String(_error) }]);
314
314
  }
315
315
 
316
316
  this.policies.set(policy.id, policy);
@@ -342,8 +342,8 @@ export class SecurityConfigManager {
342
342
  // Validate updated policy
343
343
  try {
344
344
  SecurityPolicySchema.parse(updatedPolicy);
345
- } catch (error) {
346
- throw new SecurityValidationError("Invalid policy update", [{ message: String(error) }]);
345
+ } catch (_error) {
346
+ throw new SecurityValidationError("Invalid policy update", [{ message: String(_error) }]);
347
347
  }
348
348
 
349
349
  this.policies.set(policyId, updatedPolicy);
@@ -786,8 +786,8 @@ export class SecurityConfigManager {
786
786
  await fs.unlink(filePath);
787
787
  logger.info(`Deleted policy: ${policy.name}`, { policyId });
788
788
  return true;
789
- } catch (error) {
790
- logger.warn("Failed to delete policy file", { error });
789
+ } catch (_error) {
790
+ logger.warn("Failed to delete policy file", { _error });
791
791
  return false;
792
792
  }
793
793
  }
@@ -826,8 +826,8 @@ export class SecurityConfigManager {
826
826
 
827
827
  logger.info(`Imported configuration for environment: ${config.environment}`, { environment: config.environment });
828
828
  return config;
829
- } catch (error) {
830
- throw new SecurityValidationError("Failed to import configuration", [{ message: String(error) }]);
829
+ } catch (_error) {
830
+ throw new SecurityValidationError("Failed to import configuration", [{ message: String(_error) }]);
831
831
  }
832
832
  }
833
833
  }
@@ -282,10 +282,10 @@ export class SecurityMonitor extends EventEmitter {
282
282
 
283
283
  action.result = "success";
284
284
  action.details += " - executed successfully";
285
- } catch (error) {
285
+ } catch (_error) {
286
286
  action.result = "failure";
287
- action.details += ` - failed: ${error instanceof Error ? error.message : String(error)}`;
288
- logger.error(`Action ${type} failed`, { type, error });
287
+ action.details += ` - failed: ${_error instanceof Error ? _error.message : String(_error)}`;
288
+ logger.error(`Action ${type} failed`, { type, _error });
289
289
  }
290
290
 
291
291
  return action;
@@ -614,9 +614,9 @@ export class SecurityMonitor extends EventEmitter {
614
614
  /**
615
615
  * Group array by property
616
616
  */
617
- private groupBy(array: Array<Record<string, any>>, property: string): Record<string, number> { // eslint-disable-line @typescript-eslint/no-explicit-any
617
+ private groupBy(array: SecurityEvent[], property: string): Record<string, number> {
618
618
  return array.reduce<Record<string, number>>((acc, item) => {
619
- const key = (item && item[property]) || "unknown";
619
+ const key = String((item as unknown as Record<string, unknown>)[property]) || "unknown";
620
620
  acc[key] = (acc[key] || 0) + 1;
621
621
  return acc;
622
622
  }, {});
@@ -381,9 +381,13 @@ export class SecurityReviewer {
381
381
  logger.info("Review completed", { filePath, findingsCount: findings.length, reviewId });
382
382
 
383
383
  return result;
384
- } catch (error) {
385
- logger.error("Review failed", { filePath, reviewId, error: error instanceof Error ? error.message : String(error) });
386
- throw new SecurityValidationError("Security review failed", [{ message: String(error) }]);
384
+ } catch (_error) {
385
+ logger.error("Review failed", {
386
+ filePath,
387
+ reviewId,
388
+ _error: _error instanceof Error ? _error.message : String(_error),
389
+ });
390
+ throw new SecurityValidationError("Security review failed", [{ message: String(_error) }]);
387
391
  }
388
392
  }
389
393
 
@@ -422,9 +426,12 @@ export class SecurityReviewer {
422
426
  }
423
427
 
424
428
  return results;
425
- } catch (error) {
426
- logger.error("Directory review failed", { dirPath, error: error instanceof Error ? error.message : String(error) });
427
- throw new SecurityValidationError("Directory review failed", [{ message: String(error) }]);
429
+ } catch (_error) {
430
+ logger.error("Directory review failed", {
431
+ dirPath,
432
+ _error: _error instanceof Error ? _error.message : String(_error),
433
+ });
434
+ throw new SecurityValidationError("Directory review failed", [{ message: String(_error) }]);
428
435
  }
429
436
  }
430
437
 
@@ -107,11 +107,11 @@ export class SecuritySystem {
107
107
 
108
108
  this.initialized = true;
109
109
  logger.info("Security system initialized successfully");
110
- } catch (error) {
110
+ } catch (_error) {
111
111
  logger.error("Security system initialization failed", {
112
- error: error instanceof Error ? error.message : String(error),
112
+ _error: _error instanceof Error ? _error.message : String(_error),
113
113
  });
114
- throw new SecurityValidationError("Security system initialization failed", [{ message: String(error) }]);
114
+ throw new SecurityValidationError("Security system initialization failed", [{ message: String(_error) }]);
115
115
  }
116
116
  }
117
117
 
@@ -59,15 +59,15 @@ export class ConnectionTester {
59
59
  const duration = Date.now() - startTime;
60
60
  this.logger.info("Connection successful", { siteId, duration: `${duration}ms` });
61
61
  results.push({ siteId, success: true });
62
- } catch (error) {
62
+ } catch (_error) {
63
63
  const duration = Date.now() - startTime;
64
- const errorMessage = getErrorMessage(error);
64
+ const errorMessage = getErrorMessage(_error);
65
65
 
66
66
  this.logger.warn("Connection failed", {
67
67
  siteId,
68
68
  error: errorMessage,
69
69
  duration: `${duration}ms`,
70
- isAuthError: ConnectionTester.isAuthenticationError(error),
70
+ isAuthError: ConnectionTester.isAuthenticationError(_error),
71
71
  });
72
72
 
73
73
  results.push({ siteId, success: false, error: errorMessage });
@@ -122,10 +122,10 @@ export class ConnectionTester {
122
122
 
123
123
  this.logger.debug("Health check passed", { siteId });
124
124
  return true;
125
- } catch (error) {
125
+ } catch (_error) {
126
126
  this.logger.warn("Health check failed", {
127
127
  siteId,
128
- error: getErrorMessage(error),
128
+ _error: getErrorMessage(_error),
129
129
  });
130
130
  return false;
131
131
  }
@@ -26,8 +26,9 @@ export interface ToolDefinition {
26
26
  * Handles tool registration, parameter validation, and execution
27
27
  */
28
28
  export class ToolRegistry {
29
- private server: McpServer;
30
- private wordpressClients: Map<string, WordPressClient>;
29
+ // Exposed for tests that assert presence of these fields
30
+ public server: McpServer;
31
+ public wordpressClients: Map<string, WordPressClient>;
31
32
 
32
33
  constructor(server: McpServer, wordpressClients: Map<string, WordPressClient>) {
33
34
  this.server = server;
@@ -141,8 +142,8 @@ export class ToolRegistry {
141
142
  },
142
143
  ],
143
144
  };
144
- } catch (error) {
145
- if (this.isAuthenticationError(error)) {
145
+ } catch (_error) {
146
+ if (this.isAuthenticationError(_error)) {
146
147
  return {
147
148
  content: [
148
149
  {
@@ -155,12 +156,12 @@ export class ToolRegistry {
155
156
  }
156
157
 
157
158
  // Handle enhanced errors with suggestions
158
- if (error instanceof EnhancedError) {
159
+ if (_error instanceof EnhancedError) {
159
160
  return {
160
161
  content: [
161
162
  {
162
163
  type: "text" as const,
163
- text: error.toString(),
164
+ text: _error.toString(),
164
165
  },
165
166
  ],
166
167
  isError: true,
@@ -171,7 +172,7 @@ export class ToolRegistry {
171
172
  content: [
172
173
  {
173
174
  type: "text" as const,
174
- text: `Error: ${getErrorMessage(error)}`,
175
+ text: `Error: ${getErrorMessage(_error)}`,
175
176
  },
176
177
  ],
177
178
  isError: true,
@@ -223,7 +224,7 @@ export class ToolRegistry {
223
224
  case "array":
224
225
  return z.array(z.string());
225
226
  case "object":
226
- return z.record(z.unknown());
227
+ return z.record(z.string(), z.unknown());
227
228
  default:
228
229
  return z.string();
229
230
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Server Barrel Export
3
+ * Centralized exports for server components
4
+ */
5
+
6
+ // Connection Testing
7
+ export { ConnectionTester } from './ConnectionTester.js';
8
+
9
+ // Tool Registry Management
10
+ export { ToolRegistry } from './ToolRegistry.js';
@@ -33,10 +33,10 @@ export class BaseToolUtils {
33
33
  */
34
34
  static validateParams<T extends Record<string, unknown>>(
35
35
  params: unknown,
36
- rules: readonly ParameterValidationRule[]
36
+ rules: readonly ParameterValidationRule[],
37
37
  ): Result<T, Error> {
38
- if (!params || typeof params !== 'object' || Array.isArray(params)) {
39
- return createError(new ValidationError('Parameters must be a non-null object', 'params', params));
38
+ if (!params || typeof params !== "object" || Array.isArray(params)) {
39
+ return createError(new ValidationError("Parameters must be a non-null object", "params", params));
40
40
  }
41
41
 
42
42
  const typedParams = params as Record<string, unknown>;
@@ -48,11 +48,9 @@ export class BaseToolUtils {
48
48
 
49
49
  // Check required fields
50
50
  if (rule.required && (!exists || value === undefined || value === null)) {
51
- errors.push(new ValidationError(
52
- rule.errorMessage || `Missing required parameter: ${rule.key}`,
53
- rule.key,
54
- value
55
- ));
51
+ errors.push(
52
+ new ValidationError(rule.errorMessage || `Missing required parameter: ${rule.key}`, rule.key, value),
53
+ );
56
54
  continue;
57
55
  }
58
56
 
@@ -63,21 +61,21 @@ export class BaseToolUtils {
63
61
 
64
62
  // Type validation
65
63
  if (rule.type && typeof value !== rule.type) {
66
- errors.push(new ValidationError(
67
- `Parameter ${rule.key} must be of type ${rule.type}, got ${typeof value}`,
68
- rule.key,
69
- value
70
- ));
64
+ errors.push(
65
+ new ValidationError(
66
+ `Parameter ${rule.key} must be of type ${rule.type}, got ${typeof value}`,
67
+ rule.key,
68
+ value,
69
+ ),
70
+ );
71
71
  continue;
72
72
  }
73
73
 
74
74
  // Custom validation
75
75
  if (rule.validator && !rule.validator(value)) {
76
- errors.push(new ValidationError(
77
- rule.errorMessage || `Parameter ${rule.key} failed validation`,
78
- rule.key,
79
- value
80
- ));
76
+ errors.push(
77
+ new ValidationError(rule.errorMessage || `Parameter ${rule.key} failed validation`, rule.key, value),
78
+ );
81
79
  continue;
82
80
  }
83
81
 
@@ -85,12 +83,14 @@ export class BaseToolUtils {
85
83
  if (rule.transformer) {
86
84
  try {
87
85
  typedParams[rule.key] = rule.transformer(value);
88
- } catch (error) {
89
- errors.push(new ValidationError(
90
- `Failed to transform parameter ${rule.key}: ${getErrorMessage(error)}`,
91
- rule.key,
92
- value
93
- ));
86
+ } catch (_error) {
87
+ errors.push(
88
+ new ValidationError(
89
+ `Failed to transform parameter ${rule.key}: ${getErrorMessage(_error)}`,
90
+ rule.key,
91
+ value,
92
+ ),
93
+ );
94
94
  }
95
95
  }
96
96
  }
@@ -109,19 +109,11 @@ export class BaseToolUtils {
109
109
  try {
110
110
  const numId = Number(id);
111
111
  if (!Number.isInteger(numId) || numId <= 0) {
112
- return createError(new ValidationError(
113
- `Invalid ${name}: must be a positive integer`,
114
- name,
115
- id
116
- ));
112
+ return createError(new ValidationError(`Invalid ${name}: must be a positive integer`, name, id));
117
113
  }
118
114
  return createSuccess(createWordPressId(numId));
119
- } catch (error) {
120
- return createError(new ValidationError(
121
- `Invalid ${name}: ${getErrorMessage(error)}`,
122
- name,
123
- id
124
- ));
115
+ } catch (_error) {
116
+ return createError(new ValidationError(`Invalid ${name}: ${getErrorMessage(_error)}`, name, id));
125
117
  }
126
118
  }
127
119
 
@@ -130,7 +122,7 @@ export class BaseToolUtils {
130
122
  */
131
123
  static validateIds(ids: unknown[], name = "ids"): Result<readonly WordPressId[], Error> {
132
124
  const validatedIds: WordPressId[] = [];
133
-
125
+
134
126
  for (let i = 0; i < ids.length; i++) {
135
127
  const result = this.validateId(ids[i], `${name}[${i}]`);
136
128
  if (!result.success) {
@@ -138,7 +130,7 @@ export class BaseToolUtils {
138
130
  }
139
131
  validatedIds.push(result.data);
140
132
  }
141
-
133
+
142
134
  return createSuccess(validatedIds as readonly WordPressId[]);
143
135
  }
144
136
 
@@ -148,13 +140,13 @@ export class BaseToolUtils {
148
140
  static handleError(error: unknown, operation: string, context?: Record<string, unknown> | undefined): Error {
149
141
  const errorMessage = getErrorMessage(error);
150
142
  const enhancedMessage = `Error in ${operation}: ${errorMessage}`;
151
-
143
+
152
144
  const enhancedError = new Error(enhancedMessage) as EnhancedError;
153
145
  enhancedError.originalError = error;
154
146
  enhancedError.operation = operation;
155
147
  enhancedError.context = context;
156
148
  enhancedError.timestamp = new Date();
157
-
149
+
158
150
  return enhancedError;
159
151
  }
160
152
 
@@ -162,18 +154,14 @@ export class BaseToolUtils {
162
154
  * Generate cache keys with enhanced options
163
155
  */
164
156
  static generateCacheKey(
165
- operation: string,
157
+ operation: string,
166
158
  params: DeepReadonly<Record<string, unknown>>,
167
- options: CacheKeyOptions = {}
159
+ options: CacheKeyOptions = {},
168
160
  ): string {
169
- const {
170
- namespace = 'wp',
171
- includeTimestamp = false,
172
- customHasher
173
- } = options;
161
+ const { namespace = "wp", includeTimestamp = false, customHasher } = options;
174
162
 
175
163
  const site = params.site || "default";
176
-
164
+
177
165
  let paramStr: string;
178
166
  if (customHasher) {
179
167
  paramStr = customHasher(params as Record<string, unknown>);
@@ -186,12 +174,12 @@ export class BaseToolUtils {
186
174
  }
187
175
 
188
176
  let cacheKey = `${namespace}:${site}:${operation}:${paramStr}`;
189
-
177
+
190
178
  if (includeTimestamp) {
191
179
  const timestamp = Math.floor(Date.now() / 1000);
192
180
  cacheKey += `:${timestamp}`;
193
181
  }
194
-
182
+
195
183
  return cacheKey;
196
184
  }
197
185
 
@@ -200,17 +188,17 @@ export class BaseToolUtils {
200
188
  */
201
189
  static formatSuccessMessage(operation: string, details?: string, count?: number): string {
202
190
  let message = operation;
203
-
191
+
204
192
  if (count !== undefined) {
205
- message += ` (${count} ${count === 1 ? 'item' : 'items'})`;
193
+ message += ` (${count} ${count === 1 ? "item" : "items"})`;
206
194
  }
207
-
195
+
208
196
  if (details) {
209
197
  message += `: ${details}`;
210
198
  } else {
211
199
  message += " completed successfully";
212
200
  }
213
-
201
+
214
202
  return message;
215
203
  }
216
204
 
@@ -218,7 +206,7 @@ export class BaseToolUtils {
218
206
  * Validate string parameters with enhanced checks
219
207
  */
220
208
  static validateString(
221
- value: unknown,
209
+ value: unknown,
222
210
  name: string,
223
211
  options: {
224
212
  readonly required?: boolean;
@@ -226,7 +214,7 @@ export class BaseToolUtils {
226
214
  readonly maxLength?: number;
227
215
  readonly pattern?: RegExp;
228
216
  readonly allowEmpty?: boolean;
229
- } = {}
217
+ } = {},
230
218
  ): Result<string, Error> {
231
219
  const { required = true, minLength, maxLength, pattern, allowEmpty = false } = options;
232
220
 
@@ -234,10 +222,10 @@ export class BaseToolUtils {
234
222
  if (required) {
235
223
  return createError(new ValidationError(`${name} is required`, name, value));
236
224
  }
237
- return createSuccess('');
225
+ return createSuccess("");
238
226
  }
239
227
 
240
- if (typeof value !== 'string') {
228
+ if (typeof value !== "string") {
241
229
  return createError(new ValidationError(`${name} must be a string`, name, value));
242
230
  }
243
231
 
@@ -246,27 +234,15 @@ export class BaseToolUtils {
246
234
  }
247
235
 
248
236
  if (minLength !== undefined && value.length < minLength) {
249
- return createError(new ValidationError(
250
- `${name} must be at least ${minLength} characters long`,
251
- name,
252
- value
253
- ));
237
+ return createError(new ValidationError(`${name} must be at least ${minLength} characters long`, name, value));
254
238
  }
255
239
 
256
240
  if (maxLength !== undefined && value.length > maxLength) {
257
- return createError(new ValidationError(
258
- `${name} must be no more than ${maxLength} characters long`,
259
- name,
260
- value
261
- ));
241
+ return createError(new ValidationError(`${name} must be no more than ${maxLength} characters long`, name, value));
262
242
  }
263
243
 
264
244
  if (pattern && !pattern.test(value)) {
265
- return createError(new ValidationError(
266
- `${name} does not match required pattern`,
267
- name,
268
- value
269
- ));
245
+ return createError(new ValidationError(`${name} does not match required pattern`, name, value));
270
246
  }
271
247
 
272
248
  return createSuccess(value);
@@ -275,25 +251,21 @@ export class BaseToolUtils {
275
251
  /**
276
252
  * Type-safe parameter extraction
277
253
  */
278
- static extractParam<T>(
279
- params: DeepReadonly<Record<string, unknown>>,
280
- key: string,
281
- defaultValue?: T
282
- ): T | undefined {
254
+ static extractParam<T>(params: DeepReadonly<Record<string, unknown>>, key: string, defaultValue?: T): T | undefined {
283
255
  const value = params[key];
284
- return value !== undefined ? value as T : defaultValue;
256
+ return value !== undefined ? (value as T) : defaultValue;
285
257
  }
286
258
 
287
259
  /**
288
260
  * Safe array extraction with type validation
289
261
  */
290
262
  static extractArray<T>(
291
- params: DeepReadonly<Record<string, unknown>>,
263
+ params: DeepReadonly<Record<string, unknown>>,
292
264
  key: string,
293
- itemValidator?: (item: unknown) => item is T
265
+ itemValidator?: (item: unknown) => item is T,
294
266
  ): readonly T[] {
295
267
  const value = params[key];
296
-
268
+
297
269
  if (!Array.isArray(value)) {
298
270
  return [];
299
271
  }
@@ -311,9 +283,9 @@ class ValidationError extends Error {
311
283
  constructor(
312
284
  message: string,
313
285
  public readonly field: string,
314
- public readonly value: unknown
286
+ public readonly value: unknown,
315
287
  ) {
316
288
  super(message);
317
- this.name = 'ValidationError';
289
+ this.name = "ValidationError";
318
290
  }
319
291
  }
package/src/tools/auth.ts CHANGED
@@ -14,7 +14,14 @@ export class AuthTools {
14
14
  public getTools(): Array<{
15
15
  name: string;
16
16
  description: string;
17
- parameters?: Array<{ name: string; type?: string; description?: string; required?: boolean; enum?: string[]; items?: unknown }>;
17
+ parameters?: Array<{
18
+ name: string;
19
+ type?: string;
20
+ description?: string;
21
+ required?: boolean;
22
+ enum?: string[];
23
+ items?: unknown;
24
+ }>;
18
25
  handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
19
26
  }> {
20
27
  return [
@@ -94,8 +101,8 @@ export class AuthTools {
94
101
  "Your WordPress connection is working properly.";
95
102
 
96
103
  return { content };
97
- } catch (error) {
98
- throw new Error(`Authentication test failed: ${getErrorMessage(error)}`);
104
+ } catch (_error) {
105
+ throw new Error(`Authentication test failed: ${getErrorMessage(_error)}`);
99
106
  }
100
107
  }
101
108
 
@@ -126,8 +133,8 @@ export class AuthTools {
126
133
  }
127
134
 
128
135
  return { content };
129
- } catch (error) {
130
- throw new Error(`Failed to get auth status: ${getErrorMessage(error)}`);
136
+ } catch (_error) {
137
+ throw new Error(`Failed to get auth status: ${getErrorMessage(_error)}`);
131
138
  }
132
139
  }
133
140
 
@@ -138,11 +145,13 @@ export class AuthTools {
138
145
  * @param params - The parameters for the tool request, including the new auth details.
139
146
  * @returns A promise that resolves to an MCPToolResponse.
140
147
  */
141
- public async handleSwitchAuthMethod(
142
- client: WordPressClient,
143
- params: Record<string, unknown>,
144
- ): Promise<unknown> {
145
- const { method: _method, username: _username, password: _password, jwt_token: _jwt_token } = params as {
148
+ public async handleSwitchAuthMethod(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
149
+ const {
150
+ method: _method,
151
+ username: _username,
152
+ password: _password,
153
+ jwt_token: _jwt_token,
154
+ } = params as {
146
155
  method: AuthMethod;
147
156
  username?: string;
148
157
  password?: string;
@@ -154,8 +163,8 @@ export class AuthTools {
154
163
  throw new Error(
155
164
  "Dynamic authentication method switching is not currently supported. Please update your configuration file and restart the server.",
156
165
  );
157
- } catch (error) {
158
- throw new Error(`Failed to switch auth method: ${getErrorMessage(error)}`);
166
+ } catch (_error) {
167
+ throw new Error(`Failed to switch auth method: ${getErrorMessage(_error)}`);
159
168
  }
160
169
  }
161
170
  }