@ema.co/mcp-toolkit 0.2.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/LICENSE +21 -0
- package/README.md +321 -0
- package/config.example.yaml +32 -0
- package/dist/cli/index.js +333 -0
- package/dist/config.js +136 -0
- package/dist/emaClient.js +398 -0
- package/dist/index.js +109 -0
- package/dist/mcp/handlers-consolidated.js +851 -0
- package/dist/mcp/index.js +15 -0
- package/dist/mcp/prompts.js +1753 -0
- package/dist/mcp/resources.js +624 -0
- package/dist/mcp/server.js +4723 -0
- package/dist/mcp/tools-consolidated.js +590 -0
- package/dist/mcp/tools-legacy.js +736 -0
- package/dist/models.js +8 -0
- package/dist/scheduler.js +21 -0
- package/dist/sdk/client.js +788 -0
- package/dist/sdk/config.js +136 -0
- package/dist/sdk/contracts.js +429 -0
- package/dist/sdk/generation-schema.js +189 -0
- package/dist/sdk/index.js +39 -0
- package/dist/sdk/knowledge.js +2780 -0
- package/dist/sdk/models.js +8 -0
- package/dist/sdk/state.js +88 -0
- package/dist/sdk/sync-options.js +216 -0
- package/dist/sdk/sync.js +220 -0
- package/dist/sdk/validation-rules.js +355 -0
- package/dist/sdk/workflow-generator.js +291 -0
- package/dist/sdk/workflow-intent.js +1585 -0
- package/dist/state.js +88 -0
- package/dist/sync.js +416 -0
- package/dist/syncOptions.js +216 -0
- package/dist/ui.js +334 -0
- package/docs/advisor-comms-assistant-fixes.md +175 -0
- package/docs/api-contracts.md +216 -0
- package/docs/auto-builder-analysis.md +271 -0
- package/docs/data-architecture.md +166 -0
- package/docs/ema-auto-builder-guide.html +394 -0
- package/docs/ema-user-guide.md +1121 -0
- package/docs/mcp-tools-guide.md +149 -0
- package/docs/naming-conventions.md +218 -0
- package/docs/tool-consolidation-proposal.md +427 -0
- package/package.json +98 -0
- package/resources/templates/chat-ai/README.md +119 -0
- package/resources/templates/chat-ai/persona-config.json +111 -0
- package/resources/templates/dashboard-ai/README.md +156 -0
- package/resources/templates/dashboard-ai/persona-config.json +180 -0
- package/resources/templates/voice-ai/README.md +123 -0
- package/resources/templates/voice-ai/persona-config.json +74 -0
- package/resources/templates/voice-ai/workflow-prompt.md +120 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
# MCP Tool Consolidation Proposal
|
|
2
|
+
|
|
3
|
+
> Consolidate 45 tools into 9 core commands following Unix CLI patterns.
|
|
4
|
+
|
|
5
|
+
## Status: Implementation Complete
|
|
6
|
+
|
|
7
|
+
Files created:
|
|
8
|
+
- `src/mcp/tools-consolidated.ts` - New tool definitions
|
|
9
|
+
- `src/mcp/handlers-consolidated.ts` - New handlers with mode-based dispatch
|
|
10
|
+
|
|
11
|
+
## Design Principles
|
|
12
|
+
|
|
13
|
+
1. **Consistent terminology**: Use "persona" everywhere (not "ai_employee")
|
|
14
|
+
2. **Get/List as flags**: `persona("id")` vs `persona(all=True)`
|
|
15
|
+
3. **Related functions as modes**: `workflow(mode="analyze")` includes detect, validate, suggest
|
|
16
|
+
4. **Flags over separate tools**: `template(type="voice")` not `get_voice_template()`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Proposed Tool Structure
|
|
21
|
+
|
|
22
|
+
### 1. `persona` - AI Employee Management
|
|
23
|
+
|
|
24
|
+
**Replaces:** `find_personas`, `get_persona`, `create_ai_employee`, `update_ai_employee`, `compare_ai_employees`
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
interface PersonaArgs {
|
|
28
|
+
// Identifier (optional - if omitted with all=true, lists all)
|
|
29
|
+
id?: string; // ID or exact name
|
|
30
|
+
|
|
31
|
+
// Mode
|
|
32
|
+
mode?: "get" | "create" | "update" | "delete" | "compare" | "sync";
|
|
33
|
+
|
|
34
|
+
// List/Search flags
|
|
35
|
+
all?: boolean;
|
|
36
|
+
query?: string;
|
|
37
|
+
status?: "active" | "inactive" | "draft";
|
|
38
|
+
trigger_type?: "voice" | "chat" | "dashboard";
|
|
39
|
+
limit?: number;
|
|
40
|
+
|
|
41
|
+
// Get flags
|
|
42
|
+
include_workflow?: boolean;
|
|
43
|
+
include_fingerprint?: boolean;
|
|
44
|
+
|
|
45
|
+
// Create/Update flags
|
|
46
|
+
name?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
template_id?: string;
|
|
49
|
+
source_persona_id?: string;
|
|
50
|
+
|
|
51
|
+
// Compare/Sync flags
|
|
52
|
+
compare_to?: string;
|
|
53
|
+
target_env?: string;
|
|
54
|
+
dry_run?: boolean;
|
|
55
|
+
|
|
56
|
+
// Environment
|
|
57
|
+
env?: string;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Usage Examples:**
|
|
62
|
+
```bash
|
|
63
|
+
# Get single
|
|
64
|
+
persona("IT Support Bot")
|
|
65
|
+
persona("abc-123", include_workflow=True)
|
|
66
|
+
|
|
67
|
+
# List/Search
|
|
68
|
+
persona(all=True)
|
|
69
|
+
persona(query="Support", status="active")
|
|
70
|
+
|
|
71
|
+
# Create
|
|
72
|
+
persona(mode="create", name="New Bot", template_id="voice")
|
|
73
|
+
|
|
74
|
+
# Update
|
|
75
|
+
persona("abc-123", mode="update", name="Renamed")
|
|
76
|
+
|
|
77
|
+
# Compare
|
|
78
|
+
persona("abc-123", mode="compare", compare_to="def-456")
|
|
79
|
+
|
|
80
|
+
# Sync
|
|
81
|
+
persona("abc-123", mode="sync", target_env="dev", dry_run=True)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### 2. `workflow` - Workflow Generation & Analysis
|
|
87
|
+
|
|
88
|
+
**Replaces:** `workflow`, `deploy_workflow`, `analyze_workflow`, `detect_workflow_issues`, `validate_workflow_connections`, `suggest_workflow_fixes`, `get_workflow_metrics`, `compare_workflow_versions`, `compile_workflow`
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface WorkflowArgs {
|
|
92
|
+
// Input (one of these)
|
|
93
|
+
input?: string | object; // Natural language or spec
|
|
94
|
+
persona_id?: string; // For existing workflow operations
|
|
95
|
+
workflow_def?: object; // For direct analysis
|
|
96
|
+
|
|
97
|
+
// Mode
|
|
98
|
+
mode?: "generate" | "analyze" | "deploy" | "compare" | "compile";
|
|
99
|
+
|
|
100
|
+
// Generate flags
|
|
101
|
+
persona_type?: "voice" | "chat" | "dashboard";
|
|
102
|
+
use_autobuilder?: boolean;
|
|
103
|
+
|
|
104
|
+
// Analyze flags (what to include in analysis)
|
|
105
|
+
include?: ("issues" | "connections" | "fixes" | "metrics")[];
|
|
106
|
+
// Default: all of them
|
|
107
|
+
|
|
108
|
+
// Deploy flags
|
|
109
|
+
auto_fix?: boolean;
|
|
110
|
+
validate_first?: boolean;
|
|
111
|
+
|
|
112
|
+
// Compare flags
|
|
113
|
+
compare_to?: string; // Another persona_id
|
|
114
|
+
|
|
115
|
+
// Environment
|
|
116
|
+
env?: string;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Usage Examples:**
|
|
121
|
+
```bash
|
|
122
|
+
# Generate
|
|
123
|
+
workflow("IT helpdesk with KB search and tickets")
|
|
124
|
+
workflow(input={intents: [...]}, persona_type="voice")
|
|
125
|
+
|
|
126
|
+
# Analyze (unified - returns issues, connections, fixes, metrics)
|
|
127
|
+
workflow(persona_id="abc-123", mode="analyze")
|
|
128
|
+
|
|
129
|
+
# Analyze with specific includes
|
|
130
|
+
workflow(persona_id="abc-123", mode="analyze", include=["issues", "metrics"])
|
|
131
|
+
|
|
132
|
+
# Analyze from JSON (not deployed)
|
|
133
|
+
workflow(workflow_def={...}, mode="analyze")
|
|
134
|
+
|
|
135
|
+
# Deploy
|
|
136
|
+
workflow(persona_id="abc-123", mode="deploy", workflow_def={...}, auto_fix=True)
|
|
137
|
+
|
|
138
|
+
# Compare versions
|
|
139
|
+
workflow(persona_id="abc-123", mode="compare", compare_to="def-456")
|
|
140
|
+
|
|
141
|
+
# Compile spec to workflow_def
|
|
142
|
+
workflow(input={nodes: [...]}, mode="compile")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### 3. `action` - Workflow Actions/Agents
|
|
148
|
+
|
|
149
|
+
**Replaces:** `find_workflow_actions`, `get_workflow_action`, `list_auto_builder_agents`, `get_auto_builder_agent`, `suggest_agents_for_use_case`
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
interface ActionArgs {
|
|
153
|
+
// Identifier (optional)
|
|
154
|
+
id?: string; // Action ID or name
|
|
155
|
+
|
|
156
|
+
// List/Search flags
|
|
157
|
+
all?: boolean;
|
|
158
|
+
category?: string;
|
|
159
|
+
query?: string;
|
|
160
|
+
persona_id?: string; // Actions in this workflow
|
|
161
|
+
enabled?: boolean;
|
|
162
|
+
|
|
163
|
+
// Suggestion mode
|
|
164
|
+
suggest_for?: string; // Use case description
|
|
165
|
+
|
|
166
|
+
// Include flags
|
|
167
|
+
include_docs?: boolean; // Include full documentation
|
|
168
|
+
|
|
169
|
+
// Environment
|
|
170
|
+
env?: string;
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Usage Examples:**
|
|
175
|
+
```bash
|
|
176
|
+
# Get single
|
|
177
|
+
action("chat_categorizer")
|
|
178
|
+
action("abc-123-uuid")
|
|
179
|
+
action("chat_categorizer", include_docs=True)
|
|
180
|
+
|
|
181
|
+
# List/Search
|
|
182
|
+
action(all=True)
|
|
183
|
+
action(category="routing")
|
|
184
|
+
action(persona_id="abc-123") # Actions in workflow
|
|
185
|
+
action(query="search")
|
|
186
|
+
|
|
187
|
+
# Suggest for use case
|
|
188
|
+
action(suggest_for="IT helpdesk with ServiceNow")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### 4. `template` - Templates & Patterns
|
|
194
|
+
|
|
195
|
+
**Replaces:** `get_workflow_pattern`, `list_workflow_patterns`, `get_widget_reference`, `get_voice_persona_template`, `list_ai_employee_templates`
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
interface TemplateArgs {
|
|
199
|
+
// What to get
|
|
200
|
+
type?: "voice" | "chat" | "dashboard"; // Persona config template
|
|
201
|
+
pattern?: string; // Workflow pattern name
|
|
202
|
+
widgets?: "voice" | "chat" | "dashboard"; // Widget reference
|
|
203
|
+
|
|
204
|
+
// List flags
|
|
205
|
+
all?: boolean;
|
|
206
|
+
patterns?: boolean; // List workflow patterns
|
|
207
|
+
|
|
208
|
+
// Environment
|
|
209
|
+
env?: string;
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Usage Examples:**
|
|
214
|
+
```bash
|
|
215
|
+
# Persona config templates
|
|
216
|
+
template(type="voice")
|
|
217
|
+
template(type="chat")
|
|
218
|
+
|
|
219
|
+
# Workflow patterns
|
|
220
|
+
template(pattern="intent-routing")
|
|
221
|
+
template(patterns=True) # List all patterns
|
|
222
|
+
template(patterns=True, type="voice") # Filter by persona type
|
|
223
|
+
|
|
224
|
+
# Widget reference
|
|
225
|
+
template(widgets="voice")
|
|
226
|
+
|
|
227
|
+
# List all persona templates
|
|
228
|
+
template(all=True)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### 5. `knowledge` - Data Sources & KB
|
|
234
|
+
|
|
235
|
+
**Replaces:** `upload_data_source`, `delete_data_source`, `list_data_sources`, `get_embedding_status`, `toggle_embedding`
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
interface KnowledgeArgs {
|
|
239
|
+
persona_id: string;
|
|
240
|
+
|
|
241
|
+
// Mode
|
|
242
|
+
mode?: "list" | "upload" | "delete" | "status" | "toggle";
|
|
243
|
+
|
|
244
|
+
// Upload flags
|
|
245
|
+
file_path?: string;
|
|
246
|
+
tags?: string;
|
|
247
|
+
|
|
248
|
+
// Delete flags
|
|
249
|
+
file_id?: string;
|
|
250
|
+
|
|
251
|
+
// Toggle flags
|
|
252
|
+
embedding_enabled?: boolean;
|
|
253
|
+
|
|
254
|
+
// Environment
|
|
255
|
+
env?: string;
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Usage Examples:**
|
|
260
|
+
```bash
|
|
261
|
+
# List files
|
|
262
|
+
knowledge(persona_id="abc-123", mode="list")
|
|
263
|
+
|
|
264
|
+
# Upload
|
|
265
|
+
knowledge(persona_id="abc-123", mode="upload", file_path="/path/to/file.pdf")
|
|
266
|
+
|
|
267
|
+
# Delete
|
|
268
|
+
knowledge(persona_id="abc-123", mode="delete", file_id="file-123")
|
|
269
|
+
|
|
270
|
+
# Embedding status
|
|
271
|
+
knowledge(persona_id="abc-123", mode="status")
|
|
272
|
+
|
|
273
|
+
# Toggle embedding
|
|
274
|
+
knowledge(persona_id="abc-123", mode="toggle", embedding_enabled=True)
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### 6. `reference` - Platform Knowledge
|
|
280
|
+
|
|
281
|
+
**Replaces:** `get_platform_concept`, `list_platform_concepts`, `get_common_mistakes`, `get_debug_checklist`, `get_workflow_execution_model`, `get_auto_builder_guidance`, `get_qualifying_questions`, `validate_workflow_prompt`, `check_type_compatibility`
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
interface ReferenceArgs {
|
|
285
|
+
// What to get (one of these)
|
|
286
|
+
concept?: string; // Platform concept (e.g., "HITL", "Workflow")
|
|
287
|
+
guidance?: string; // Topic guidance (e.g., "categorizer-routing")
|
|
288
|
+
questions?: boolean; // Qualifying questions
|
|
289
|
+
mistakes?: boolean; // Common mistakes
|
|
290
|
+
checklist?: boolean; // Debug checklist
|
|
291
|
+
execution?: boolean; // Workflow execution model
|
|
292
|
+
|
|
293
|
+
// List flags
|
|
294
|
+
concepts?: boolean; // List all concepts
|
|
295
|
+
|
|
296
|
+
// Questions filter
|
|
297
|
+
category?: string; // Filter questions by category
|
|
298
|
+
required_only?: boolean;
|
|
299
|
+
|
|
300
|
+
// Type compatibility check
|
|
301
|
+
check_types?: { source: string; target: string };
|
|
302
|
+
|
|
303
|
+
// Prompt validation
|
|
304
|
+
validate_prompt?: string;
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Usage Examples:**
|
|
309
|
+
```bash
|
|
310
|
+
# Concepts
|
|
311
|
+
reference(concept="HITL")
|
|
312
|
+
reference(concepts=True)
|
|
313
|
+
|
|
314
|
+
# Guidance
|
|
315
|
+
reference(guidance="categorizer-routing")
|
|
316
|
+
reference(guidance="type-compatibility")
|
|
317
|
+
|
|
318
|
+
# Questions
|
|
319
|
+
reference(questions=True)
|
|
320
|
+
reference(questions=True, category="Voice", required_only=True)
|
|
321
|
+
|
|
322
|
+
# Debugging
|
|
323
|
+
reference(mistakes=True)
|
|
324
|
+
reference(checklist=True)
|
|
325
|
+
reference(execution=True)
|
|
326
|
+
|
|
327
|
+
# Validation
|
|
328
|
+
reference(check_types={source: "CHAT_CONVERSATION", target: "TEXT_WITH_SOURCES"})
|
|
329
|
+
reference(validate_prompt="Create a bot that...")
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### 7. `sync` - Environment Sync
|
|
335
|
+
|
|
336
|
+
**Replaces:** `sync`, `sync_info`
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
interface SyncArgs {
|
|
340
|
+
// What to sync
|
|
341
|
+
id?: string; // Persona ID or name
|
|
342
|
+
|
|
343
|
+
// Mode
|
|
344
|
+
mode?: "run" | "status" | "config";
|
|
345
|
+
|
|
346
|
+
// Sync flags
|
|
347
|
+
target_env: string;
|
|
348
|
+
source_env?: string;
|
|
349
|
+
scope?: "one" | "all";
|
|
350
|
+
dry_run?: boolean;
|
|
351
|
+
include_status?: boolean;
|
|
352
|
+
|
|
353
|
+
// Status flags
|
|
354
|
+
list_synced?: boolean;
|
|
355
|
+
master_env?: string;
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Usage Examples:**
|
|
360
|
+
```bash
|
|
361
|
+
# Sync single
|
|
362
|
+
sync(id="IT Support", target_env="dev")
|
|
363
|
+
sync(id="abc-123", target_env="staging", dry_run=True)
|
|
364
|
+
|
|
365
|
+
# Sync all
|
|
366
|
+
sync(target_env="dev", scope="all")
|
|
367
|
+
|
|
368
|
+
# Status
|
|
369
|
+
sync(mode="status", id="abc-123")
|
|
370
|
+
sync(mode="status", list_synced=True, env="dev")
|
|
371
|
+
|
|
372
|
+
# Config
|
|
373
|
+
sync(mode="config")
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
### 8. `env` - Environment Management
|
|
379
|
+
|
|
380
|
+
**Replaces:** `list_environments`
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
interface EnvArgs {
|
|
384
|
+
all?: boolean; // List all environments
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Usage Examples:**
|
|
389
|
+
```bash
|
|
390
|
+
env(all=True) # List available environments
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Summary: Before & After
|
|
396
|
+
|
|
397
|
+
| Before (45+ tools) | After (8 tools) |
|
|
398
|
+
|-------------------|-----------------|
|
|
399
|
+
| `find_personas`, `get_persona`, `create_ai_employee`, `update_ai_employee`, `compare_ai_employees` | `persona` |
|
|
400
|
+
| `workflow`, `deploy_workflow`, `analyze_workflow`, `detect_workflow_issues`, `validate_workflow_connections`, `suggest_workflow_fixes`, `get_workflow_metrics`, `compare_workflow_versions`, `compile_workflow` | `workflow` |
|
|
401
|
+
| `find_workflow_actions`, `get_workflow_action`, `list_auto_builder_agents`, `get_auto_builder_agent`, `suggest_agents_for_use_case` | `action` |
|
|
402
|
+
| `get_workflow_pattern`, `list_workflow_patterns`, `get_widget_reference`, `get_voice_persona_template`, `list_ai_employee_templates` | `template` |
|
|
403
|
+
| `upload_data_source`, `delete_data_source`, `list_data_sources`, `get_embedding_status`, `toggle_embedding` | `knowledge` |
|
|
404
|
+
| `get_platform_concept`, `list_platform_concepts`, `get_common_mistakes`, `get_debug_checklist`, `get_workflow_execution_model`, `get_auto_builder_guidance`, `get_qualifying_questions`, `validate_workflow_prompt`, `check_type_compatibility` | `reference` |
|
|
405
|
+
| `sync`, `sync_info` | `sync` |
|
|
406
|
+
| `list_environments` | `env` |
|
|
407
|
+
|
|
408
|
+
**Result: 45+ tools → 8 commands**
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Migration Strategy
|
|
413
|
+
|
|
414
|
+
1. **Phase 1**: Create new consolidated tools alongside existing
|
|
415
|
+
2. **Phase 2**: Mark old tools as deprecated with pointer to new
|
|
416
|
+
3. **Phase 3**: Remove deprecated tools after transition period
|
|
417
|
+
|
|
418
|
+
## Backward Compatibility
|
|
419
|
+
|
|
420
|
+
Old tool names can be aliases:
|
|
421
|
+
```typescript
|
|
422
|
+
// In server.ts
|
|
423
|
+
get_persona: (args) => persona({ ...args, mode: "get" }),
|
|
424
|
+
find_personas: (args) => persona({ ...args, all: true }),
|
|
425
|
+
analyze_workflow: (args) => workflow({ ...args, mode: "analyze" }),
|
|
426
|
+
// etc.
|
|
427
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ema.co/mcp-toolkit",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Ema AI Employee toolkit - MCP server, CLI, and SDK for managing AI Employees across environments",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"ema": "dist/cli/index.js",
|
|
10
|
+
"ema-mcp": "dist/mcp/server.js",
|
|
11
|
+
"ema-mcp-toolkit": "dist/mcp/server.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"resources",
|
|
16
|
+
"docs",
|
|
17
|
+
"config.example.yaml",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./sdk": {
|
|
26
|
+
"import": "./dist/sdk/index.js",
|
|
27
|
+
"types": "./dist/sdk/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./mcp": {
|
|
30
|
+
"import": "./dist/mcp/index.js",
|
|
31
|
+
"types": "./dist/mcp/index.d.ts"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"dev": "tsx src/index.ts",
|
|
37
|
+
"start": "node dist/index.js",
|
|
38
|
+
"mcp": "tsx src/mcp/server.ts",
|
|
39
|
+
"stop": "lsof -ti:8080 | xargs kill -9 2>/dev/null; pkill -f 'tsx.*src/(index|mcp)' || pkill -f 'node.*dist/(index|mcp)' || true",
|
|
40
|
+
"restart": "npm run stop && npm run dev",
|
|
41
|
+
"restart:mcp": "npm run stop && npm run mcp",
|
|
42
|
+
"cli": "tsx src/cli/index.ts",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:watch": "vitest",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"precommit": "npm run typecheck && npm run test",
|
|
47
|
+
"prepare": "husky",
|
|
48
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
49
|
+
"generate:types": "tsx scripts/generate-types.ts",
|
|
50
|
+
"generate:types:oats": "openapi-typescript https://staging.ema.co/api/openapi.json -o src/sdk/generated/api.d.ts",
|
|
51
|
+
"check:contracts": "tsx scripts/check-api-contracts.ts"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/Ema-Unlimited/ema-mcp-toolkit.git"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [
|
|
58
|
+
"ema",
|
|
59
|
+
"mcp",
|
|
60
|
+
"model-context-protocol",
|
|
61
|
+
"ai-assistant",
|
|
62
|
+
"cursor",
|
|
63
|
+
"claude",
|
|
64
|
+
"workflow",
|
|
65
|
+
"ai-employee"
|
|
66
|
+
],
|
|
67
|
+
"author": "Ema Inc.",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/Ema-Unlimited/ema-mcp-toolkit/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://github.com/Ema-Unlimited/ema-mcp-toolkit#readme",
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=18.0.0"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
81
|
+
"better-sqlite3": "^11.7.0",
|
|
82
|
+
"fastify": "^5.2.0",
|
|
83
|
+
"js-yaml": "^4.1.0",
|
|
84
|
+
"node-cron": "^3.0.3",
|
|
85
|
+
"zod": "^3.24.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@types/better-sqlite3": "^7.6.11",
|
|
89
|
+
"@types/js-yaml": "^4.0.9",
|
|
90
|
+
"@types/node": "^22.10.2",
|
|
91
|
+
"@types/node-cron": "^3.0.11",
|
|
92
|
+
"husky": "^9.1.7",
|
|
93
|
+
"openapi-typescript": "^7.0.0",
|
|
94
|
+
"tsx": "^4.19.2",
|
|
95
|
+
"typescript": "^5.7.2",
|
|
96
|
+
"vitest": "^4.0.16"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# {Persona Name}
|
|
2
|
+
|
|
3
|
+
**Type**: Chat AI
|
|
4
|
+
**Created**: {Date}
|
|
5
|
+
**Version**: 1.0
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
{Brief description of what this Chat AI Employee does}
|
|
10
|
+
|
|
11
|
+
## Deployment Steps
|
|
12
|
+
|
|
13
|
+
### Step 1: Create Workflow in Auto Builder
|
|
14
|
+
|
|
15
|
+
1. Go to [Ema Auto Builder](https://builder.ema.co/)
|
|
16
|
+
2. Create new AI Employee → Select **Chat AI**
|
|
17
|
+
3. Copy contents of `workflow-prompt.md` into the prompt field
|
|
18
|
+
4. Click "Generate Workflow"
|
|
19
|
+
5. Review generated nodes and verify:
|
|
20
|
+
- All categorizers have edges for every category
|
|
21
|
+
- Search nodes connect to respond nodes correctly
|
|
22
|
+
- Fallback paths are present
|
|
23
|
+
|
|
24
|
+
### Step 2: Configure Chat Settings
|
|
25
|
+
|
|
26
|
+
1. Navigate to "Chat Settings" section
|
|
27
|
+
2. Apply settings from `persona-config.json`:
|
|
28
|
+
|
|
29
|
+
| Field | Source |
|
|
30
|
+
|-------|--------|
|
|
31
|
+
| Name | `chatbotSdkConfig.name` |
|
|
32
|
+
| Theme Color | `chatbotSdkConfig.theme.primaryColor` |
|
|
33
|
+
| Logo | `chatbotSdkConfig.logo` |
|
|
34
|
+
| Allowed Domains | `chatbotSdkConfig.allowedDomains` |
|
|
35
|
+
|
|
36
|
+
### Step 3: Configure Knowledge Base
|
|
37
|
+
|
|
38
|
+
1. Navigate to "Knowledge Base" section
|
|
39
|
+
2. Upload documents from `docs/` folder
|
|
40
|
+
3. Configure tags from `persona-config.json`:
|
|
41
|
+
- Tag Types: `fileTagging.tagTypes`
|
|
42
|
+
4. Enable chunking: `fileUpload.useChunking`
|
|
43
|
+
|
|
44
|
+
### Step 4: Configure Feedback
|
|
45
|
+
|
|
46
|
+
1. Navigate to "Feedback" section
|
|
47
|
+
2. Apply settings:
|
|
48
|
+
- Question: `feedbackMessage.message.question`
|
|
49
|
+
- Frequency: `feedbackMessage.feedbackFrequency`
|
|
50
|
+
|
|
51
|
+
### Step 5: Deploy Widget
|
|
52
|
+
|
|
53
|
+
1. Get embed code from "Deploy" section
|
|
54
|
+
2. Add to your website:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<script src="https://widget.ema.co/chat/{persona-id}.js"></script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 6: Test
|
|
61
|
+
|
|
62
|
+
1. **Preview Mode**: Use the built-in chat preview
|
|
63
|
+
2. **Test Scenarios**:
|
|
64
|
+
- Test knowledge base queries
|
|
65
|
+
- Test each category branch
|
|
66
|
+
- Test fallback handling
|
|
67
|
+
- Test source citations
|
|
68
|
+
3. **Edge Cases**:
|
|
69
|
+
- Test with off-topic queries
|
|
70
|
+
- Test with multi-turn conversations
|
|
71
|
+
- Test with complex questions
|
|
72
|
+
|
|
73
|
+
## Files
|
|
74
|
+
|
|
75
|
+
| File | Description |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| `workflow-prompt.md` | Auto Builder prompt with safeguards |
|
|
78
|
+
| `persona-config.json` | Chat AI configuration |
|
|
79
|
+
| `proto-config.json` | Full API-deployable config |
|
|
80
|
+
| `docs/` | Knowledge base documents |
|
|
81
|
+
|
|
82
|
+
## Testing Checklist
|
|
83
|
+
|
|
84
|
+
- [ ] Workflow generates without validation errors
|
|
85
|
+
- [ ] Knowledge search returns relevant results
|
|
86
|
+
- [ ] Source citations appear correctly
|
|
87
|
+
- [ ] All category paths work
|
|
88
|
+
- [ ] Fallback provides helpful response
|
|
89
|
+
- [ ] Widget loads on allowed domains
|
|
90
|
+
- [ ] Feedback collection works
|
|
91
|
+
|
|
92
|
+
## Maintenance
|
|
93
|
+
|
|
94
|
+
| Change Type | Action |
|
|
95
|
+
|-------------|--------|
|
|
96
|
+
| Workflow logic | Update `workflow-prompt.md`, re-generate |
|
|
97
|
+
| Chat settings | Update `persona-config.json`, apply in UI |
|
|
98
|
+
| Knowledge content | Update docs in `docs/`, re-upload |
|
|
99
|
+
| Allowed domains | Update `chatbotSdkConfig.allowedDomains` |
|
|
100
|
+
|
|
101
|
+
## Troubleshooting
|
|
102
|
+
|
|
103
|
+
### Widget doesn't load
|
|
104
|
+
|
|
105
|
+
- Check `allowedDomains` includes your domain
|
|
106
|
+
- Verify embed code is correct
|
|
107
|
+
- Check browser console for errors
|
|
108
|
+
|
|
109
|
+
### Poor search results
|
|
110
|
+
|
|
111
|
+
- Review document chunking settings
|
|
112
|
+
- Add more specific tags
|
|
113
|
+
- Improve document structure
|
|
114
|
+
|
|
115
|
+
### Missing source citations
|
|
116
|
+
|
|
117
|
+
- Ensure `disableSources: false`
|
|
118
|
+
- Verify documents have clear headings
|
|
119
|
+
- Check that search is returning results
|