@wplaunchify/ml-mcp-server 2.5.2 → 2.5.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 (2) hide show
  1. package/build/server.js +25 -12
  2. package/package.json +1 -1
package/build/server.js CHANGED
@@ -61,15 +61,27 @@ for (const tool of allTools) {
61
61
  continue;
62
62
  }
63
63
  const wrappedHandler = async (args) => {
64
- // The handler functions are already typed with their specific parameter types
65
- const result = await handler(args);
66
- return {
67
- content: result.toolResult.content.map((item) => ({
68
- ...item,
69
- type: "text"
70
- })),
71
- isError: result.toolResult.isError
72
- };
64
+ try {
65
+ // The handler functions are already typed with their specific parameter types
66
+ const result = await handler(args);
67
+ return {
68
+ content: result.toolResult.content.map((item) => ({
69
+ ...item,
70
+ type: "text"
71
+ })),
72
+ isError: result.toolResult.isError
73
+ };
74
+ }
75
+ catch (error) {
76
+ // Return error as tool result instead of throwing
77
+ return {
78
+ content: [{
79
+ type: "text",
80
+ text: `Error executing ${tool.name}: ${error.message || String(error)}`
81
+ }],
82
+ isError: true
83
+ };
84
+ }
73
85
  };
74
86
  // console.log(`Registering tool: ${tool.name}`);
75
87
  // console.log(`Input schema: ${JSON.stringify(tool.inputSchema)}`);
@@ -110,7 +122,7 @@ async function main() {
110
122
  throw error;
111
123
  }
112
124
  }
113
- // Handle process signals and errors
125
+ // Handle process signals gracefully
114
126
  process.on('SIGTERM', () => {
115
127
  console.log('Received SIGTERM signal, shutting down...');
116
128
  process.exit(0);
@@ -119,13 +131,14 @@ process.on('SIGINT', () => {
119
131
  console.log('Received SIGINT signal, shutting down...');
120
132
  process.exit(0);
121
133
  });
134
+ // Log errors but don't kill the server - let MCP SDK handle tool errors gracefully
122
135
  process.on('uncaughtException', (error) => {
123
136
  console.error('Uncaught exception:', error);
124
- process.exit(1);
137
+ // Don't exit - let the server continue running
125
138
  });
126
139
  process.on('unhandledRejection', (error) => {
127
140
  console.error('Unhandled rejection:', error);
128
- process.exit(1);
141
+ // Don't exit - let the server continue running
129
142
  });
130
143
  main().catch((error) => {
131
144
  console.error('Startup error:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wplaunchify/ml-mcp-server",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
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",