@achieveai/hitl-mcp-server 1.0.0 → 1.1.0
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 +159 -43
- package/config/claude-desktop.json +2 -2
- package/config/cursor-mcp.json +2 -3
- package/config/vscode-mcp.json +1 -1
- package/dist/__tests__/dialog-manager.test.js +4 -4
- package/dist/__tests__/dialog-manager.test.js.map +1 -1
- package/dist/dialog-manager.d.ts.map +1 -1
- package/dist/dialog-manager.js +59 -7
- package/dist/dialog-manager.js.map +1 -1
- package/dist/index.js +51 -24
- package/dist/index.js.map +1 -1
- package/dist/test-dialog-manager.d.ts +2 -0
- package/dist/test-dialog-manager.d.ts.map +1 -0
- package/dist/test-dialog-manager.js +156 -0
- package/dist/test-dialog-manager.js.map +1 -0
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -1,15 +1,61 @@
|
|
|
1
1
|
# Human In The Loop MCP Server
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that
|
|
3
|
+
A Model Context Protocol (MCP) server that bridges the gap between AI autonomy and human oversight by enabling LLM agents to request human input at critical decision points.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What This Tool Does
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
7
|
+
This MCP server allows AI agents like Claude to pause their execution and ask humans for guidance through interactive browser-based dialogs. Instead of making assumptions or failing when faced with ambiguity, AI agents can now gracefully request human input and continue with confidence.
|
|
8
|
+
|
|
9
|
+
## Real-World Use Cases
|
|
10
|
+
|
|
11
|
+
### 1. **Code Generation Decisions**
|
|
12
|
+
When generating code, the AI can ask:
|
|
13
|
+
- "Which framework should I use: React, Vue, or Angular?"
|
|
14
|
+
- "Should I implement this with TypeScript or JavaScript?"
|
|
15
|
+
- "Which testing framework do you prefer?"
|
|
16
|
+
|
|
17
|
+
### 2. **Deployment & Operations**
|
|
18
|
+
- "Ready to deploy to production? I've run all tests."
|
|
19
|
+
- "Should I rollback the deployment? Errors detected."
|
|
20
|
+
- "Which environment: staging or production?"
|
|
21
|
+
|
|
22
|
+
### 3. **Data Processing**
|
|
23
|
+
- "Found 1000 duplicate records. Delete all, keep first, or review manually?"
|
|
24
|
+
- "Which columns should I include in the export?"
|
|
25
|
+
- "Normalize the data using method A (faster) or B (more accurate)?"
|
|
26
|
+
|
|
27
|
+
### 4. **Content & Documentation**
|
|
28
|
+
- "Which tone for the documentation: formal, casual, or technical?"
|
|
29
|
+
- "Include code examples in the README?"
|
|
30
|
+
- "Which sections are most important for your users?"
|
|
31
|
+
|
|
32
|
+
### 5. **Git Operations**
|
|
33
|
+
- "Which files should I include in this commit?"
|
|
34
|
+
- "Merge conflict detected. Keep theirs, ours, or manual review?"
|
|
35
|
+
- "Create a new branch or commit to main?"
|
|
36
|
+
|
|
37
|
+
## What to Expect
|
|
38
|
+
|
|
39
|
+
### For Developers
|
|
40
|
+
- **Reduced Errors**: AI agents won't make incorrect assumptions about your preferences
|
|
41
|
+
- **Better Control**: Maintain oversight of critical decisions while letting AI handle the implementation
|
|
42
|
+
- **Improved Workflow**: AI can complete complex multi-step tasks with human guidance at key points
|
|
43
|
+
- **Time Savings**: Let AI do the work while you just make the important decisions
|
|
44
|
+
|
|
45
|
+
### For AI Agents
|
|
46
|
+
- **Clear Decision Points**: No more guessing what the user wants
|
|
47
|
+
- **Graceful Handling**: Ambiguous situations become opportunities for clarification
|
|
48
|
+
- **Better Results**: Human input ensures the output matches expectations
|
|
49
|
+
- **Continuous Workflow**: Complete tasks without stopping for every small decision
|
|
50
|
+
|
|
51
|
+
## Core Features
|
|
52
|
+
|
|
53
|
+
- **Browser-Based Dialogs**: Clean, accessible UI that opens automatically
|
|
54
|
+
- **Multiple Choice Support**: Single or multi-select options with descriptions
|
|
55
|
+
- **Custom Input**: "Other" field for responses not in the list
|
|
56
|
+
- **Timeout Support**: Auto-dismiss dialogs after specified time
|
|
10
57
|
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
11
|
-
- **
|
|
12
|
-
- **STDIO Transport**: Easy integration with Claude Desktop and other MCP clients
|
|
58
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
13
59
|
|
|
14
60
|
## Installation
|
|
15
61
|
|
|
@@ -18,12 +64,29 @@ A Model Context Protocol (MCP) server that enables LLM agents to request human i
|
|
|
18
64
|
- Node.js 18+ and npm
|
|
19
65
|
- A browser (for displaying dialogs)
|
|
20
66
|
|
|
67
|
+
### Quick Install from NPM
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Install globally from npm
|
|
71
|
+
npm install -g @achieveai/hitl-mcp-server
|
|
72
|
+
|
|
73
|
+
# Now you can run it from anywhere
|
|
74
|
+
hitl-mcp-server
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Using with npx (no installation required)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Run directly without installing
|
|
81
|
+
npx @achieveai/hitl-mcp-server
|
|
82
|
+
```
|
|
83
|
+
|
|
21
84
|
### From Source
|
|
22
85
|
|
|
23
86
|
```bash
|
|
24
87
|
# Clone the repository
|
|
25
|
-
git clone
|
|
26
|
-
cd hitl-mcp-server
|
|
88
|
+
git clone https://github.com/achieveai/HumanInTheLoop.git
|
|
89
|
+
cd HumanInTheLoop/hitl-mcp-server
|
|
27
90
|
|
|
28
91
|
# Install dependencies
|
|
29
92
|
npm install
|
|
@@ -35,19 +98,6 @@ npm run build
|
|
|
35
98
|
npm run dev
|
|
36
99
|
```
|
|
37
100
|
|
|
38
|
-
### Global Installation
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# Build first
|
|
42
|
-
npm run build
|
|
43
|
-
|
|
44
|
-
# Install globally
|
|
45
|
-
npm install -g .
|
|
46
|
-
|
|
47
|
-
# Now you can run it from anywhere
|
|
48
|
-
hitl-mcp-server
|
|
49
|
-
```
|
|
50
|
-
|
|
51
101
|
## Configuration
|
|
52
102
|
|
|
53
103
|
Pre-configured examples are available in the `config/` directory for different MCP clients.
|
|
@@ -64,8 +114,23 @@ Add the server to your Claude Desktop config file:
|
|
|
64
114
|
{
|
|
65
115
|
"mcpServers": {
|
|
66
116
|
"human-in-the-loop": {
|
|
67
|
-
"command": "
|
|
68
|
-
"args": ["
|
|
117
|
+
"command": "npx",
|
|
118
|
+
"args": ["-y", "@achieveai/hitl-mcp-server"],
|
|
119
|
+
"env": {
|
|
120
|
+
"NODE_ENV": "production"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or if you've installed it globally:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"human-in-the-loop": {
|
|
133
|
+
"command": "hitl-mcp-server",
|
|
69
134
|
"env": {
|
|
70
135
|
"NODE_ENV": "production"
|
|
71
136
|
}
|
|
@@ -83,7 +148,7 @@ Create `.vscode/mcp.json` in your workspace:
|
|
|
83
148
|
"mcpServers": {
|
|
84
149
|
"human-in-the-loop": {
|
|
85
150
|
"command": "npx",
|
|
86
|
-
"args": ["-y", "@hitl
|
|
151
|
+
"args": ["-y", "@achieveai/hitl-mcp-server"],
|
|
87
152
|
"env": {
|
|
88
153
|
"NODE_ENV": "production"
|
|
89
154
|
}
|
|
@@ -101,9 +166,8 @@ Add to your Cursor settings:
|
|
|
101
166
|
"mcpServers": {
|
|
102
167
|
"human-in-the-loop": {
|
|
103
168
|
"name": "Human In The Loop",
|
|
104
|
-
"command": "
|
|
105
|
-
"args": ["
|
|
106
|
-
"cwd": "D:\\Source\\repos\\Hitl_MCP\\hitl-mcp-server",
|
|
169
|
+
"command": "npx",
|
|
170
|
+
"args": ["-y", "@achieveai/hitl-mcp-server"],
|
|
107
171
|
"transport": "stdio",
|
|
108
172
|
"autoStart": false
|
|
109
173
|
}
|
|
@@ -111,22 +175,41 @@ Add to your Cursor settings:
|
|
|
111
175
|
}
|
|
112
176
|
```
|
|
113
177
|
|
|
114
|
-
|
|
178
|
+
Or if you've installed it globally:
|
|
115
179
|
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"mcpServers": {
|
|
183
|
+
"human-in-the-loop": {
|
|
184
|
+
"name": "Human In The Loop",
|
|
185
|
+
"command": "hitl-mcp-server",
|
|
186
|
+
"transport": "stdio",
|
|
187
|
+
"autoStart": false
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Recommended Configuration
|
|
119
194
|
|
|
120
|
-
|
|
195
|
+
For all MCP clients, we recommend using npx for zero-installation setup:
|
|
196
|
+
|
|
197
|
+
```json
|
|
121
198
|
{
|
|
122
199
|
"mcpServers": {
|
|
123
200
|
"human-in-the-loop": {
|
|
124
|
-
"command": "
|
|
201
|
+
"command": "npx",
|
|
202
|
+
"args": ["-y", "@achieveai/hitl-mcp-server"]
|
|
125
203
|
}
|
|
126
204
|
}
|
|
127
205
|
}
|
|
128
206
|
```
|
|
129
207
|
|
|
208
|
+
This approach:
|
|
209
|
+
- Requires no installation
|
|
210
|
+
- Always uses the latest version
|
|
211
|
+
- Works immediately on any system with Node.js
|
|
212
|
+
|
|
130
213
|
## Usage
|
|
131
214
|
|
|
132
215
|
Once configured, the AI agent can use the `ask_human` tool to request input:
|
|
@@ -266,17 +349,43 @@ hitl-mcp-server/
|
|
|
266
349
|
- `npm test` - Run unit tests
|
|
267
350
|
- `npm run typecheck` - Check TypeScript types without building
|
|
268
351
|
|
|
269
|
-
## Why
|
|
352
|
+
## Why This Tool Matters
|
|
353
|
+
|
|
354
|
+
### The Problem
|
|
355
|
+
AI agents are powerful but often encounter situations where they need human judgment:
|
|
356
|
+
- Ambiguous requirements that could be interpreted multiple ways
|
|
357
|
+
- Critical decisions that could have significant consequences
|
|
358
|
+
- Subjective choices about style, approach, or priorities
|
|
359
|
+
- Missing context that only the human user possesses
|
|
360
|
+
|
|
361
|
+
### The Solution
|
|
362
|
+
This tool creates a seamless communication channel between AI and humans:
|
|
363
|
+
- **AI Autonomy**: The agent continues working independently until it needs input
|
|
364
|
+
- **Human Control**: You maintain oversight of important decisions
|
|
365
|
+
- **Efficient Workflow**: No need to micromanage - only intervene when necessary
|
|
366
|
+
- **Better Outcomes**: Combine AI efficiency with human judgment
|
|
270
367
|
|
|
271
|
-
|
|
368
|
+
### Expected Benefits
|
|
272
369
|
|
|
273
|
-
1. **
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
5. **Subjective Choices**: Design decisions, naming conventions, etc.
|
|
370
|
+
1. **Increased Productivity**
|
|
371
|
+
- Let AI handle implementation while you focus on decisions
|
|
372
|
+
- Batch multiple tasks with decision points
|
|
373
|
+
- Reduce back-and-forth clarifications
|
|
278
374
|
|
|
279
|
-
|
|
375
|
+
2. **Improved Accuracy**
|
|
376
|
+
- No more AI guessing your preferences
|
|
377
|
+
- Catch potential issues before they happen
|
|
378
|
+
- Ensure outputs match your expectations
|
|
379
|
+
|
|
380
|
+
3. **Enhanced Trust**
|
|
381
|
+
- Know that AI will ask before making critical changes
|
|
382
|
+
- Review and approve important decisions
|
|
383
|
+
- Maintain control while leveraging AI capabilities
|
|
384
|
+
|
|
385
|
+
4. **Seamless Integration**
|
|
386
|
+
- Works with Claude Desktop, Cursor, VS Code, and other MCP clients
|
|
387
|
+
- No complex setup or configuration required
|
|
388
|
+
- Natural integration into existing AI workflows
|
|
280
389
|
|
|
281
390
|
## Troubleshooting
|
|
282
391
|
|
|
@@ -297,9 +406,16 @@ This tool ensures AI agents can gracefully handle these situations by requesting
|
|
|
297
406
|
- Verify Node.js version is 18 or higher
|
|
298
407
|
- Run `npm install` to ensure all dependencies are installed
|
|
299
408
|
|
|
409
|
+
## Security & Privacy
|
|
410
|
+
|
|
411
|
+
- All dialogs run locally on your machine
|
|
412
|
+
- No data is sent to external servers
|
|
413
|
+
- Dialog server only accepts connections from localhost
|
|
414
|
+
- Temporary server instances are created per request
|
|
415
|
+
|
|
300
416
|
## License
|
|
301
417
|
|
|
302
|
-
|
|
418
|
+
GPL-3.0
|
|
303
419
|
|
|
304
420
|
## Contributing
|
|
305
421
|
|
package/config/cursor-mcp.json
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
"human-in-the-loop": {
|
|
4
4
|
"name": "Human In The Loop",
|
|
5
5
|
"description": "Interactive dialog system for getting human feedback",
|
|
6
|
-
"command": "
|
|
7
|
-
"args": ["
|
|
8
|
-
"cwd": "D:\\Source\\repos\\Hitl_MCP\\hitl-mcp-server",
|
|
6
|
+
"command": "npx",
|
|
7
|
+
"args": ["-y", "@achieveai/hitl-mcp-server"],
|
|
9
8
|
"env": {
|
|
10
9
|
"NODE_ENV": "production"
|
|
11
10
|
},
|
package/config/vscode-mcp.json
CHANGED
|
@@ -106,8 +106,8 @@ describe('DialogManager', () => {
|
|
|
106
106
|
allowMultiple: false,
|
|
107
107
|
allowOther: true
|
|
108
108
|
});
|
|
109
|
-
expect(html).toContain('other-input');
|
|
110
|
-
expect(html).toContain('
|
|
109
|
+
expect(html).toContain('id="other-input"');
|
|
110
|
+
expect(html).toContain('Additional Context (optional)');
|
|
111
111
|
});
|
|
112
112
|
it('should not include other field when not allowed', () => {
|
|
113
113
|
const manager = new DialogManager();
|
|
@@ -118,8 +118,8 @@ describe('DialogManager', () => {
|
|
|
118
118
|
allowMultiple: false,
|
|
119
119
|
allowOther: false
|
|
120
120
|
});
|
|
121
|
-
expect(html).not.toContain('other-input');
|
|
122
|
-
expect(html).not.toContain('
|
|
121
|
+
expect(html).not.toContain('id="other-input"');
|
|
122
|
+
expect(html).not.toContain('Additional Context (optional)');
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
describe('timeout handling', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-manager.test.js","sourceRoot":"","sources":["../../src/__tests__/dialog-manager.test.ts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ED
|
@@ -282,11 +282,11 @@ export class DialogManager extends EventEmitter {
|
|
|
282
282
|
|
|
283
283
|
${request.allowOther ? `
|
|
284
284
|
<div class="other-section">
|
|
285
|
-
<label class="other-label" for="other-input">
|
|
286
|
-
<textarea class="other-input"
|
|
287
|
-
id="other-input"
|
|
288
|
-
rows="3"
|
|
289
|
-
placeholder="
|
|
285
|
+
<label class="other-label" for="other-input">Additional Context (optional):</label>
|
|
286
|
+
<textarea class="other-input"
|
|
287
|
+
id="other-input"
|
|
288
|
+
rows="3"
|
|
289
|
+
placeholder="Provide any additional context, clarifications, or notes to help guide the AI..."></textarea>
|
|
290
290
|
</div>
|
|
291
291
|
` : ''}
|
|
292
292
|
|
|
@@ -335,9 +335,9 @@ export class DialogManager extends EventEmitter {
|
|
|
335
335
|
async function submitResponse() {
|
|
336
336
|
const selectedValues = getSelectedValues();
|
|
337
337
|
const otherText = allowOther ? document.getElementById('other-input').value.trim() : '';
|
|
338
|
-
|
|
338
|
+
|
|
339
339
|
if (selectedValues.length === 0 && !otherText) {
|
|
340
|
-
showError('Please select at least one option or provide
|
|
340
|
+
showError('Please select at least one option and/or provide additional context');
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
343
|
|
|
@@ -404,6 +404,58 @@ export class DialogManager extends EventEmitter {
|
|
|
404
404
|
}
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
|
+
|
|
408
|
+
// Play pleasant notification sound when dialog opens
|
|
409
|
+
async function playNotificationSound() {
|
|
410
|
+
try {
|
|
411
|
+
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
412
|
+
|
|
413
|
+
// Resume audio context (needed for autoplay policies)
|
|
414
|
+
if (audioContext.state === 'suspended') {
|
|
415
|
+
await audioContext.resume();
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const now = audioContext.currentTime;
|
|
419
|
+
|
|
420
|
+
// Create a pleasant two-tone notification (like a doorbell)
|
|
421
|
+
function playTone(frequency, startTime, duration) {
|
|
422
|
+
const oscillator = audioContext.createOscillator();
|
|
423
|
+
const gainNode = audioContext.createGain();
|
|
424
|
+
|
|
425
|
+
oscillator.connect(gainNode);
|
|
426
|
+
gainNode.connect(audioContext.destination);
|
|
427
|
+
|
|
428
|
+
oscillator.frequency.value = frequency;
|
|
429
|
+
oscillator.type = 'sine';
|
|
430
|
+
|
|
431
|
+
// Envelope for smooth sound (louder)
|
|
432
|
+
gainNode.gain.setValueAtTime(0, startTime);
|
|
433
|
+
gainNode.gain.linearRampToValueAtTime(0.5, startTime + 0.02);
|
|
434
|
+
gainNode.gain.exponentialRampToValueAtTime(0.01, startTime + duration);
|
|
435
|
+
|
|
436
|
+
oscillator.start(startTime);
|
|
437
|
+
oscillator.stop(startTime + duration);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Play two pleasant tones (E5 and A5)
|
|
441
|
+
playTone(659.25, now + 0.05, 0.2); // E5
|
|
442
|
+
playTone(880.00, now + 0.25, 0.25); // A5
|
|
443
|
+
} catch (error) {
|
|
444
|
+
console.log('Could not play notification sound:', error);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// Play sound when page loads
|
|
449
|
+
playNotificationSound();
|
|
450
|
+
|
|
451
|
+
// Also ensure sound plays on any user interaction if it failed initially
|
|
452
|
+
let soundPlayed = false;
|
|
453
|
+
document.addEventListener('click', () => {
|
|
454
|
+
if (!soundPlayed) {
|
|
455
|
+
soundPlayed = true;
|
|
456
|
+
playNotificationSound();
|
|
457
|
+
}
|
|
458
|
+
}, { once: true });
|
|
407
459
|
</script>
|
|
408
460
|
</body>
|
|
409
461
|
</html>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-manager.js","sourceRoot":"","sources":["../src/dialog-manager.ts"],"names":[],"mappings":"AAAA,OAAO,OAAuC,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,IAAI,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AAC,GAAG,EAAE;oBACrB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;oBAC3B,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -27,17 +27,28 @@ class HumanInTheLoopServer {
|
|
|
27
27
|
tools: [
|
|
28
28
|
{
|
|
29
29
|
name: TOOL_NAME,
|
|
30
|
-
description: `CRITICAL: Use this tool
|
|
31
|
-
• Resolving ambiguities or unclear requirements
|
|
32
|
-
• Making subjective decisions that require human judgment
|
|
33
|
-
• Choosing between multiple valid approaches
|
|
34
|
-
• Confirming critical actions before execution
|
|
35
|
-
• Getting additional context or clarification
|
|
36
|
-
• Handling edge cases not covered by your instructions
|
|
30
|
+
description: `CRITICAL: Use this tool whenever you have ANY doubt or need human decision-making. This tool is ESSENTIAL for:
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
WHEN TO USE (err on the side of asking):
|
|
33
|
+
• You have even slight uncertainty about what the user wants
|
|
34
|
+
• You need clarification on ambiguous requirements or instructions
|
|
35
|
+
• The user explicitly told you to ask for their input on decisions
|
|
36
|
+
• Multiple valid approaches exist and you're unsure which to choose
|
|
37
|
+
• A decision could have significant consequences
|
|
38
|
+
• You're about to make assumptions that might be wrong
|
|
39
|
+
• You need confirmation before critical or irreversible actions
|
|
40
|
+
• You need additional context not provided in your instructions
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
HOW TO USE:
|
|
43
|
+
• Provide clear, specific options for the human to choose from
|
|
44
|
+
• Think carefully about which option you would recommend and mark it with "(RECOMMENDED)" in the label
|
|
45
|
+
Example: { label: "PostgreSQL (RECOMMENDED)", value: "postgres", description: "Best for complex queries" }
|
|
46
|
+
• The human can select one or more options AND provide additional context
|
|
47
|
+
• The "(RECOMMENDED)" marker helps guide the user but won't appear in the returned value
|
|
48
|
+
|
|
49
|
+
This tool opens an interactive browser dialog with a pleasant notification sound. The human can select options and optionally provide additional context to guide your next steps.
|
|
50
|
+
|
|
51
|
+
IMPORTANT: When in doubt, ASK. Using this tool is far better than making incorrect assumptions. Getting human input ensures accuracy and alignment with user expectations.`,
|
|
41
52
|
inputSchema: {
|
|
42
53
|
type: 'object',
|
|
43
54
|
properties: {
|
|
@@ -71,11 +82,11 @@ IMPORTANT: Prefer using this tool over making assumptions or returning incomplet
|
|
|
71
82
|
allowMultiple: {
|
|
72
83
|
type: 'boolean',
|
|
73
84
|
description: 'Whether to allow selecting multiple options (checkbox vs radio)',
|
|
74
|
-
default:
|
|
85
|
+
default: true
|
|
75
86
|
},
|
|
76
87
|
allowOther: {
|
|
77
88
|
type: 'boolean',
|
|
78
|
-
description: 'Whether to show an "
|
|
89
|
+
description: 'Whether to show an "Additional Context" text field where the user can provide supplementary information alongside their selection(s)',
|
|
79
90
|
default: true
|
|
80
91
|
},
|
|
81
92
|
context: {
|
|
@@ -112,11 +123,15 @@ IMPORTANT: Prefer using this tool over making assumptions or returning incomplet
|
|
|
112
123
|
id: uuidv4(),
|
|
113
124
|
question: args.question,
|
|
114
125
|
options: dialogOptions,
|
|
115
|
-
allowMultiple: args.allowMultiple
|
|
126
|
+
allowMultiple: args.allowMultiple !== false,
|
|
116
127
|
allowOther: args.allowOther !== false,
|
|
117
128
|
context: args.context,
|
|
118
129
|
timeout: args.timeout
|
|
119
130
|
});
|
|
131
|
+
// Helper function to strip (RECOMMENDED) markers from values
|
|
132
|
+
const stripRecommended = (value) => {
|
|
133
|
+
return value.replace(/\s*\(RECOMMENDED\)\s*/gi, '').trim();
|
|
134
|
+
};
|
|
120
135
|
let result = {
|
|
121
136
|
success: true,
|
|
122
137
|
timestamp: response.timestamp
|
|
@@ -124,20 +139,32 @@ IMPORTANT: Prefer using this tool over making assumptions or returning incomplet
|
|
|
124
139
|
if (response.otherText === 'SKIPPED') {
|
|
125
140
|
result.skipped = true;
|
|
126
141
|
result.response = 'User skipped this question';
|
|
127
|
-
|
|
128
|
-
else if (response.otherText && response.otherText !== '') {
|
|
129
|
-
result.response = response.otherText;
|
|
130
|
-
result.responseType = 'custom';
|
|
131
|
-
}
|
|
132
|
-
else if (response.selectedValues.length > 0) {
|
|
133
|
-
result.response = args.allowMultiple
|
|
134
|
-
? response.selectedValues
|
|
135
|
-
: response.selectedValues[0];
|
|
136
|
-
result.responseType = 'selection';
|
|
142
|
+
result.responseType = 'skipped';
|
|
137
143
|
}
|
|
138
144
|
else {
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
// Clean the selected values
|
|
146
|
+
const cleanedValues = response.selectedValues.map(stripRecommended);
|
|
147
|
+
// Include selected values if any
|
|
148
|
+
if (cleanedValues.length > 0) {
|
|
149
|
+
result.selectedValues = args.allowMultiple ? cleanedValues : cleanedValues[0];
|
|
150
|
+
}
|
|
151
|
+
// Include context if provided
|
|
152
|
+
if (response.otherText && response.otherText !== '') {
|
|
153
|
+
result.context = response.otherText;
|
|
154
|
+
}
|
|
155
|
+
// Determine response type
|
|
156
|
+
if (cleanedValues.length > 0 && result.context) {
|
|
157
|
+
result.responseType = 'selection_with_context';
|
|
158
|
+
}
|
|
159
|
+
else if (cleanedValues.length > 0) {
|
|
160
|
+
result.responseType = 'selection';
|
|
161
|
+
}
|
|
162
|
+
else if (result.context) {
|
|
163
|
+
result.responseType = 'context_only';
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
result.responseType = 'none';
|
|
167
|
+
}
|
|
141
168
|
}
|
|
142
169
|
return {
|
|
143
170
|
content: [
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,QAAQ,EACT,MAAM,oCAAo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
|
1
|
+
{"version":3,"file":"test-dialog-manager.d.ts","sourceRoot":"","sources":["../src/test-dialog-manager.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Simple test to verify the dialog manager works
|
|
2
|
+
import { DialogManager } from './dialog-manager.js';
|
|
3
|
+
async function runTests() {
|
|
4
|
+
console.log('Starting DialogManager tests...\n');
|
|
5
|
+
const manager = new DialogManager();
|
|
6
|
+
let testsPassed = 0;
|
|
7
|
+
let testsFailed = 0;
|
|
8
|
+
// Test 1: Initialization
|
|
9
|
+
try {
|
|
10
|
+
const port = await manager.initialize();
|
|
11
|
+
console.log('✓ Test 1 - Initialization: Server started on port', port);
|
|
12
|
+
testsPassed++;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error('✗ Test 1 - Initialization failed:', error);
|
|
16
|
+
testsFailed++;
|
|
17
|
+
}
|
|
18
|
+
// Test 2: HTML generation with XSS protection
|
|
19
|
+
try {
|
|
20
|
+
const html = manager.generateDialogHTML({
|
|
21
|
+
id: 'test',
|
|
22
|
+
question: '<script>alert("XSS")</script>',
|
|
23
|
+
options: [
|
|
24
|
+
{
|
|
25
|
+
label: '<b>Bold</b>',
|
|
26
|
+
value: 'test',
|
|
27
|
+
description: '"Quotes" & \'apostrophes\''
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
allowMultiple: false,
|
|
31
|
+
allowOther: true
|
|
32
|
+
});
|
|
33
|
+
if (html.includes('<script>alert') || html.includes('<b>Bold</b>')) {
|
|
34
|
+
throw new Error('XSS protection failed');
|
|
35
|
+
}
|
|
36
|
+
if (!html.includes('<script>') || !html.includes('<b>')) {
|
|
37
|
+
throw new Error('HTML should be escaped');
|
|
38
|
+
}
|
|
39
|
+
console.log('✓ Test 2 - XSS Protection: HTML properly escaped');
|
|
40
|
+
testsPassed++;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('✗ Test 2 - XSS Protection failed:', error);
|
|
44
|
+
testsFailed++;
|
|
45
|
+
}
|
|
46
|
+
// Test 3: Radio vs Checkbox rendering
|
|
47
|
+
try {
|
|
48
|
+
const radioHtml = manager.generateDialogHTML({
|
|
49
|
+
id: 'test',
|
|
50
|
+
question: 'Choose one',
|
|
51
|
+
options: [
|
|
52
|
+
{ label: 'A', value: 'a' },
|
|
53
|
+
{ label: 'B', value: 'b' }
|
|
54
|
+
],
|
|
55
|
+
allowMultiple: false,
|
|
56
|
+
allowOther: false
|
|
57
|
+
});
|
|
58
|
+
const checkboxHtml = manager.generateDialogHTML({
|
|
59
|
+
id: 'test',
|
|
60
|
+
question: 'Choose many',
|
|
61
|
+
options: [
|
|
62
|
+
{ label: 'A', value: 'a' },
|
|
63
|
+
{ label: 'B', value: 'b' }
|
|
64
|
+
],
|
|
65
|
+
allowMultiple: true,
|
|
66
|
+
allowOther: false
|
|
67
|
+
});
|
|
68
|
+
if (!radioHtml.includes('type="radio"') || radioHtml.includes('type="checkbox"')) {
|
|
69
|
+
throw new Error('Single choice should use radio buttons');
|
|
70
|
+
}
|
|
71
|
+
if (!checkboxHtml.includes('type="checkbox"') || checkboxHtml.includes('type="radio"')) {
|
|
72
|
+
throw new Error('Multiple choice should use checkboxes');
|
|
73
|
+
}
|
|
74
|
+
console.log('✓ Test 3 - Input Types: Correct radio/checkbox rendering');
|
|
75
|
+
testsPassed++;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error('✗ Test 3 - Input Types failed:', error);
|
|
79
|
+
testsFailed++;
|
|
80
|
+
}
|
|
81
|
+
// Test 4: Other field inclusion
|
|
82
|
+
try {
|
|
83
|
+
const withOther = manager.generateDialogHTML({
|
|
84
|
+
id: 'test',
|
|
85
|
+
question: 'Choose',
|
|
86
|
+
options: [{ label: 'A', value: 'a' }],
|
|
87
|
+
allowMultiple: false,
|
|
88
|
+
allowOther: true
|
|
89
|
+
});
|
|
90
|
+
const withoutOther = manager.generateDialogHTML({
|
|
91
|
+
id: 'test',
|
|
92
|
+
question: 'Choose',
|
|
93
|
+
options: [{ label: 'A', value: 'a' }],
|
|
94
|
+
allowMultiple: false,
|
|
95
|
+
allowOther: false
|
|
96
|
+
});
|
|
97
|
+
if (!withOther.includes('other-input')) {
|
|
98
|
+
throw new Error('Should include other field when allowed');
|
|
99
|
+
}
|
|
100
|
+
if (withoutOther.includes('Other (please specify)')) {
|
|
101
|
+
throw new Error('Should not include other field when not allowed');
|
|
102
|
+
}
|
|
103
|
+
console.log('✓ Test 4 - Other Field: Correctly included/excluded');
|
|
104
|
+
testsPassed++;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('✗ Test 4 - Other Field failed:', error);
|
|
108
|
+
testsFailed++;
|
|
109
|
+
}
|
|
110
|
+
// Test 5: Context inclusion
|
|
111
|
+
try {
|
|
112
|
+
const withContext = manager.generateDialogHTML({
|
|
113
|
+
id: 'test',
|
|
114
|
+
question: 'Test question',
|
|
115
|
+
options: [{ label: 'Option 1', value: 'opt1' }],
|
|
116
|
+
allowMultiple: false,
|
|
117
|
+
allowOther: false,
|
|
118
|
+
context: 'Important context information'
|
|
119
|
+
});
|
|
120
|
+
const withoutContext = manager.generateDialogHTML({
|
|
121
|
+
id: 'test',
|
|
122
|
+
question: 'Test question',
|
|
123
|
+
options: [{ label: 'Option 1', value: 'opt1' }],
|
|
124
|
+
allowMultiple: false,
|
|
125
|
+
allowOther: false
|
|
126
|
+
});
|
|
127
|
+
if (!withContext.includes('Important context information')) {
|
|
128
|
+
throw new Error('Should include context when provided');
|
|
129
|
+
}
|
|
130
|
+
if (withoutContext.includes('Context:')) {
|
|
131
|
+
throw new Error('Should not include context section when not provided');
|
|
132
|
+
}
|
|
133
|
+
console.log('✓ Test 5 - Context: Correctly included/excluded');
|
|
134
|
+
testsPassed++;
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.error('✗ Test 5 - Context failed:', error);
|
|
138
|
+
testsFailed++;
|
|
139
|
+
}
|
|
140
|
+
// Cleanup
|
|
141
|
+
await manager.close();
|
|
142
|
+
// Summary
|
|
143
|
+
console.log(`\n========== Test Summary ==========`);
|
|
144
|
+
console.log(`Passed: ${testsPassed}`);
|
|
145
|
+
console.log(`Failed: ${testsFailed}`);
|
|
146
|
+
console.log(`Total: ${testsPassed + testsFailed}`);
|
|
147
|
+
if (testsFailed > 0) {
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Run tests
|
|
152
|
+
runTests().catch(error => {
|
|
153
|
+
console.error('Test suite failed:', error);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=test-dialog-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-dialog-manager.js","sourceRoot":"","sources":["../src/test-dialog-manager.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,KAAK,UAAU,QAAQ;IACrB,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IAEjD,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IACpC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,yBAAyB;IACzB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,mDAAmD,EAAE,IAAI,CAAC,CAAC;QACvE,WAAW,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,8CAA8C;IAC9C,IAAI,CAAC;QACH,MAAM,IAAI,GAAI,OAAe,CAAC,kBAAkB,CAAC;YAC/C,EAAE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D,IAAI,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAC/D,WAAW,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,UAAU;IACV,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IAEtB,UAAU;IACV,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,WAAW,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,YAAY;AACZ,QAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACvB,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@achieveai/hitl-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Human In The Loop MCP Server - Enables LLM agents to ask questions and get user feedback through interactive dialogs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"hitl-mcp-server": "
|
|
7
|
+
"hitl-mcp-server": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/achieveai/HumanInTheLoop.git"
|
|
20
|
+
"url": "git+https://github.com/achieveai/HumanInTheLoop.git"
|
|
21
21
|
},
|
|
22
22
|
"bugs": {
|
|
23
23
|
"url": "https://github.com/achieveai/HumanInTheLoop/issues"
|
|
@@ -34,7 +34,13 @@
|
|
|
34
34
|
"test:dialog": "tsx src/test-client.ts",
|
|
35
35
|
"typecheck": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
|
-
"keywords": [
|
|
37
|
+
"keywords": [
|
|
38
|
+
"mcp",
|
|
39
|
+
"llm",
|
|
40
|
+
"human-in-the-loop",
|
|
41
|
+
"dialog",
|
|
42
|
+
"interactive"
|
|
43
|
+
],
|
|
38
44
|
"author": "MCQdb LLC <https://achieve.ai>",
|
|
39
45
|
"license": "GPL-3.0",
|
|
40
46
|
"dependencies": {
|
|
@@ -53,4 +59,4 @@
|
|
|
53
59
|
"tsx": "^4.19.2",
|
|
54
60
|
"typescript": "^5.7.3"
|
|
55
61
|
}
|
|
56
|
-
}
|
|
62
|
+
}
|