icebox-interview-mcp 1.0.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/index.js +99 -0
- package/package.json +18 -0
package/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import EventSource from 'eventsource';
|
|
4
|
+
import { createInterface } from 'readline';
|
|
5
|
+
|
|
6
|
+
const token = process.env.ICEBOX_CANDIDATE_TOKEN;
|
|
7
|
+
const apiUrl = process.env.ICEBOX_API_URL || 'https://api.iceboxiq.com';
|
|
8
|
+
|
|
9
|
+
if (!token) {
|
|
10
|
+
console.error(JSON.stringify({
|
|
11
|
+
jsonrpc: '2.0',
|
|
12
|
+
error: { code: -32600, message: 'ICEBOX_CANDIDATE_TOKEN environment variable required' },
|
|
13
|
+
id: null
|
|
14
|
+
}));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const sseUrl = `${apiUrl}/api/mcp/candidate/sse`;
|
|
19
|
+
const messagesUrl = `${apiUrl}/api/mcp/candidate/messages`;
|
|
20
|
+
|
|
21
|
+
// Connect to SSE endpoint
|
|
22
|
+
const es = new EventSource(sseUrl, {
|
|
23
|
+
headers: {
|
|
24
|
+
'Authorization': `Bearer ${token}`
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
es.onopen = () => {
|
|
29
|
+
// Connection established
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
es.onmessage = (event) => {
|
|
33
|
+
// Forward SSE messages to stdout for Claude Desktop
|
|
34
|
+
try {
|
|
35
|
+
const data = JSON.parse(event.data);
|
|
36
|
+
console.log(JSON.stringify(data));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// Raw message
|
|
39
|
+
console.log(event.data);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
es.onerror = (err) => {
|
|
44
|
+
console.error(JSON.stringify({
|
|
45
|
+
jsonrpc: '2.0',
|
|
46
|
+
error: { code: -32603, message: 'SSE connection error' },
|
|
47
|
+
id: null
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Read from stdin (messages from Claude Desktop)
|
|
52
|
+
const rl = createInterface({
|
|
53
|
+
input: process.stdin,
|
|
54
|
+
output: process.stdout,
|
|
55
|
+
terminal: false
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
rl.on('line', async (line) => {
|
|
59
|
+
try {
|
|
60
|
+
const message = JSON.parse(line);
|
|
61
|
+
|
|
62
|
+
// Forward to messages endpoint
|
|
63
|
+
const response = await fetch(messagesUrl, {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: {
|
|
66
|
+
'Content-Type': 'application/json',
|
|
67
|
+
'Authorization': `Bearer ${token}`
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify(message)
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
const error = await response.text();
|
|
74
|
+
console.error(JSON.stringify({
|
|
75
|
+
jsonrpc: '2.0',
|
|
76
|
+
error: { code: -32603, message: error },
|
|
77
|
+
id: message.id || null
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
// Response comes via SSE
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.error(JSON.stringify({
|
|
83
|
+
jsonrpc: '2.0',
|
|
84
|
+
error: { code: -32700, message: 'Parse error' },
|
|
85
|
+
id: null
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Handle process termination
|
|
91
|
+
process.on('SIGINT', () => {
|
|
92
|
+
es.close();
|
|
93
|
+
process.exit(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
process.on('SIGTERM', () => {
|
|
97
|
+
es.close();
|
|
98
|
+
process.exit(0);
|
|
99
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "icebox-interview-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP client for Icebox ATS interviews",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"icebox-interview": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"eventsource": "^2.0.2"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js"
|
|
15
|
+
],
|
|
16
|
+
"keywords": ["mcp", "icebox", "interview"],
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|