@velaro/mcp-server 2.0.146 → 2.0.147
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/package.json +2 -1
- package/parity/moshky-guide.customer.js +69 -0
- package/server.js +10760 -10756
- package/tool-annotations.js +1 -0
- package/tool-schema.js +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.147",
|
|
4
4
|
"description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"workflow-schedule.js",
|
|
56
56
|
"chat-window-style.js",
|
|
57
57
|
"toolsets.js",
|
|
58
|
+
"tool-schema.js",
|
|
58
59
|
"report-explain.json",
|
|
59
60
|
"server.json",
|
|
60
61
|
"README.md"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// velaro_guide and moshky_ask: Claude asks Moshky (the Velaro Copilot) what to do and how to set things up.
|
|
2
|
+
// Reuses POST /Copilot/Chat (grounded in copilot-kb, subscription-aware). Writes stay inside Moshky's own
|
|
3
|
+
// propose-then-confirm flow: server-side EnableCopilotWrite / CopilotWritePolicy and the AI_Moshky audit apply.
|
|
4
|
+
// CLI: velaro guide <goal>, velaro moshky-ask <question> [--confirmed]. REST: admin POST /Copilot/Chat.
|
|
5
|
+
|
|
6
|
+
const MAX_HISTORY = 12;
|
|
7
|
+
|
|
8
|
+
// Used only when Moshky is unreachable, so a failure never looks like an empty answer.
|
|
9
|
+
const FALLBACK = {
|
|
10
|
+
bot: 'Set up a bot: 1) kb_search_articles / index_list to see what knowledge exists, 2) add knowledge (scrape or kb_create_article), 3) bot_create, 4) bot_set_knowledge, 5) bot_update_prompt, 6) run the bot health check from the diagnostics tools. Retry velaro_guide for the full Moshky walkthrough.',
|
|
11
|
+
kb: 'Set up the knowledge base: 1) kb_get_settings, 2) kb_update_settings (branding), 3) kb_create_article for each topic (kb_list_topics first), 4) re-index the site knowledge, 5) kb_search_articles to check. Retry velaro_guide for the full Moshky walkthrough.',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function fallbackFor(goal) {
|
|
15
|
+
const g = String(goal).toLowerCase();
|
|
16
|
+
if (/\bbot\b/.test(g)) return FALLBACK.bot;
|
|
17
|
+
if (/\bkb\b|knowledge|help center|article/.test(g)) return FALLBACK.kb;
|
|
18
|
+
return 'Start with check_site_health, then retry velaro_guide with a more specific goal.';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function askMoshky(ctx, messages, context) {
|
|
22
|
+
const res = await ctx.api('POST', '/Copilot/Chat', { messages, context, product: 'v20' });
|
|
23
|
+
if (res && res.success === false) throw new Error(res.error || 'Moshky could not answer');
|
|
24
|
+
const reply = res && res.reply;
|
|
25
|
+
if (!reply) throw new Error('Moshky returned no reply');
|
|
26
|
+
return String(reply);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const tools = [
|
|
30
|
+
{
|
|
31
|
+
name: 'velaro_guide',
|
|
32
|
+
description: 'Ask Moshky how to set something up. Call this FIRST for any configuration goal (e.g. "set up a bot", "set up the knowledge base", "connect Shopify"). Returns the recommended ordered steps from the Velaro skills library and the exact MCP tools to call for each. Read-only; changes nothing.',
|
|
33
|
+
inputSchema: { type: 'object', properties: { goal: { type: 'string', description: 'What you want to achieve, in plain words' } }, required: ['goal'] },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'moshky_ask',
|
|
37
|
+
description: 'Ask Moshky (the Velaro Copilot) a question or to make a change. Without confirmed=true Moshky only answers or proposes the change. After the user agrees, call again with confirmed=true and the same history. Moshky applies changes only when "Moshky can make changes" is on for the site (moshky_write_access_get); every change is audit-logged and can be rolled back.',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
question: { type: 'string', description: 'The question or requested change' },
|
|
42
|
+
confirmed: { type: 'boolean', description: 'true only after the user approved the change Moshky proposed' },
|
|
43
|
+
history: { type: 'array', description: 'Prior turns [{role:"user"|"assistant", content}] so Moshky keeps the proposal in context', items: { type: 'object', properties: { role: { type: 'string' }, content: { type: 'string' } } } },
|
|
44
|
+
context: { type: 'string', description: 'Optional page or area, e.g. "workflows"' },
|
|
45
|
+
},
|
|
46
|
+
required: ['question'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export const handlers = {
|
|
52
|
+
velaro_guide: async (a, ctx) => {
|
|
53
|
+
if (!a.goal || !String(a.goal).trim()) throw new Error('goal is required');
|
|
54
|
+
const prompt = `An MCP client (an AI assistant) wants to: ${String(a.goal).trim()}. Reply with the recommended ordered setup steps from the Velaro skills library, naming the exact MCP tool for each step, and what to check first. Do not change anything.`;
|
|
55
|
+
try {
|
|
56
|
+
return await askMoshky(ctx, [{ role: 'user', content: prompt }], 'mcp-guide');
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return `Moshky guide unavailable (${String(e.message).slice(0, 160)}). Built-in outline: ${fallbackFor(a.goal)}`;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
moshky_ask: async (a, ctx) => {
|
|
62
|
+
if (!a.question || !String(a.question).trim()) throw new Error('question is required');
|
|
63
|
+
const history = Array.isArray(a.history) ? a.history.slice(-MAX_HISTORY).filter((m) => m && (m.role === 'user' || m.role === 'assistant') && typeof m.content === 'string') : [];
|
|
64
|
+
const q = a.confirmed === true
|
|
65
|
+
? `Confirmed: yes, apply it. ${String(a.question).trim()}`
|
|
66
|
+
: `${String(a.question).trim()}\n\n(From an MCP client. Propose any change and wait for confirmation; do not apply it yet.)`;
|
|
67
|
+
return await askMoshky(ctx, [...history, { role: 'user', content: q }], a.context || 'mcp');
|
|
68
|
+
},
|
|
69
|
+
};
|