@hailer/mcp 0.0.1
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/.claude/commands/tool-builder.md +37 -0
- package/.claude/commands/ws-pull.md +44 -0
- package/.claude/settings.json +8 -0
- package/.claude/settings.local.json +49 -0
- package/.claude/skills/activity-api/SKILL.md +96 -0
- package/.claude/skills/activity-api/references/activity-endpoints.md +845 -0
- package/.claude/skills/add-app-member-skill/SKILL.md +977 -0
- package/.claude/skills/agent-building/SKILL.md +243 -0
- package/.claude/skills/agent-building/references/architecture-patterns.md +446 -0
- package/.claude/skills/agent-building/references/code-examples.md +587 -0
- package/.claude/skills/agent-building/references/implementation-guide.md +619 -0
- package/.claude/skills/app-api/SKILL.md +219 -0
- package/.claude/skills/app-api/references/app-endpoints.md +759 -0
- package/.claude/skills/building-hailer-apps-skill/SKILL.md +548 -0
- package/.claude/skills/create-app-skill/SKILL.md +1101 -0
- package/.claude/skills/create-insight-skill/SKILL.md +1317 -0
- package/.claude/skills/get-insight-data-skill/SKILL.md +1053 -0
- package/.claude/skills/hailer-api/SKILL.md +283 -0
- package/.claude/skills/hailer-api/references/activities.md +620 -0
- package/.claude/skills/hailer-api/references/authentication.md +216 -0
- package/.claude/skills/hailer-api/references/datasets.md +437 -0
- package/.claude/skills/hailer-api/references/files.md +301 -0
- package/.claude/skills/hailer-api/references/insights.md +469 -0
- package/.claude/skills/hailer-api/references/workflows.md +720 -0
- package/.claude/skills/hailer-api/references/workspaces-users.md +445 -0
- package/.claude/skills/insight-api/SKILL.md +185 -0
- package/.claude/skills/insight-api/references/insight-endpoints.md +514 -0
- package/.claude/skills/install-workflow-skill/SKILL.md +1056 -0
- package/.claude/skills/list-apps-skill/SKILL.md +1010 -0
- package/.claude/skills/list-workflows-minimal-skill/SKILL.md +992 -0
- package/.claude/skills/local-first-skill/SKILL.md +570 -0
- package/.claude/skills/mcp-tools/SKILL.md +419 -0
- package/.claude/skills/mcp-tools/references/api-endpoints.md +499 -0
- package/.claude/skills/mcp-tools/references/data-structures.md +554 -0
- package/.claude/skills/mcp-tools/references/implementation-patterns.md +717 -0
- package/.claude/skills/preview-insight-skill/SKILL.md +1290 -0
- package/.claude/skills/publish-hailer-app-skill/SKILL.md +453 -0
- package/.claude/skills/remove-app-member-skill/SKILL.md +671 -0
- package/.claude/skills/remove-app-skill/SKILL.md +985 -0
- package/.claude/skills/remove-insight-skill/SKILL.md +1011 -0
- package/.claude/skills/remove-workflow-skill/SKILL.md +920 -0
- package/.claude/skills/scaffold-hailer-app-skill/SKILL.md +1034 -0
- package/.claude/skills/skill-testing/README.md +137 -0
- package/.claude/skills/skill-testing/SKILL.md +348 -0
- package/.claude/skills/skill-testing/references/test-patterns.md +705 -0
- package/.claude/skills/skill-testing/references/testing-guide.md +603 -0
- package/.claude/skills/skill-testing/references/validation-checklist.md +537 -0
- package/.claude/skills/tool-builder/SKILL.md +328 -0
- package/.claude/skills/update-app-skill/SKILL.md +970 -0
- package/.claude/skills/update-workflow-field-skill/SKILL.md +1098 -0
- package/.env.example +81 -0
- package/.mcp.json +13 -0
- package/README.md +297 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +74 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +5 -0
- package/dist/client/adaptive-documentation-bot.d.ts +108 -0
- package/dist/client/adaptive-documentation-bot.js +475 -0
- package/dist/client/adaptive-documentation-types.d.ts +66 -0
- package/dist/client/adaptive-documentation-types.js +9 -0
- package/dist/client/agent-activity-bot.d.ts +51 -0
- package/dist/client/agent-activity-bot.js +166 -0
- package/dist/client/agent-tracker.d.ts +499 -0
- package/dist/client/agent-tracker.js +659 -0
- package/dist/client/description-updater.d.ts +56 -0
- package/dist/client/description-updater.js +259 -0
- package/dist/client/log-parser.d.ts +72 -0
- package/dist/client/log-parser.js +387 -0
- package/dist/client/mcp-client.d.ts +50 -0
- package/dist/client/mcp-client.js +532 -0
- package/dist/client/message-processor.d.ts +35 -0
- package/dist/client/message-processor.js +352 -0
- package/dist/client/multi-bot-manager.d.ts +24 -0
- package/dist/client/multi-bot-manager.js +74 -0
- package/dist/client/providers/anthropic-provider.d.ts +19 -0
- package/dist/client/providers/anthropic-provider.js +631 -0
- package/dist/client/providers/llm-provider.d.ts +47 -0
- package/dist/client/providers/llm-provider.js +367 -0
- package/dist/client/providers/openai-provider.d.ts +23 -0
- package/dist/client/providers/openai-provider.js +621 -0
- package/dist/client/simple-llm-caller.d.ts +19 -0
- package/dist/client/simple-llm-caller.js +100 -0
- package/dist/client/skill-generator.d.ts +81 -0
- package/dist/client/skill-generator.js +386 -0
- package/dist/client/test-adaptive-bot.d.ts +9 -0
- package/dist/client/test-adaptive-bot.js +82 -0
- package/dist/client/token-pricing.d.ts +38 -0
- package/dist/client/token-pricing.js +127 -0
- package/dist/client/token-tracker.d.ts +232 -0
- package/dist/client/token-tracker.js +457 -0
- package/dist/client/token-usage-bot.d.ts +53 -0
- package/dist/client/token-usage-bot.js +153 -0
- package/dist/client/tool-executor.d.ts +69 -0
- package/dist/client/tool-executor.js +159 -0
- package/dist/client/tool-schema-loader.d.ts +60 -0
- package/dist/client/tool-schema-loader.js +178 -0
- package/dist/client/types.d.ts +69 -0
- package/dist/client/types.js +7 -0
- package/dist/config.d.ts +162 -0
- package/dist/config.js +296 -0
- package/dist/core.d.ts +26 -0
- package/dist/core.js +147 -0
- package/dist/lib/context-manager.d.ts +111 -0
- package/dist/lib/context-manager.js +431 -0
- package/dist/lib/logger.d.ts +74 -0
- package/dist/lib/logger.js +277 -0
- package/dist/lib/materialize.d.ts +3 -0
- package/dist/lib/materialize.js +101 -0
- package/dist/lib/normalizedName.d.ts +7 -0
- package/dist/lib/normalizedName.js +48 -0
- package/dist/lib/prompt-length-manager.d.ts +81 -0
- package/dist/lib/prompt-length-manager.js +457 -0
- package/dist/lib/terminal-prompt.d.ts +9 -0
- package/dist/lib/terminal-prompt.js +108 -0
- package/dist/mcp/UserContextCache.d.ts +56 -0
- package/dist/mcp/UserContextCache.js +163 -0
- package/dist/mcp/auth.d.ts +2 -0
- package/dist/mcp/auth.js +29 -0
- package/dist/mcp/hailer-clients.d.ts +42 -0
- package/dist/mcp/hailer-clients.js +246 -0
- package/dist/mcp/signal-handler.d.ts +45 -0
- package/dist/mcp/signal-handler.js +317 -0
- package/dist/mcp/tool-registry.d.ts +100 -0
- package/dist/mcp/tool-registry.js +306 -0
- package/dist/mcp/tools/activity.d.ts +15 -0
- package/dist/mcp/tools/activity.js +955 -0
- package/dist/mcp/tools/app.d.ts +20 -0
- package/dist/mcp/tools/app.js +1488 -0
- package/dist/mcp/tools/discussion.d.ts +19 -0
- package/dist/mcp/tools/discussion.js +950 -0
- package/dist/mcp/tools/file.d.ts +15 -0
- package/dist/mcp/tools/file.js +119 -0
- package/dist/mcp/tools/insight.d.ts +17 -0
- package/dist/mcp/tools/insight.js +806 -0
- package/dist/mcp/tools/skill.d.ts +10 -0
- package/dist/mcp/tools/skill.js +279 -0
- package/dist/mcp/tools/user.d.ts +10 -0
- package/dist/mcp/tools/user.js +108 -0
- package/dist/mcp/tools/workflow-template.d.ts +19 -0
- package/dist/mcp/tools/workflow-template.js +822 -0
- package/dist/mcp/tools/workflow.d.ts +18 -0
- package/dist/mcp/tools/workflow.js +1362 -0
- package/dist/mcp/utils/api-errors.d.ts +45 -0
- package/dist/mcp/utils/api-errors.js +160 -0
- package/dist/mcp/utils/data-transformers.d.ts +102 -0
- package/dist/mcp/utils/data-transformers.js +194 -0
- package/dist/mcp/utils/file-upload.d.ts +33 -0
- package/dist/mcp/utils/file-upload.js +148 -0
- package/dist/mcp/utils/hailer-api-client.d.ts +120 -0
- package/dist/mcp/utils/hailer-api-client.js +323 -0
- package/dist/mcp/utils/index.d.ts +13 -0
- package/dist/mcp/utils/index.js +39 -0
- package/dist/mcp/utils/logger.d.ts +42 -0
- package/dist/mcp/utils/logger.js +103 -0
- package/dist/mcp/utils/types.d.ts +286 -0
- package/dist/mcp/utils/types.js +7 -0
- package/dist/mcp/workspace-cache.d.ts +42 -0
- package/dist/mcp/workspace-cache.js +97 -0
- package/dist/mcp-server.d.ts +42 -0
- package/dist/mcp-server.js +280 -0
- package/package.json +56 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Hailer API
|
|
3
|
+
description: Comprehensive technical reference for the Hailer API covering all endpoints (activities, datasets, insights/SQL, workflows, files, users), Python SDK, and best practices for building Hailer integrations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hailer API Skill
|
|
7
|
+
|
|
8
|
+
Comprehensive technical reference for the Hailer API covering all endpoints, methods, and SDK usage.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
This skill provides comprehensive API reference documentation for the Hailer API. The MCP server uses socket.io via `@hailer/cli` for most operations.
|
|
13
|
+
|
|
14
|
+
**Local Development Configuration:**
|
|
15
|
+
- Base URL: `https://api.hailer.local.gd`
|
|
16
|
+
- API Version: v2/v3 (mixed usage)
|
|
17
|
+
- Protocol: socket.io via `@hailer/cli`
|
|
18
|
+
|
|
19
|
+
## API Overview
|
|
20
|
+
|
|
21
|
+
**Base URL**: `https://api.hailer.local.gd`
|
|
22
|
+
**Current Version**: `/v3` (with some `/v2` endpoints)
|
|
23
|
+
**Authentication**: `hlrkey` header with auth token
|
|
24
|
+
**Response Format**: JSON
|
|
25
|
+
**Protocol**: Socket.io via `@hailer/cli` package
|
|
26
|
+
|
|
27
|
+
## Core Modules
|
|
28
|
+
|
|
29
|
+
### 1. Activities (`/v3/activity`)
|
|
30
|
+
Task and project management system. Activities are the core unit of work in Hailer.
|
|
31
|
+
|
|
32
|
+
**Key Operations:**
|
|
33
|
+
- Create, read, update, delete activities
|
|
34
|
+
- Batch operations for bulk management
|
|
35
|
+
- Comments and discussions
|
|
36
|
+
- File attachments
|
|
37
|
+
- Status tracking and workflows
|
|
38
|
+
- Assignments and permissions
|
|
39
|
+
|
|
40
|
+
**Reference**: [activities.md](references/activities.md)
|
|
41
|
+
|
|
42
|
+
### 2. Insights/SQL (`/v3/insights`)
|
|
43
|
+
SQL-based querying system for data analysis across workspaces.
|
|
44
|
+
|
|
45
|
+
**Key Features:**
|
|
46
|
+
- SQLite-compatible queries
|
|
47
|
+
- Access to activities, datasets, and workspace data
|
|
48
|
+
- Aggregations and analytics
|
|
49
|
+
- Saved queries for reuse
|
|
50
|
+
- Real-time data analysis
|
|
51
|
+
|
|
52
|
+
**Reference**: [insights.md](references/insights.md)
|
|
53
|
+
|
|
54
|
+
### 3. Datasets (`/v3/datasets`)
|
|
55
|
+
Structured data storage with type validation and relationships.
|
|
56
|
+
|
|
57
|
+
**Key Features:**
|
|
58
|
+
- Define custom data schemas
|
|
59
|
+
- CRUD operations on records
|
|
60
|
+
- Batch import/export
|
|
61
|
+
- Reference fields for relationships
|
|
62
|
+
- Field validation and constraints
|
|
63
|
+
|
|
64
|
+
**Reference**: [datasets.md](references/datasets.md)
|
|
65
|
+
|
|
66
|
+
### 4. Files (`/v3/files`)
|
|
67
|
+
File upload, download, and management for activities and workspaces.
|
|
68
|
+
|
|
69
|
+
**Key Features:**
|
|
70
|
+
- Upload files up to 100MB
|
|
71
|
+
- Automatic thumbnail generation
|
|
72
|
+
- File sharing with expiration
|
|
73
|
+
- Batch uploads
|
|
74
|
+
- Direct S3 upload for large files
|
|
75
|
+
|
|
76
|
+
**Reference**: [files.md](references/files.md)
|
|
77
|
+
|
|
78
|
+
### 5. Workflows (`/v3/workflows`)
|
|
79
|
+
Automated business process management and activity routing.
|
|
80
|
+
|
|
81
|
+
**Key Features:**
|
|
82
|
+
- Define multi-step workflows
|
|
83
|
+
- Conditional logic and branching
|
|
84
|
+
- Automatic activity transitions
|
|
85
|
+
- Trigger workflows via API or events
|
|
86
|
+
- Workflow templates
|
|
87
|
+
|
|
88
|
+
**Reference**: [workflows.md](references/workflows.md)
|
|
89
|
+
|
|
90
|
+
### 6. Workspaces (`/v2/core/init`)
|
|
91
|
+
Top-level organizational units containing all resources.
|
|
92
|
+
|
|
93
|
+
**Key Features:**
|
|
94
|
+
- Workspace management
|
|
95
|
+
- Member administration
|
|
96
|
+
- Settings and configuration
|
|
97
|
+
- Teams and groups
|
|
98
|
+
- Audit logging
|
|
99
|
+
|
|
100
|
+
**Reference**: [workspaces-users.md](references/workspaces-users.md)
|
|
101
|
+
|
|
102
|
+
### 7. Authentication
|
|
103
|
+
Multiple authentication methods for secure API access.
|
|
104
|
+
|
|
105
|
+
**Methods:**
|
|
106
|
+
- OAuth 2.0 (recommended for apps)
|
|
107
|
+
- Access tokens
|
|
108
|
+
- Session-based authentication
|
|
109
|
+
- API keys with scoped permissions
|
|
110
|
+
|
|
111
|
+
**Reference**: [authentication.md](references/authentication.md)
|
|
112
|
+
|
|
113
|
+
## Integration with MCP Server
|
|
114
|
+
|
|
115
|
+
The MCP server integrates with Hailer using:
|
|
116
|
+
- `@hailer/cli` package for socket.io connections
|
|
117
|
+
- Shared connection pool across MCP Server and MCP Client
|
|
118
|
+
- User context caching per API key
|
|
119
|
+
- Real-time signal processing for live updates
|
|
120
|
+
|
|
121
|
+
See CLAUDE.md in the project root for detailed architecture information.
|
|
122
|
+
|
|
123
|
+
## Common API Patterns
|
|
124
|
+
|
|
125
|
+
### Activity Listing with v3 API
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
// POST /v3/activity/list
|
|
129
|
+
body: JSON.stringify([workflowFilter, requestOptions])
|
|
130
|
+
|
|
131
|
+
// Example:
|
|
132
|
+
[
|
|
133
|
+
{ processId: "workflow-id", phaseId: "phase-id" }, // workflow filter
|
|
134
|
+
{
|
|
135
|
+
limit: 10,
|
|
136
|
+
page: 1, // v3 uses 1-based pagination
|
|
137
|
+
sortBy: "updated",
|
|
138
|
+
sortOrder: "desc",
|
|
139
|
+
returnFlat: true,
|
|
140
|
+
filters: {
|
|
141
|
+
and: [
|
|
142
|
+
{ "field-id-company": { equalTo: "company-id" } },
|
|
143
|
+
{ "field-id-created": { between: ["1234567890", "1234999999"] } }
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Activity Creation with v3 API
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// POST /v3/activity/createMany
|
|
154
|
+
body: JSON.stringify([workflowId, [activityData], options])
|
|
155
|
+
|
|
156
|
+
// Example:
|
|
157
|
+
[
|
|
158
|
+
"68446dc05b30685f67c6fcd4", // workflowId
|
|
159
|
+
[{ name: "Task Title", fields: {} }], // activities array
|
|
160
|
+
{ returnDocument: true, phaseId: "phase-id" } // options
|
|
161
|
+
]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Discussion Messages
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
// POST /api/messenger/send
|
|
168
|
+
body: JSON.stringify([messageData, discussionId])
|
|
169
|
+
|
|
170
|
+
// Example:
|
|
171
|
+
[
|
|
172
|
+
{ msg: "Hello world!" }, // message object
|
|
173
|
+
"684be83f68e9345040ad02a3" // discussionId
|
|
174
|
+
]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## API Best Practices
|
|
178
|
+
|
|
179
|
+
### 1. Use Batch Operations
|
|
180
|
+
- Batch create/update/delete is more efficient than individual operations
|
|
181
|
+
- Maximum batch size is typically 100-1000 items depending on endpoint
|
|
182
|
+
|
|
183
|
+
### 2. Handle Rate Limits
|
|
184
|
+
- Default: 1000 requests/hour per user
|
|
185
|
+
- Check `X-RateLimit-*` headers
|
|
186
|
+
- Implement exponential backoff on 429 responses
|
|
187
|
+
|
|
188
|
+
### 3. Optimize Queries
|
|
189
|
+
- Use SQL `LIMIT` for large result sets
|
|
190
|
+
- Add `WHERE` clauses to filter data at the database level
|
|
191
|
+
- Create dataset indexes for frequently queried fields
|
|
192
|
+
|
|
193
|
+
### 4. Secure API Keys
|
|
194
|
+
- Use scoped API keys with minimal permissions
|
|
195
|
+
- Set expiration dates
|
|
196
|
+
- Rotate keys regularly
|
|
197
|
+
- Never commit keys to source control
|
|
198
|
+
|
|
199
|
+
### 5. Webhook Best Practices
|
|
200
|
+
- Return 200 status quickly (< 5 seconds)
|
|
201
|
+
- Process events asynchronously
|
|
202
|
+
- Implement idempotency (handle duplicate events)
|
|
203
|
+
- Verify webhook signatures
|
|
204
|
+
|
|
205
|
+
### 6. File Uploads
|
|
206
|
+
- Use direct S3 upload for files > 10MB
|
|
207
|
+
- Stream large files instead of loading into memory
|
|
208
|
+
- Generate and use thumbnails for images
|
|
209
|
+
- Clean up temporary files
|
|
210
|
+
|
|
211
|
+
### 7. Error Recovery
|
|
212
|
+
- Implement retry logic for 5xx errors
|
|
213
|
+
- Log errors with request IDs for debugging
|
|
214
|
+
- Validate data before API calls
|
|
215
|
+
- Check permissions before operations
|
|
216
|
+
|
|
217
|
+
## Rate Limits
|
|
218
|
+
|
|
219
|
+
| Tier | Requests/Hour | Burst |
|
|
220
|
+
|------|---------------|-------|
|
|
221
|
+
| Free | 1,000 | 20/minute |
|
|
222
|
+
| Pro | 10,000 | 100/minute |
|
|
223
|
+
| Enterprise | Custom | Custom |
|
|
224
|
+
|
|
225
|
+
## Webhooks
|
|
226
|
+
|
|
227
|
+
### Available Events
|
|
228
|
+
|
|
229
|
+
**Activities:**
|
|
230
|
+
- `activity.created`
|
|
231
|
+
- `activity.updated`
|
|
232
|
+
- `activity.deleted`
|
|
233
|
+
- `activity.assigned`
|
|
234
|
+
- `activity.completed`
|
|
235
|
+
|
|
236
|
+
**Datasets:**
|
|
237
|
+
- `dataset.record.created`
|
|
238
|
+
- `dataset.record.updated`
|
|
239
|
+
- `dataset.record.deleted`
|
|
240
|
+
|
|
241
|
+
**Files:**
|
|
242
|
+
- `file.uploaded`
|
|
243
|
+
- `file.deleted`
|
|
244
|
+
|
|
245
|
+
**Workflows:**
|
|
246
|
+
- `workflow.started`
|
|
247
|
+
- `workflow.completed`
|
|
248
|
+
- `workflow.failed`
|
|
249
|
+
|
|
250
|
+
### Webhook Payload
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"event": "activity.created",
|
|
255
|
+
"data": {
|
|
256
|
+
"id": "act_123",
|
|
257
|
+
"title": "New Task",
|
|
258
|
+
"workspace_id": "ws_456"
|
|
259
|
+
},
|
|
260
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
261
|
+
"workspace_id": "ws_456"
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Resources
|
|
266
|
+
|
|
267
|
+
- **Local API Base**: https://api.hailer.local.gd
|
|
268
|
+
- **MCP Server**: http://localhost:3030/api/mcp
|
|
269
|
+
- **Project Documentation**: See CLAUDE.md in project root
|
|
270
|
+
|
|
271
|
+
## References
|
|
272
|
+
|
|
273
|
+
Browse the detailed API references:
|
|
274
|
+
|
|
275
|
+
- [Activities API](references/activities.md) - Task and project management
|
|
276
|
+
- [Insights API](references/insights.md) - SQL queries and analytics
|
|
277
|
+
- [Datasets API](references/datasets.md) - Structured data storage
|
|
278
|
+
- [Files API](references/files.md) - File management
|
|
279
|
+
- [Workflows API](references/workflows.md) - Process automation
|
|
280
|
+
- [Workspaces & Users](references/workspaces-users.md) - Organization management
|
|
281
|
+
- [Authentication](references/authentication.md) - Security and access
|
|
282
|
+
|
|
283
|
+
**Note**: Reference documentation may contain v7 endpoint examples. Refer to CLAUDE.md for actual v2/v3 endpoint patterns used in the MCP server.
|