mcp-feedback-enhanced 0.1.46 → 0.1.64
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/index.js +53 -17
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -173,13 +173,29 @@ async function findExtensionForProjectAsync(projectPath) {
|
|
|
173
173
|
if (servers.length === 0) {
|
|
174
174
|
return null;
|
|
175
175
|
}
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
// Get MCP server's CURSOR_TRACE_ID (if running in Cursor)
|
|
177
|
+
const myTraceId = process.env['CURSOR_TRACE_ID'] || '';
|
|
178
|
+
debug(`My CURSOR_TRACE_ID: ${myTraceId || '(not set)'}`);
|
|
179
|
+
// Strategy 0: CURSOR_TRACE_ID match (HIGHEST PRIORITY - same Cursor window)
|
|
180
|
+
if (myTraceId) {
|
|
181
|
+
const traceMatch = servers.find(s => s.cursorTraceId === myTraceId);
|
|
182
|
+
if (traceMatch) {
|
|
183
|
+
debug(`✓ CURSOR_TRACE_ID match: port=${traceMatch.port}, traceId=${myTraceId}`);
|
|
184
|
+
return traceMatch;
|
|
181
185
|
}
|
|
182
186
|
}
|
|
187
|
+
// Strategy 1: Exact workspace match + traceId filter if available
|
|
188
|
+
const workspaceMatches = servers.filter(s => s.workspaces?.includes(projectPath));
|
|
189
|
+
if (workspaceMatches.length === 1) {
|
|
190
|
+
debug(`✓ Exact workspace match (single): port=${workspaceMatches[0].port}`);
|
|
191
|
+
return workspaceMatches[0];
|
|
192
|
+
}
|
|
193
|
+
if (workspaceMatches.length > 1) {
|
|
194
|
+
// Multiple windows have this workspace - take most recent
|
|
195
|
+
const sorted = workspaceMatches.sort((a, b) => b.timestamp - a.timestamp);
|
|
196
|
+
debug(`✓ Exact workspace match (multiple, taking most recent): port=${sorted[0].port}`);
|
|
197
|
+
return sorted[0];
|
|
198
|
+
}
|
|
183
199
|
// Strategy 2: Prefix match (project is inside a workspace)
|
|
184
200
|
for (const server of servers) {
|
|
185
201
|
for (const ws of server.workspaces || []) {
|
|
@@ -206,7 +222,7 @@ async function findExtensionForProjectAsync(projectPath) {
|
|
|
206
222
|
debug(`✓ Using most recent server: port=${sorted[0].port}`);
|
|
207
223
|
debug(` Available servers:`);
|
|
208
224
|
sorted.forEach(s => {
|
|
209
|
-
debug(` - pid=${s.pid}, port=${s.port}, workspaces=${s.workspaces?.join(', ')}`);
|
|
225
|
+
debug(` - pid=${s.pid}, port=${s.port}, traceId=${s.cursorTraceId}, workspaces=${s.workspaces?.join(', ')}`);
|
|
210
226
|
});
|
|
211
227
|
return sorted[0];
|
|
212
228
|
}
|
|
@@ -217,11 +233,19 @@ function findExtensionForProject(projectPath) {
|
|
|
217
233
|
const servers = getLiveServers();
|
|
218
234
|
if (servers.length === 0)
|
|
219
235
|
return null;
|
|
220
|
-
//
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
// Strategy 0: CURSOR_TRACE_ID match (highest priority)
|
|
237
|
+
const myTraceId = process.env['CURSOR_TRACE_ID'] || '';
|
|
238
|
+
if (myTraceId) {
|
|
239
|
+
const traceMatch = servers.find(s => s.cursorTraceId === myTraceId);
|
|
240
|
+
if (traceMatch)
|
|
241
|
+
return traceMatch;
|
|
242
|
+
}
|
|
243
|
+
// Strategy 1: Exact workspace match
|
|
244
|
+
const workspaceMatches = servers.filter(s => s.workspaces?.includes(projectPath));
|
|
245
|
+
if (workspaceMatches.length >= 1) {
|
|
246
|
+
return workspaceMatches.sort((a, b) => b.timestamp - a.timestamp)[0];
|
|
224
247
|
}
|
|
248
|
+
// Strategy 2: Prefix match
|
|
225
249
|
for (const server of servers) {
|
|
226
250
|
for (const ws of server.workspaces || []) {
|
|
227
251
|
if (projectPath.startsWith(ws + path.sep) || ws.startsWith(projectPath + path.sep)) {
|
|
@@ -229,9 +253,11 @@ function findExtensionForProject(projectPath) {
|
|
|
229
253
|
}
|
|
230
254
|
}
|
|
231
255
|
}
|
|
256
|
+
// Strategy 3: parentPid match
|
|
232
257
|
const parentMatch = servers.find(s => s.parentPid === process.ppid);
|
|
233
258
|
if (parentMatch)
|
|
234
259
|
return parentMatch;
|
|
260
|
+
// Fallbacks
|
|
235
261
|
if (servers.length === 1)
|
|
236
262
|
return servers[0];
|
|
237
263
|
return servers.sort((a, b) => b.timestamp - a.timestamp)[0];
|
|
@@ -428,19 +454,29 @@ server.tool('interactive_feedback', 'Collect feedback from user through VSCode e
|
|
|
428
454
|
project_directory: z.string().describe('The project directory path for context'),
|
|
429
455
|
summary: z.string().describe('Summary of AI work completed for user review'),
|
|
430
456
|
timeout: z.number().optional().default(600).describe('Timeout in seconds (default: 600)'),
|
|
431
|
-
agent_name: z.string().optional().describe('
|
|
457
|
+
agent_name: z.string().optional().describe('Unique identifier for this agent/chat session. Use a stable name like the chat title or task description (e.g. "Chat 1", "Pre-credit Implementation", "Bug Fix #123"). If not provided, defaults to "Agent" and all messages will appear in the same tab. Providing a unique name allows multiple agents to have separate conversation tabs.')
|
|
432
458
|
}, async ({ project_directory, summary, timeout, agent_name }) => {
|
|
433
459
|
debug(`interactive_feedback called: project=${project_directory}, agent=${agent_name || 'default'}`);
|
|
434
460
|
try {
|
|
435
461
|
const result = await requestFeedback(project_directory, summary, timeout || 600, agent_name);
|
|
436
|
-
//
|
|
437
|
-
|
|
462
|
+
// Build content array with text and images
|
|
463
|
+
const content = [{ type: 'text', text: `User Feedback:\n${result.feedback}` }];
|
|
464
|
+
// Add images as MCP image content items
|
|
438
465
|
if (result.images && result.images.length > 0) {
|
|
439
|
-
|
|
466
|
+
debug(`Processing ${result.images.length} image(s)`);
|
|
467
|
+
for (const img of result.images) {
|
|
468
|
+
// img is { name: string, data: string (base64) }
|
|
469
|
+
if (img && img.data) {
|
|
470
|
+
content.push({
|
|
471
|
+
type: 'image',
|
|
472
|
+
data: img.data,
|
|
473
|
+
mimeType: 'image/png' // Default to PNG; could infer from name
|
|
474
|
+
});
|
|
475
|
+
debug(`Added image: ${img.name || 'unnamed'}`);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
440
478
|
}
|
|
441
|
-
return {
|
|
442
|
-
content: [{ type: 'text', text: response }]
|
|
443
|
-
};
|
|
479
|
+
return { content };
|
|
444
480
|
}
|
|
445
481
|
catch (error) {
|
|
446
482
|
debug(`Feedback error: ${error.message}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-feedback-enhanced",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64",
|
|
4
4
|
"description": "MCP Feedback Enhanced Server - Interactive feedback collection for AI assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"vscode",
|
|
18
18
|
"claude"
|
|
19
19
|
],
|
|
20
|
-
"author": "
|
|
20
|
+
"author": "yuanming.chen",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/xxx/mcp-feedback-enhanced"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc",
|