@mikado-ai/cli 0.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 +229 -0
- package/dist/chunk-5RICPX62.js +94 -0
- package/dist/chunk-6RKQ24OP.js +94 -0
- package/dist/chunk-DC4BEVL3.js +94 -0
- package/dist/chunk-L27HHHAB.js +95 -0
- package/dist/chunk-TJ7OWJIM.js +94 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +597 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.js +208 -0
- package/package.json +54 -0
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MikadoClient,
|
|
4
|
+
pollJob
|
|
5
|
+
} from "./chunk-L27HHHAB.js";
|
|
6
|
+
|
|
7
|
+
// src/mcp.ts
|
|
8
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
import {
|
|
11
|
+
CallToolRequestSchema,
|
|
12
|
+
ListToolsRequestSchema
|
|
13
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
14
|
+
|
|
15
|
+
// src/mcp/tools.ts
|
|
16
|
+
var TOOLS = [
|
|
17
|
+
{
|
|
18
|
+
name: "mikado_submit",
|
|
19
|
+
description: "Submit a conversation transcript to Mikado for processing. Returns immediately with job_id and conversation_id. Use mikado_submit_and_wait if you want to wait for results.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
content: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "The conversation transcript content to process"
|
|
26
|
+
},
|
|
27
|
+
campaign: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Campaign short_id, UUID, or name to target"
|
|
30
|
+
},
|
|
31
|
+
filename: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Optional filename for reference"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
required: ["content"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "mikado_submit_and_wait",
|
|
41
|
+
description: "Submit a conversation transcript and wait for processing to complete. Returns full conversation results including insights, analytics, and participants. This may take 30-60 seconds.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
content: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "The conversation transcript content to process"
|
|
48
|
+
},
|
|
49
|
+
campaign: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "Campaign short_id, UUID, or name to target"
|
|
52
|
+
},
|
|
53
|
+
timeout_seconds: {
|
|
54
|
+
type: "number",
|
|
55
|
+
description: "Maximum time to wait for processing in seconds (default: 300)",
|
|
56
|
+
default: 300
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
required: ["content"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "mikado_status",
|
|
64
|
+
description: "Check the status of a processing job by job_id. Returns current status (QUEUED, PROCESSING, COMPLETED, or FAILED).",
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
job_id: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "The job ID returned from mikado_submit"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
required: ["job_id"]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "mikado_result",
|
|
78
|
+
description: "Get full results for a completed conversation by conversation_id. Returns insights, analytics, participants, and all extracted data.",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {
|
|
82
|
+
conversation_id: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "The conversation ID to fetch results for"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
required: ["conversation_id"]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "mikado_campaigns",
|
|
92
|
+
description: "List all available campaigns in the organization. Campaigns are used to organize and categorize conversations.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {},
|
|
96
|
+
required: []
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
async function handleToolCall(name, args, client) {
|
|
101
|
+
switch (name) {
|
|
102
|
+
case "mikado_submit": {
|
|
103
|
+
const result = await client.submit(args.content, {
|
|
104
|
+
campaign: args.campaign,
|
|
105
|
+
filename: args.filename
|
|
106
|
+
});
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
case "mikado_submit_and_wait": {
|
|
110
|
+
const submitResult = await client.submit(args.content, {
|
|
111
|
+
campaign: args.campaign
|
|
112
|
+
});
|
|
113
|
+
const timeoutMs = (args.timeout_seconds || 300) * 1e3;
|
|
114
|
+
const finalStatus = await pollJob(client, submitResult.job_id, {
|
|
115
|
+
timeout: timeoutMs
|
|
116
|
+
});
|
|
117
|
+
if (finalStatus.status === "FAILED") {
|
|
118
|
+
throw new Error(`Processing failed: ${finalStatus.error_message || "Unknown error"}`);
|
|
119
|
+
}
|
|
120
|
+
const conversation = await client.getConversation(submitResult.conversation_id);
|
|
121
|
+
return conversation;
|
|
122
|
+
}
|
|
123
|
+
case "mikado_status": {
|
|
124
|
+
const status = await client.getJobStatus(args.job_id);
|
|
125
|
+
return status;
|
|
126
|
+
}
|
|
127
|
+
case "mikado_result": {
|
|
128
|
+
const conversation = await client.getConversation(args.conversation_id);
|
|
129
|
+
return conversation;
|
|
130
|
+
}
|
|
131
|
+
case "mikado_campaigns": {
|
|
132
|
+
const campaigns = await client.listCampaigns();
|
|
133
|
+
return campaigns;
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/mcp.ts
|
|
141
|
+
async function startMcpServer() {
|
|
142
|
+
const apiKey = process.env.MIKADO_API_KEY;
|
|
143
|
+
const baseUrl = process.env.MIKADO_URL || "https://mikadoai.app";
|
|
144
|
+
if (!apiKey) {
|
|
145
|
+
console.error("Error: MIKADO_API_KEY environment variable is required");
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
const client = new MikadoClient({ apiKey, baseUrl });
|
|
149
|
+
const server = new Server(
|
|
150
|
+
{
|
|
151
|
+
name: "mikado",
|
|
152
|
+
version: "0.1.0"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
capabilities: {
|
|
156
|
+
tools: {}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
161
|
+
return {
|
|
162
|
+
tools: TOOLS
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
166
|
+
try {
|
|
167
|
+
const result = await handleToolCall(
|
|
168
|
+
request.params.name,
|
|
169
|
+
request.params.arguments,
|
|
170
|
+
client
|
|
171
|
+
);
|
|
172
|
+
return {
|
|
173
|
+
content: [
|
|
174
|
+
{
|
|
175
|
+
type: "text",
|
|
176
|
+
text: JSON.stringify(result, null, 2)
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
} catch (error) {
|
|
181
|
+
return {
|
|
182
|
+
content: [
|
|
183
|
+
{
|
|
184
|
+
type: "text",
|
|
185
|
+
text: `Error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
isError: true
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const transport = new StdioServerTransport();
|
|
193
|
+
await server.connect(transport);
|
|
194
|
+
process.on("SIGINT", async () => {
|
|
195
|
+
await server.close();
|
|
196
|
+
process.exit(0);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
var isDirectRun = process.argv[1]?.includes("mcp");
|
|
200
|
+
if (isDirectRun) {
|
|
201
|
+
startMcpServer().catch((error) => {
|
|
202
|
+
console.error("Fatal error:", error);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
startMcpServer
|
|
208
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mikado-ai/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Mikado AI CLI and MCP server — submit transcripts, extract insights, integrate with AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://mikadoai.app",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/kkarkos/mikado-ai.git",
|
|
11
|
+
"directory": "cli"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mikado",
|
|
15
|
+
"cli",
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"ai",
|
|
19
|
+
"transcripts",
|
|
20
|
+
"conversation-analytics",
|
|
21
|
+
"insights",
|
|
22
|
+
"conversational-ai"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"mikado": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"exports": {
|
|
28
|
+
".": "./dist/core/client.js",
|
|
29
|
+
"./mcp": "./dist/mcp.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup src/index.ts src/mcp.ts --format esm --dts",
|
|
37
|
+
"dev": "tsup src/index.ts src/mcp.ts --format esm --watch",
|
|
38
|
+
"prepublishOnly": "npm run build"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"commander": "^12.0.0",
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
43
|
+
"ora": "^8.0.0",
|
|
44
|
+
"chalk": "^5.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"tsup": "^8.0.0",
|
|
48
|
+
"typescript": "^5.5.0",
|
|
49
|
+
"@types/node": "^20.0.0"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|