@easyfunnel/mcp 0.1.5 → 0.1.7
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 +86 -2
- 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);
|
|
@@ -259,8 +268,16 @@ Next: After adding the script, I'll verify everything works with a test event.`
|
|
|
259
268
|
if (!content.includes(config.envVarName)) {
|
|
260
269
|
(0, import_fs.writeFileSync)(envPath, content.trimEnd() + "\n" + envLine + "\n");
|
|
261
270
|
envWritten = true;
|
|
271
|
+
} else if (!content.includes(envLine)) {
|
|
272
|
+
const updated = content.replace(
|
|
273
|
+
new RegExp(`^${config.envVarName}=.*$`, "m"),
|
|
274
|
+
envLine
|
|
275
|
+
);
|
|
276
|
+
(0, import_fs.writeFileSync)(envPath, updated);
|
|
277
|
+
envWritten = true;
|
|
278
|
+
steps.push(`[done] Updated ${config.envVarName} to new API key in ${config.envFile}`);
|
|
262
279
|
} else {
|
|
263
|
-
steps.push(`[skip] ${config.envVarName} already
|
|
280
|
+
steps.push(`[skip] ${config.envVarName} already set correctly in ${config.envFile}`);
|
|
264
281
|
}
|
|
265
282
|
} else {
|
|
266
283
|
(0, import_fs.writeFileSync)(envPath, envLine + "\n");
|
|
@@ -1961,6 +1978,70 @@ Tip: Ask me "how is my signup funnel doing?" to check performance anytime.`;
|
|
|
1961
1978
|
};
|
|
1962
1979
|
}
|
|
1963
1980
|
|
|
1981
|
+
// src/tools/setup-chat.ts
|
|
1982
|
+
var setupChatWidgetDefinition = {
|
|
1983
|
+
name: "setup_chat_widget",
|
|
1984
|
+
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.",
|
|
1985
|
+
inputSchema: {
|
|
1986
|
+
type: "object",
|
|
1987
|
+
properties: {
|
|
1988
|
+
project_id: {
|
|
1989
|
+
type: "string",
|
|
1990
|
+
description: "The project ID to set up chat for"
|
|
1991
|
+
},
|
|
1992
|
+
knowledge_base: {
|
|
1993
|
+
type: "string",
|
|
1994
|
+
description: "Product description, features, pricing, FAQ \u2014 the knowledge the AI agent uses to answer visitor questions"
|
|
1995
|
+
},
|
|
1996
|
+
custom_instructions: {
|
|
1997
|
+
type: "string",
|
|
1998
|
+
description: 'Optional behavior rules (e.g., "Always suggest signing up", "Never discuss competitors")'
|
|
1999
|
+
},
|
|
2000
|
+
welcome_message: {
|
|
2001
|
+
type: "string",
|
|
2002
|
+
description: 'Optional welcome message shown when chat opens (default: "Hi! How can I help you today?")'
|
|
2003
|
+
},
|
|
2004
|
+
tone: {
|
|
2005
|
+
type: "string",
|
|
2006
|
+
enum: ["friendly", "professional", "technical"],
|
|
2007
|
+
description: "Tone of the AI agent (default: friendly)"
|
|
2008
|
+
}
|
|
2009
|
+
},
|
|
2010
|
+
required: ["project_id", "knowledge_base"]
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
async function setupChatWidget(client2, args) {
|
|
2014
|
+
const result = await client2.setupChatConfig(args.project_id, {
|
|
2015
|
+
knowledge_base: args.knowledge_base,
|
|
2016
|
+
custom_instructions: args.custom_instructions || "",
|
|
2017
|
+
welcome_message: args.welcome_message || "Hi! How can I help you today?",
|
|
2018
|
+
tone: args.tone || "friendly",
|
|
2019
|
+
is_enabled: true
|
|
2020
|
+
});
|
|
2021
|
+
return {
|
|
2022
|
+
content: [
|
|
2023
|
+
{
|
|
2024
|
+
type: "text",
|
|
2025
|
+
text: `Chat widget configured successfully!
|
|
2026
|
+
|
|
2027
|
+
**Embed code** \u2014 add this to your site's HTML:
|
|
2028
|
+
\`\`\`html
|
|
2029
|
+
${result.embed_code}
|
|
2030
|
+
\`\`\`
|
|
2031
|
+
|
|
2032
|
+
**Edit settings** at: ${result.dashboard_url}
|
|
2033
|
+
|
|
2034
|
+
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.
|
|
2035
|
+
|
|
2036
|
+
**Next steps:**
|
|
2037
|
+
1. Add the embed code to your site's \`<head>\` or before \`</body>\`
|
|
2038
|
+
2. Test the widget on your site
|
|
2039
|
+
3. Edit knowledge base, instructions, and docs at the dashboard URL above`
|
|
2040
|
+
}
|
|
2041
|
+
]
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
|
|
1964
2045
|
// src/index.ts
|
|
1965
2046
|
var apiKey = process.env.EASYFUNNEL_API_KEY;
|
|
1966
2047
|
if (!apiKey) {
|
|
@@ -1990,7 +2071,8 @@ server.setRequestHandler(import_types.ListToolsRequestSchema, async () => ({
|
|
|
1990
2071
|
getFunnelHealthDefinition,
|
|
1991
2072
|
queryEventsDefinition,
|
|
1992
2073
|
deleteFunnelDefinition,
|
|
1993
|
-
updateFunnelDefinition
|
|
2074
|
+
updateFunnelDefinition,
|
|
2075
|
+
setupChatWidgetDefinition
|
|
1994
2076
|
]
|
|
1995
2077
|
}));
|
|
1996
2078
|
server.setRequestHandler(import_types.CallToolRequestSchema, async (request) => {
|
|
@@ -2024,6 +2106,8 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
2024
2106
|
return deleteFunnel(client, args);
|
|
2025
2107
|
case "update_funnel":
|
|
2026
2108
|
return updateFunnel(client, args);
|
|
2109
|
+
case "setup_chat_widget":
|
|
2110
|
+
return setupChatWidget(client, args);
|
|
2027
2111
|
default:
|
|
2028
2112
|
throw new Error(`Unknown tool: ${name}`);
|
|
2029
2113
|
}
|