@easyfunnel/mcp 0.1.4 → 0.1.6
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/dist/index.js +85 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -85,6 +85,15 @@ var ApiClient = class {
|
|
|
85
85
|
});
|
|
86
86
|
return { status: res.status, body: await res.text() };
|
|
87
87
|
}
|
|
88
|
+
async getChatConfig(projectId) {
|
|
89
|
+
return this.request(`/projects/${projectId}/chat-config`);
|
|
90
|
+
}
|
|
91
|
+
async setupChatConfig(projectId, config) {
|
|
92
|
+
return this.request(`/projects/${projectId}/chat-config`, {
|
|
93
|
+
method: "PUT",
|
|
94
|
+
body: JSON.stringify(config)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
88
97
|
async queryEvents(projectId, params) {
|
|
89
98
|
const searchParams = new URLSearchParams();
|
|
90
99
|
searchParams.set("query_type", params.query_type);
|
|
@@ -1495,18 +1504,18 @@ Next: I can set up the SDK in your project, or suggest conversion funnels based
|
|
|
1495
1504
|
const scanData = {
|
|
1496
1505
|
framework,
|
|
1497
1506
|
router,
|
|
1498
|
-
routes,
|
|
1507
|
+
routes: routes.slice(0, 50),
|
|
1508
|
+
routes_total: routes.length,
|
|
1499
1509
|
product_type: productType.type,
|
|
1500
1510
|
product_confidence: productType.confidence,
|
|
1501
1511
|
detection_categories: categories,
|
|
1502
1512
|
detection_count: detections.length,
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
}))
|
|
1513
|
+
detections_by_category: Object.fromEntries(
|
|
1514
|
+
categories.map((cat) => [
|
|
1515
|
+
cat,
|
|
1516
|
+
byCategory[cat].slice(0, 5).map((d) => d.signal)
|
|
1517
|
+
])
|
|
1518
|
+
)
|
|
1510
1519
|
};
|
|
1511
1520
|
return {
|
|
1512
1521
|
content: [
|
|
@@ -1961,6 +1970,70 @@ Tip: Ask me "how is my signup funnel doing?" to check performance anytime.`;
|
|
|
1961
1970
|
};
|
|
1962
1971
|
}
|
|
1963
1972
|
|
|
1973
|
+
// src/tools/setup-chat.ts
|
|
1974
|
+
var setupChatWidgetDefinition = {
|
|
1975
|
+
name: "setup_chat_widget",
|
|
1976
|
+
description: "Set up the AI chat widget for a project. Creates chat configuration with knowledge base and returns the embed code to add to the site.",
|
|
1977
|
+
inputSchema: {
|
|
1978
|
+
type: "object",
|
|
1979
|
+
properties: {
|
|
1980
|
+
project_id: {
|
|
1981
|
+
type: "string",
|
|
1982
|
+
description: "The project ID to set up chat for"
|
|
1983
|
+
},
|
|
1984
|
+
knowledge_base: {
|
|
1985
|
+
type: "string",
|
|
1986
|
+
description: "Product description, features, pricing, FAQ \u2014 the knowledge the AI agent uses to answer visitor questions"
|
|
1987
|
+
},
|
|
1988
|
+
custom_instructions: {
|
|
1989
|
+
type: "string",
|
|
1990
|
+
description: 'Optional behavior rules (e.g., "Always suggest signing up", "Never discuss competitors")'
|
|
1991
|
+
},
|
|
1992
|
+
welcome_message: {
|
|
1993
|
+
type: "string",
|
|
1994
|
+
description: 'Optional welcome message shown when chat opens (default: "Hi! How can I help you today?")'
|
|
1995
|
+
},
|
|
1996
|
+
tone: {
|
|
1997
|
+
type: "string",
|
|
1998
|
+
enum: ["friendly", "professional", "technical"],
|
|
1999
|
+
description: "Tone of the AI agent (default: friendly)"
|
|
2000
|
+
}
|
|
2001
|
+
},
|
|
2002
|
+
required: ["project_id", "knowledge_base"]
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
async function setupChatWidget(client2, args) {
|
|
2006
|
+
const result = await client2.setupChatConfig(args.project_id, {
|
|
2007
|
+
knowledge_base: args.knowledge_base,
|
|
2008
|
+
custom_instructions: args.custom_instructions || "",
|
|
2009
|
+
welcome_message: args.welcome_message || "Hi! How can I help you today?",
|
|
2010
|
+
tone: args.tone || "friendly",
|
|
2011
|
+
is_enabled: true
|
|
2012
|
+
});
|
|
2013
|
+
return {
|
|
2014
|
+
content: [
|
|
2015
|
+
{
|
|
2016
|
+
type: "text",
|
|
2017
|
+
text: `Chat widget configured successfully!
|
|
2018
|
+
|
|
2019
|
+
**Embed code** \u2014 add this to your site's HTML:
|
|
2020
|
+
\`\`\`html
|
|
2021
|
+
${result.embed_code}
|
|
2022
|
+
\`\`\`
|
|
2023
|
+
|
|
2024
|
+
**Edit settings** at: ${result.dashboard_url}
|
|
2025
|
+
|
|
2026
|
+
The chat widget will appear as a floating bubble in the bottom-right corner of your site. Visitors can ask questions and the AI agent will respond based on the knowledge base you provided.
|
|
2027
|
+
|
|
2028
|
+
**Next steps:**
|
|
2029
|
+
1. Add the embed code to your site's \`<head>\` or before \`</body>\`
|
|
2030
|
+
2. Test the widget on your site
|
|
2031
|
+
3. Edit knowledge base, instructions, and docs at the dashboard URL above`
|
|
2032
|
+
}
|
|
2033
|
+
]
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
|
|
1964
2037
|
// src/index.ts
|
|
1965
2038
|
var apiKey = process.env.EASYFUNNEL_API_KEY;
|
|
1966
2039
|
if (!apiKey) {
|
|
@@ -1990,7 +2063,8 @@ server.setRequestHandler(import_types.ListToolsRequestSchema, async () => ({
|
|
|
1990
2063
|
getFunnelHealthDefinition,
|
|
1991
2064
|
queryEventsDefinition,
|
|
1992
2065
|
deleteFunnelDefinition,
|
|
1993
|
-
updateFunnelDefinition
|
|
2066
|
+
updateFunnelDefinition,
|
|
2067
|
+
setupChatWidgetDefinition
|
|
1994
2068
|
]
|
|
1995
2069
|
}));
|
|
1996
2070
|
server.setRequestHandler(import_types.CallToolRequestSchema, async (request) => {
|
|
@@ -2024,6 +2098,8 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
2024
2098
|
return deleteFunnel(client, args);
|
|
2025
2099
|
case "update_funnel":
|
|
2026
2100
|
return updateFunnel(client, args);
|
|
2101
|
+
case "setup_chat_widget":
|
|
2102
|
+
return setupChatWidget(client, args);
|
|
2027
2103
|
default:
|
|
2028
2104
|
throw new Error(`Unknown tool: ${name}`);
|
|
2029
2105
|
}
|