friday-mcp-v2 2.0.0 → 2.0.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.
- package/dist/mcp-server.js +14 -2
- package/dist/wordpress-api.js +10 -3
- package/package.json +7 -2
package/dist/mcp-server.js
CHANGED
|
@@ -84,6 +84,19 @@ function errorResponse(toolName, message, site) {
|
|
|
84
84
|
return { content: [{ type: "text", text: `❌ ${message}` }], isError: true };
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
function timeoutResponse(toolName, client, site) {
|
|
88
|
+
sendFeedback({ tool: toolName, category: 'error', content: 'タイムアウト: WordPressエディタが応答していません', site: site || 'default' });
|
|
89
|
+
const debug = client?.lastTimeoutDebug;
|
|
90
|
+
let text = '⏳ タイムアウト: WordPressエディタが応答していません。';
|
|
91
|
+
if (debug) {
|
|
92
|
+
text += `\n\n[DEBUG] command=${debug.command} cmdId=${debug.commandId} elapsed=${debug.elapsed}ms polls=${debug.polls}`;
|
|
93
|
+
if (debug.pollLog?.length > 0) {
|
|
94
|
+
text += '\n' + debug.pollLog.map(p => ` poll${p.poll}: ${p.error ? 'ERROR ' + p.error : JSON.stringify(p._debug)}`).join('\n');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { content: [{ type: "text", text }] };
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
// MCPサーバーの定義
|
|
88
101
|
const server = new Server({
|
|
89
102
|
name: "friday-mcp-v2",
|
|
@@ -1256,8 +1269,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1256
1269
|
} else {
|
|
1257
1270
|
const result = await client.sendEditorCommand("get_post_meta", {});
|
|
1258
1271
|
if (!result)
|
|
1259
|
-
|
|
1260
|
-
return { content: [{ type: "text", text: "⏳ タイムアウト: WordPressエディタが応答していません。" }] };
|
|
1272
|
+
return timeoutResponse(name, client, args?.site);
|
|
1261
1273
|
if (!result.success)
|
|
1262
1274
|
return errorResponse(name, result.error, args?.site);
|
|
1263
1275
|
m = result.meta;
|
package/dist/wordpress-api.js
CHANGED
|
@@ -89,19 +89,26 @@ export class FridayWPClient {
|
|
|
89
89
|
|
|
90
90
|
const pollInterval = 500;
|
|
91
91
|
const maxAttempts = Math.ceil(maxWaitMs / pollInterval);
|
|
92
|
+
const t0 = Date.now();
|
|
93
|
+
const pollLog = [];
|
|
92
94
|
|
|
93
95
|
for (let i = 0; i < maxAttempts; i++) {
|
|
94
96
|
await new Promise(r => setTimeout(r, pollInterval));
|
|
95
97
|
try {
|
|
96
98
|
const data = await this.request(`/editor/command/result/${commandId}`);
|
|
97
99
|
if (data?.status === 'completed' && data?.result !== undefined) {
|
|
100
|
+
this.lastTimeoutDebug = null;
|
|
98
101
|
return data.result;
|
|
99
102
|
}
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
// _debug 情報があれば記録(最初の1回のみ)
|
|
104
|
+
if (data?._debug && pollLog.length === 0) {
|
|
105
|
+
pollLog.push({ poll: i + 1, status: data.status, _debug: data._debug });
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
pollLog.push({ poll: i + 1, error: e.message });
|
|
103
109
|
}
|
|
104
110
|
}
|
|
111
|
+
this.lastTimeoutDebug = { command, commandId, elapsed: Date.now() - t0, polls: maxAttempts, pollLog };
|
|
105
112
|
return null; // timeout
|
|
106
113
|
}
|
|
107
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "friday-mcp-v2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "WordPress MCP Server for Claude Code - REST API direct communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mcp-server.js",
|
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "node dist/mcp-server.js"
|
|
15
15
|
},
|
|
16
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"wordpress",
|
|
19
|
+
"claude",
|
|
20
|
+
"ai"
|
|
21
|
+
],
|
|
17
22
|
"author": "",
|
|
18
23
|
"license": "MIT",
|
|
19
24
|
"dependencies": {
|