@hailer/mcp 1.0.22 → 1.0.24
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/.env.example +7 -26
- package/dist/app.js +10 -40
- package/dist/bot/chat-bot.js +1 -0
- package/dist/cli.d.ts +1 -9
- package/dist/cli.js +2 -71
- package/dist/config.d.ts +3 -96
- package/dist/config.js +6 -146
- package/dist/core.d.ts +0 -46
- package/dist/core.js +2 -351
- package/dist/lib/logger.js +2 -8
- package/dist/mcp/UserContextCache.js +10 -13
- package/dist/mcp/hailer-clients.js +11 -12
- package/dist/mcp/signal-handler.js +2 -18
- package/dist/mcp/tool-registry.d.ts +0 -4
- package/dist/mcp/tool-registry.js +1 -78
- package/dist/mcp/tools/activity.js +54 -6
- package/dist/mcp/tools/discussion.js +0 -25
- package/dist/mcp/tools/user.d.ts +4 -2
- package/dist/mcp/tools/user.js +48 -4
- package/dist/mcp/tools/workflow.js +40 -109
- package/dist/mcp/webhook-handler.d.ts +3 -64
- package/dist/mcp/webhook-handler.js +7 -214
- package/dist/mcp-server.d.ts +0 -4
- package/dist/mcp-server.js +18 -229
- package/package.json +9 -10
- package/.claude/skills/client-bot-architecture/skill.md +0 -340
- package/dist/commands/setup.d.ts +0 -11
- package/dist/commands/setup.js +0 -319
- package/scripts/test-hal-tools.ts +0 -154
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env npx ts-node
|
|
2
|
-
/**
|
|
3
|
-
* HAL Tools Test - Simple version
|
|
4
|
-
* Just calls each tool and shows the result. No magic.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as dotenv from 'dotenv';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
|
|
10
|
-
dotenv.config({ path: path.join(__dirname, '..', '.env.local') });
|
|
11
|
-
|
|
12
|
-
const MCP_URL = process.env.MCP_SERVER_URL || 'http://localhost:3030/api/mcp';
|
|
13
|
-
|
|
14
|
-
async function call(apiKey: string, tool: string, args: Record<string, unknown> = {}) {
|
|
15
|
-
console.log(`\n>>> ${tool}`);
|
|
16
|
-
console.log(` args: ${JSON.stringify(args)}`);
|
|
17
|
-
|
|
18
|
-
const res = await fetch(`${MCP_URL}?apiKey=${apiKey}`, {
|
|
19
|
-
method: 'POST',
|
|
20
|
-
headers: { 'Content-Type': 'application/json' },
|
|
21
|
-
body: JSON.stringify({
|
|
22
|
-
jsonrpc: '2.0',
|
|
23
|
-
id: '1',
|
|
24
|
-
method: 'tools/call',
|
|
25
|
-
params: { name: tool, arguments: args },
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const text = await res.text();
|
|
30
|
-
for (const line of text.split('\n')) {
|
|
31
|
-
if (line.startsWith('data: ')) {
|
|
32
|
-
const data = JSON.parse(line.substring(6));
|
|
33
|
-
if (data.error) {
|
|
34
|
-
console.log(`<<< ERROR: ${data.error.message}`);
|
|
35
|
-
return { error: true, data: null };
|
|
36
|
-
}
|
|
37
|
-
const content = data.result?.content?.[0]?.text || '';
|
|
38
|
-
// Show first 500 chars
|
|
39
|
-
console.log(`<<< ${content.substring(0, 500)}${content.length > 500 ? '...' : ''}`);
|
|
40
|
-
return { error: false, content };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
console.log('<<< NO RESPONSE');
|
|
44
|
-
return { error: true, data: null };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function main() {
|
|
48
|
-
const apiKey = process.env.MCP_CLIENT_API_KEY;
|
|
49
|
-
if (!apiKey) {
|
|
50
|
-
console.error('Set MCP_CLIENT_API_KEY in .env.local');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log('=== HAL TOOLS TEST ===\n');
|
|
55
|
-
|
|
56
|
-
// Get a workflow to work with
|
|
57
|
-
const wf = await call(apiKey, 'list_workflows_minimal', {});
|
|
58
|
-
const wfMatch = wf.content?.match(/`([a-f0-9]{24})`/);
|
|
59
|
-
const workflowId = wfMatch?.[1];
|
|
60
|
-
console.log(`\n[Using workflowId: ${workflowId}]`);
|
|
61
|
-
|
|
62
|
-
if (!workflowId) {
|
|
63
|
-
console.log('No workflow found, stopping');
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Get phase
|
|
68
|
-
const ph = await call(apiKey, 'list_workflow_phases', { workflowId });
|
|
69
|
-
const phMatch = ph.content?.match(/`([a-f0-9]{24})`/);
|
|
70
|
-
const phaseId = phMatch?.[1];
|
|
71
|
-
console.log(`\n[Using phaseId: ${phaseId}]`);
|
|
72
|
-
|
|
73
|
-
// Schema
|
|
74
|
-
await call(apiKey, 'get_workflow_schema', { workflowId, phaseId });
|
|
75
|
-
|
|
76
|
-
// List activities
|
|
77
|
-
await call(apiKey, 'list_activities', { workflowId, phaseId, fields: '[]' });
|
|
78
|
-
|
|
79
|
-
// Count
|
|
80
|
-
await call(apiKey, 'count_activities', { workflowId });
|
|
81
|
-
|
|
82
|
-
// Create activity
|
|
83
|
-
const created = await call(apiKey, 'create_activity', {
|
|
84
|
-
workflowId,
|
|
85
|
-
name: `TEST_${Date.now()}`
|
|
86
|
-
});
|
|
87
|
-
const actMatch = created.content?.match(/\*\*ID\*\*:\s*([a-f0-9]{24})/);
|
|
88
|
-
const activityId = actMatch?.[1];
|
|
89
|
-
console.log(`\n[Created activityId: ${activityId}]`);
|
|
90
|
-
|
|
91
|
-
if (activityId) {
|
|
92
|
-
// Show it
|
|
93
|
-
await call(apiKey, 'show_activity_by_id', { activityId });
|
|
94
|
-
|
|
95
|
-
// Update it
|
|
96
|
-
await call(apiKey, 'update_activity', { activityId, name: `UPDATED_${Date.now()}` });
|
|
97
|
-
|
|
98
|
-
// Delete it (this tool doesn't exist yet)
|
|
99
|
-
await call(apiKey, 'delete_activity', { activityId });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Insights
|
|
103
|
-
await call(apiKey, 'list_insights', {});
|
|
104
|
-
|
|
105
|
-
const sources = [{
|
|
106
|
-
name: 'src',
|
|
107
|
-
workflowId,
|
|
108
|
-
fields: [{ meta: 'name', name: 'Name', as: 'name' }]
|
|
109
|
-
}];
|
|
110
|
-
|
|
111
|
-
await call(apiKey, 'preview_insight', { sources, query: 'SELECT * FROM src LIMIT 3' });
|
|
112
|
-
|
|
113
|
-
const ins = await call(apiKey, 'create_insight', {
|
|
114
|
-
name: `TEST_${Date.now()}`,
|
|
115
|
-
sources,
|
|
116
|
-
query: 'SELECT * FROM src LIMIT 3'
|
|
117
|
-
});
|
|
118
|
-
const insMatch = ins.content?.match(/`([a-f0-9]{24})`/);
|
|
119
|
-
const insightId = insMatch?.[1];
|
|
120
|
-
|
|
121
|
-
if (insightId) {
|
|
122
|
-
await call(apiKey, 'get_insight_data', { insightId });
|
|
123
|
-
await call(apiKey, 'remove_insight', { insightId });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Discussions
|
|
127
|
-
await call(apiKey, 'list_my_discussions', {});
|
|
128
|
-
|
|
129
|
-
if (activityId) {
|
|
130
|
-
await call(apiKey, 'join_discussion', { activityId });
|
|
131
|
-
// Get discussion from activity
|
|
132
|
-
const act = await call(apiKey, 'show_activity_by_id', { activityId });
|
|
133
|
-
const discMatch = act.content?.match(/discussion.*?([a-f0-9]{24})/i);
|
|
134
|
-
const discussionId = discMatch?.[1];
|
|
135
|
-
|
|
136
|
-
if (discussionId) {
|
|
137
|
-
await call(apiKey, 'fetch_discussion_messages', { discussionId });
|
|
138
|
-
await call(apiKey, 'add_discussion_message', { discussionId, content: 'TEST' });
|
|
139
|
-
await call(apiKey, 'get_activity_from_discussion', { discussionId });
|
|
140
|
-
await call(apiKey, 'leave_discussion', { discussionId });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Other
|
|
145
|
-
await call(apiKey, 'list_workflows', {});
|
|
146
|
-
await call(apiKey, 'list_apps', {});
|
|
147
|
-
await call(apiKey, 'list_templates', {});
|
|
148
|
-
await call(apiKey, 'get_workspace_balance', {});
|
|
149
|
-
await call(apiKey, 'search_workspace_users', { query: 'test' });
|
|
150
|
-
|
|
151
|
-
console.log('\n=== DONE ===');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
main().catch(console.error);
|