@wplaunchify/ml-mcp-server 2.6.1 → 2.6.2

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/build/server.js CHANGED
@@ -91,16 +91,16 @@ console.error(`✅ Registered ${registeredCount} of ${allTools.length} tools`);
91
91
  async function main() {
92
92
  const { logToFile } = await import('./wordpress.js');
93
93
  logToFile('Starting WordPress MCP server...');
94
- // Environment variables are passed by MCP client (Claude Desktop, Cursor, etc.)
95
- // Don't exit here - let initWordPress() handle the validation
94
+ // CRITICAL: DO NOT call initWordPress() during startup
95
+ // It will be called lazily on first tool execution
96
+ // This prevents blocking when multiple servers start simultaneously
96
97
  if (!process.env.WORDPRESS_API_URL) {
97
- logToFile('Warning: WORDPRESS_API_URL not set. Will fail on first tool call if not provided by MCP client.');
98
+ logToFile('Warning: WORDPRESS_API_URL not set. Will be initialized on first tool call.');
99
+ }
100
+ else {
101
+ logToFile('WORDPRESS_API_URL is set. Client will be initialized on first tool call.');
98
102
  }
99
103
  try {
100
- logToFile('Initializing WordPress client...');
101
- const { initWordPress } = await import('./wordpress.js');
102
- await initWordPress();
103
- logToFile('WordPress client initialized successfully.');
104
104
  logToFile('Setting up server transport...');
105
105
  const transport = new StdioServerTransport();
106
106
  await server.connect(transport);
@@ -108,7 +108,6 @@ async function main() {
108
108
  }
109
109
  catch (error) {
110
110
  logToFile(`Failed to initialize server: ${error}`);
111
- // Don't exit immediately - let the MCP client handle the error
112
111
  throw error;
113
112
  }
114
113
  }
@@ -84,8 +84,10 @@ export function logToFile(message) {
84
84
  * @returns Response data
85
85
  */
86
86
  export async function makeWordPressRequest(method, endpoint, data, options) {
87
+ // Lazy initialization - initialize on first request if not already done
87
88
  if (!wpClient) {
88
- throw new Error('WordPress client not initialized');
89
+ logToFile('WordPress client not initialized, initializing now...');
90
+ await initWordPress();
89
91
  }
90
92
  // Log data (skip for FormData which can't be stringified)
91
93
  if (!options?.isFormData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wplaunchify/ml-mcp-server",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Universal MCP Server for WordPress + Fluent Suite (Community, CRM, Cart) + FluentMCP Pro. Comprehensive tools for AI-powered WordPress management via Claude, Cursor, and other MCP clients.",
5
5
  "type": "module",
6
6
  "main": "./build/server.js",