mcp-feedback-enhanced 0.1.55 → 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.
Files changed (2) hide show
  1. package/dist/index.js +37 -11
  2. 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
- // Strategy 1: Exact workspace match
177
- for (const server of servers) {
178
- if (server.workspaces?.includes(projectPath)) {
179
- debug(`✓ Exact workspace match: port=${server.port}`);
180
- return server;
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
- // Same matching logic but sync
221
- for (const server of servers) {
222
- if (server.workspaces?.includes(projectPath))
223
- return server;
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,7 +454,7 @@ 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('Display name for this agent/chat (e.g. "Chat 1", "Refactor Task")')
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-feedback-enhanced",
3
- "version": "0.1.55",
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": "Minidoracat",
20
+ "author": "yuanming.chen",
21
21
  "license": "MIT",
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/Minidoracat/mcp-feedback-enhanced"
24
+ "url": "https://github.com/xxx/mcp-feedback-enhanced"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsc",