cursor-mcp-feedback 2.0.4 → 2.0.5
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/README.md +1 -4
- package/dist/main.js +1 -4
- package/hooks/block-cursor-mcp-feedback.js +14 -71
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ On first startup (or `npm install -g`), the MCP server **automatically configure
|
|
|
138
138
|
|
|
139
139
|
- **Cursor rule** (`~/.cursor/rules/cursor-mcp-feedback.mdc`) — instructs the agent to call `interactive_feedback`
|
|
140
140
|
- **Cursor hooks** (`~/.cursor/hooks/`) — subagent protection + pending message delivery + event logging
|
|
141
|
-
- **hooks.json entries** — registers `
|
|
141
|
+
- **hooks.json entries** — registers `subagentStart`, `subagentStop`, `beforeMCPExecution`, `afterMCPExecution`, `preToolUse` hooks
|
|
142
142
|
|
|
143
143
|
All auto-installed files are kept in sync on every startup (hash-based diffing, idempotent).
|
|
144
144
|
|
|
@@ -182,11 +182,8 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
182
182
|
|
|
183
183
|
| Hook | Event | Purpose |
|
|
184
184
|
|------|-------|---------|
|
|
185
|
-
| `block-cursor-mcp-feedback.js` | `sessionStart` | Create per-session directory & metadata |
|
|
186
|
-
| `block-cursor-mcp-feedback.js` | `sessionEnd` | Mark session inactive, reset subagent counter |
|
|
187
185
|
| `block-cursor-mcp-feedback.js` | `subagentStart` | Increment active subagent counter for parent conversation |
|
|
188
186
|
| `block-cursor-mcp-feedback.js` | `subagentStop` | Decrement active subagent counter |
|
|
189
|
-
| `block-cursor-mcp-feedback.js` | `preToolUse` | Deny feedback tool calls when subagents are active (matcher: `MCP:interactive_feedback\|MCP:submit_feedback`) |
|
|
190
187
|
| `block-cursor-mcp-feedback.js` | `beforeMCPExecution` | Deny cursor-mcp-feedback MCP calls when subagents are active |
|
|
191
188
|
| `block-cursor-mcp-feedback.js` | `afterMCPExecution` | Log feedback_request/response events to events.jsonl |
|
|
192
189
|
| `consume-pending.js` | `preToolUse` | Consume pending messages and inject as agent feedback |
|
package/dist/main.js
CHANGED
|
@@ -99,16 +99,13 @@ function installCursorHooks() {
|
|
|
99
99
|
// Each entry has a unique _source tag for idempotent upsert.
|
|
100
100
|
// Multiple entries per event are supported via distinct _source values.
|
|
101
101
|
const entries = [
|
|
102
|
-
{ event: "sessionStart", hook: { command: `${node} ${blockHook} sessionStart`, _source: "cursor-mcp-feedback" } },
|
|
103
|
-
{ event: "sessionEnd", hook: { command: `${node} ${blockHook} sessionEnd`, _source: "cursor-mcp-feedback" } },
|
|
104
102
|
{ event: "subagentStart", hook: { command: `${node} ${blockHook} subagentStart`, _source: "cursor-mcp-feedback" } },
|
|
105
103
|
{ event: "subagentStop", hook: { command: `${node} ${blockHook} subagentStop`, _source: "cursor-mcp-feedback" } },
|
|
106
104
|
{ event: "beforeMCPExecution", hook: { command: `${node} ${blockHook} beforeMCPExecution`, failClosed: true, _source: "cursor-mcp-feedback" } },
|
|
107
105
|
{ event: "afterMCPExecution", hook: { command: `${node} ${blockHook} afterMCPExecution`, _source: "cursor-mcp-feedback" } },
|
|
108
106
|
{ event: "preToolUse", hook: { command: `${node} ${pendingHook}`, _source: "cursor-mcp-feedback" } },
|
|
109
|
-
{ event: "preToolUse", hook: { command: `${node} ${blockHook} preToolUse`, matcher: "MCP:interactive_feedback|MCP:submit_feedback", failClosed: true, _source: "cursor-mcp-feedback-block" } },
|
|
110
107
|
];
|
|
111
|
-
const allSources = new Set(entries.map((e) => e.hook._source));
|
|
108
|
+
const allSources = new Set([...entries.map((e) => e.hook._source), "cursor-mcp-feedback-block"]);
|
|
112
109
|
const before = JSON.stringify(config);
|
|
113
110
|
// First pass: remove ALL our entries from every event (clean slate)
|
|
114
111
|
for (const arr of Object.values(config.hooks)) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Cursor hook:
|
|
2
|
+
// Cursor hook: subagent protection + feedback event logging.
|
|
3
3
|
//
|
|
4
4
|
// Events (argv[2]):
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// beforeMCPExecution — deny cursor-mcp-feedback calls from subagents
|
|
5
|
+
// subagentStart — increment active subagent counter
|
|
6
|
+
// subagentStop — decrement active subagent counter
|
|
7
|
+
// beforeMCPExecution — deny cursor-mcp-feedback calls when subagents active
|
|
8
|
+
// afterMCPExecution — log feedback events to events.jsonl
|
|
10
9
|
|
|
11
10
|
'use strict';
|
|
12
11
|
|
|
@@ -20,42 +19,11 @@ process.stdin.on('end', () => {
|
|
|
20
19
|
let input;
|
|
21
20
|
try { input = JSON.parse(raw); } catch { input = {}; }
|
|
22
21
|
|
|
23
|
-
if (event === 'sessionStart') {
|
|
24
|
-
su.cleanupStaleSessions();
|
|
25
|
-
const convId = input.session_id || input.conversation_id;
|
|
26
|
-
if (convId) {
|
|
27
|
-
const workspace = (input.workspace_roots || [])[0] || '';
|
|
28
|
-
su.createSession(convId, {
|
|
29
|
-
workspace,
|
|
30
|
-
mode: input.composer_mode || 'agent',
|
|
31
|
-
model: input.model || '',
|
|
32
|
-
is_background: input.is_background_agent || false,
|
|
33
|
-
transcript_path: input.transcript_path || null,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
su.writeHookOutput({});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (event === 'sessionEnd') {
|
|
41
|
-
const convId = input.session_id || input.conversation_id;
|
|
42
|
-
if (convId) {
|
|
43
|
-
su.endSession(convId, input.reason || 'unknown');
|
|
44
|
-
su.resetActiveSubagents(convId);
|
|
45
|
-
}
|
|
46
|
-
su.writeHookOutput({});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
22
|
if (event === 'subagentStart') {
|
|
51
23
|
const subagentId = input.subagent_id;
|
|
52
24
|
const parentConvId = input.parent_conversation_id || input.conversation_id;
|
|
53
|
-
if (subagentId)
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
if (parentConvId) {
|
|
57
|
-
su.incrementActiveSubagents(parentConvId);
|
|
58
|
-
}
|
|
25
|
+
if (subagentId) su.recordSubagent(subagentId, parentConvId);
|
|
26
|
+
if (parentConvId) su.incrementActiveSubagents(parentConvId);
|
|
59
27
|
su.writeHookOutput({});
|
|
60
28
|
return;
|
|
61
29
|
}
|
|
@@ -64,41 +32,11 @@ process.stdin.on('end', () => {
|
|
|
64
32
|
const subagentId = input.subagent_id || input.conversation_id;
|
|
65
33
|
const parentConvId = input.parent_conversation_id || input.conversation_id;
|
|
66
34
|
if (subagentId) su.removeSubagent(subagentId);
|
|
67
|
-
if (parentConvId)
|
|
68
|
-
su.decrementActiveSubagents(parentConvId);
|
|
69
|
-
}
|
|
35
|
+
if (parentConvId) su.decrementActiveSubagents(parentConvId);
|
|
70
36
|
su.writeHookOutput({});
|
|
71
37
|
return;
|
|
72
38
|
}
|
|
73
39
|
|
|
74
|
-
if (event === 'preToolUse') {
|
|
75
|
-
const toolName = (input.tool_name || '').toLowerCase();
|
|
76
|
-
const isFeedbackTool =
|
|
77
|
-
toolName.includes('interactive_feedback') ||
|
|
78
|
-
toolName.includes('submit_feedback');
|
|
79
|
-
|
|
80
|
-
if (!isFeedbackTool) {
|
|
81
|
-
su.writeHookOutput({});
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const convId = input.conversation_id;
|
|
86
|
-
if (convId && su.hasActiveSubagents(convId)) {
|
|
87
|
-
su.writeHookOutput({
|
|
88
|
-
permission: 'deny',
|
|
89
|
-
user_message: '[Hook] Blocked feedback tool call — subagent(s) active',
|
|
90
|
-
agent_message:
|
|
91
|
-
'DENIED by preToolUse hook. ' +
|
|
92
|
-
'cursor-mcp-feedback tools are for the MAIN agent only. ' +
|
|
93
|
-
'Active subagents detected for this conversation. ' +
|
|
94
|
-
'Return your results as text in your final response instead.',
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
su.writeHookOutput({});
|
|
98
|
-
}
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
40
|
if (event === 'beforeMCPExecution') {
|
|
103
41
|
const command = (input.command || '').toLowerCase();
|
|
104
42
|
const isFeedbackApp =
|
|
@@ -114,7 +52,7 @@ process.stdin.on('end', () => {
|
|
|
114
52
|
if (convId && su.hasActiveSubagents(convId)) {
|
|
115
53
|
su.writeHookOutput({
|
|
116
54
|
permission: 'deny',
|
|
117
|
-
user_message: '[Hook] Blocked cursor-mcp-feedback
|
|
55
|
+
user_message: '[Hook] Blocked cursor-mcp-feedback — subagent(s) active',
|
|
118
56
|
agent_message:
|
|
119
57
|
'DENIED by beforeMCPExecution hook. ' +
|
|
120
58
|
'cursor-mcp-feedback tools are for the MAIN agent only. ' +
|
|
@@ -137,6 +75,11 @@ process.stdin.on('end', () => {
|
|
|
137
75
|
|
|
138
76
|
const isFeedback = toolName === 'interactive_feedback' || toolName === 'submit_feedback';
|
|
139
77
|
if (convId && isFeedback) {
|
|
78
|
+
su.ensureSession(convId, {
|
|
79
|
+
workspace: (input.workspace_roots || [])[0] || '',
|
|
80
|
+
model: input.model || '',
|
|
81
|
+
});
|
|
82
|
+
|
|
140
83
|
const eventsFile = require('path').join(su.sessionDir(convId), 'events.jsonl');
|
|
141
84
|
let toolInput = {};
|
|
142
85
|
try { toolInput = typeof input.tool_input === 'string' ? JSON.parse(input.tool_input) : (input.tool_input || {}); } catch {}
|
package/package.json
CHANGED