@launchpath-ai/mcp-server 1.0.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 +94 -0
- package/build/client.d.ts +38 -0
- package/build/client.js +210 -0
- package/build/client.js.map +1 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +374 -0
- package/build/index.js.map +1 -0
- package/build/tools/agents.d.ts +6 -0
- package/build/tools/agents.js +249 -0
- package/build/tools/agents.js.map +1 -0
- package/build/tools/analytics.d.ts +7 -0
- package/build/tools/analytics.js +282 -0
- package/build/tools/analytics.js.map +1 -0
- package/build/tools/campaigns.d.ts +6 -0
- package/build/tools/campaigns.js +158 -0
- package/build/tools/campaigns.js.map +1 -0
- package/build/tools/channels.d.ts +7 -0
- package/build/tools/channels.js +319 -0
- package/build/tools/channels.js.map +1 -0
- package/build/tools/clients.d.ts +6 -0
- package/build/tools/clients.js +138 -0
- package/build/tools/clients.js.map +1 -0
- package/build/tools/composio.d.ts +6 -0
- package/build/tools/composio.js +188 -0
- package/build/tools/composio.js.map +1 -0
- package/build/tools/core.d.ts +6 -0
- package/build/tools/core.js +130 -0
- package/build/tools/core.js.map +1 -0
- package/build/tools/integrations.d.ts +6 -0
- package/build/tools/integrations.js +188 -0
- package/build/tools/integrations.js.map +1 -0
- package/build/tools/knowledge.d.ts +7 -0
- package/build/tools/knowledge.js +274 -0
- package/build/tools/knowledge.js.map +1 -0
- package/build/tools/portal.d.ts +6 -0
- package/build/tools/portal.js +86 -0
- package/build/tools/portal.js.map +1 -0
- package/build/tools/tools-config.d.ts +6 -0
- package/build/tools/tools-config.js +213 -0
- package/build/tools/tools-config.js.map +1 -0
- package/build/tools/whatsapp.d.ts +7 -0
- package/build/tools/whatsapp.js +399 -0
- package/build/tools/whatsapp.js.map +1 -0
- package/build/types.d.ts +87 -0
- package/build/types.js +3 -0
- package/build/types.js.map +1 -0
- package/package.json +44 -0
- package/plugin.json +28 -0
- package/skills/agent-report/SKILL.md +44 -0
- package/skills/deploy-agent/SKILL.md +74 -0
- package/skills/launchpath-guide/SKILL.md +60 -0
- package/skills/setup-client/SKILL.md +44 -0
- package/skills/whatsapp-campaign/SKILL.md +72 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composio toolset (on-demand) — browse integrations, list actions, check connections
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { formatError } from "../client.js";
|
|
6
|
+
export function registerComposioTools(server, client) {
|
|
7
|
+
const integrationsUrl = `${client.dashboardUrl}/dashboard/settings/integrations`;
|
|
8
|
+
// --- list_composio_apps ---
|
|
9
|
+
server.registerTool("list_composio_apps", {
|
|
10
|
+
title: "List Composio Apps",
|
|
11
|
+
description: 'Browse 900+ available integrations (Google Calendar, Gmail, Slack, Sheets, HubSpot, etc.). Search by name to find the right toolkit. Returns toolkit slug, auth requirements, and action count. Example: list_composio_apps(search: "calendar")',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
search: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Search query to filter apps (e.g., "calendar", "email", "crm")'),
|
|
17
|
+
},
|
|
18
|
+
annotations: {
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
}, async ({ search }) => {
|
|
23
|
+
const params = search ? `?search=${encodeURIComponent(search)}` : "";
|
|
24
|
+
const res = await client.get(`/api/composio/apps${params}`);
|
|
25
|
+
if (res.error) {
|
|
26
|
+
return {
|
|
27
|
+
isError: true,
|
|
28
|
+
content: [{ type: "text", text: formatError(res.error, res.status) }],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const apps = res.data?.apps ?? [];
|
|
32
|
+
if (apps.length === 0) {
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: search
|
|
38
|
+
? `No integrations found matching "${search}". Try a broader search term (e.g., "email" instead of "gmail").`
|
|
39
|
+
: "No integrations available.",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const summary = apps.slice(0, 30).map((a) => ({
|
|
45
|
+
toolkit: a.toolkit,
|
|
46
|
+
name: a.name,
|
|
47
|
+
category: a.category,
|
|
48
|
+
description: a.description,
|
|
49
|
+
requires_auth: !a.noAuth,
|
|
50
|
+
auth_types: a.authSchemes ?? [],
|
|
51
|
+
actions_count: a.toolsCount ?? 0,
|
|
52
|
+
}));
|
|
53
|
+
let text = `Found ${apps.length} integrations${search ? ` matching "${search}"` : ""} (showing first ${summary.length}):\n\n`;
|
|
54
|
+
text += JSON.stringify(summary, null, 2);
|
|
55
|
+
text += `\n\n## Next Steps\n`;
|
|
56
|
+
text += `1. Pick a toolkit from the list above (use the "toolkit" slug value)\n`;
|
|
57
|
+
text += `2. Run list_composio_actions(toolkit: "<slug>") to see what actions it can perform\n`;
|
|
58
|
+
text += `3. Run check_composio_connections() to see if the user has already connected this app\n`;
|
|
59
|
+
text += `4. If not connected, the user needs to authorize at: ${integrationsUrl}`;
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text }],
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
// --- list_composio_actions ---
|
|
65
|
+
server.registerTool("list_composio_actions", {
|
|
66
|
+
title: "List Composio Actions",
|
|
67
|
+
description: "List all available actions for a Composio toolkit. Shows action slugs (the exact names you need), descriptions, and which ones are most commonly used. Use this to find the exact action names needed for add_agent_tool.",
|
|
68
|
+
inputSchema: {
|
|
69
|
+
toolkit: z
|
|
70
|
+
.string()
|
|
71
|
+
.describe('Toolkit slug from list_composio_apps (e.g., "googlecalendar", "gmail", "slack")'),
|
|
72
|
+
include_schemas: z
|
|
73
|
+
.boolean()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("Include full parameter schemas for each action. Set to true if you need to understand what inputs each action requires. Default: false."),
|
|
76
|
+
},
|
|
77
|
+
annotations: {
|
|
78
|
+
readOnlyHint: true,
|
|
79
|
+
openWorldHint: true,
|
|
80
|
+
},
|
|
81
|
+
}, async ({ toolkit, include_schemas }) => {
|
|
82
|
+
const params = new URLSearchParams({ toolkit });
|
|
83
|
+
if (include_schemas)
|
|
84
|
+
params.set("include_schemas", "true");
|
|
85
|
+
const res = await client.get(`/api/composio/tools?${params.toString()}`);
|
|
86
|
+
if (res.error) {
|
|
87
|
+
return {
|
|
88
|
+
isError: true,
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: formatError(res.error, res.status, "Verify the toolkit slug is correct. Use list_composio_apps to find valid slugs."),
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const tools = res.data?.tools ?? [];
|
|
98
|
+
if (tools.length === 0) {
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: `No actions found for toolkit "${toolkit}". Verify the slug with list_composio_apps.`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const important = tools.filter((t) => t.isImportant);
|
|
109
|
+
const other = tools.filter((t) => !t.isImportant);
|
|
110
|
+
let text = `## Actions for "${toolkit}" (${tools.length} total, ${important.length} recommended)\n\n`;
|
|
111
|
+
if (important.length > 0) {
|
|
112
|
+
text += `### Recommended actions (most commonly used):\n${JSON.stringify(important, null, 2)}\n\n`;
|
|
113
|
+
}
|
|
114
|
+
if (other.length > 0) {
|
|
115
|
+
text += `### Other available actions:\n${JSON.stringify(other, null, 2)}\n\n`;
|
|
116
|
+
}
|
|
117
|
+
text += `## How to add this to an agent\n\n`;
|
|
118
|
+
text += `1. First, check the user has connected this app: check_composio_connections()\n`;
|
|
119
|
+
text += ` - If NOT connected, they need to authorize at: ${integrationsUrl}\n`;
|
|
120
|
+
text += ` - OAuth apps (Google, Slack, GitHub) require browser authorization — this cannot be done from the terminal\n\n`;
|
|
121
|
+
text += `2. Once connected, enable the tools-config toolset: enable_toolset("tools-config")\n\n`;
|
|
122
|
+
text += `3. Then add the tool to the agent:\n`;
|
|
123
|
+
text += ` add_agent_tool(\n`;
|
|
124
|
+
text += ` agent_id: "<agent_id>",\n`;
|
|
125
|
+
text += ` tool_type: "composio",\n`;
|
|
126
|
+
text += ` display_name: "${toolkit}",\n`;
|
|
127
|
+
text += ` description: "What this integration does for the agent",\n`;
|
|
128
|
+
text += ` config: {\n`;
|
|
129
|
+
text += ` toolkit: "${toolkit}",\n`;
|
|
130
|
+
text += ` toolkit_name: "${tools[0]?.name?.split(" ")[0] ?? toolkit}",\n`;
|
|
131
|
+
text += ` enabled_actions: [${important.slice(0, 3).map((t) => `"${t.slug}"`).join(", ")}]\n`;
|
|
132
|
+
text += ` }\n`;
|
|
133
|
+
text += ` )\n\n`;
|
|
134
|
+
text += `4. Finally, update the agent's tool_guidelines with instructions on when and how to use these actions.`;
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text }],
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
// --- check_composio_connections ---
|
|
140
|
+
server.registerTool("check_composio_connections", {
|
|
141
|
+
title: "Check Composio Connections",
|
|
142
|
+
description: "Check which Composio integrations the user has authorized (Google Calendar, Gmail, Slack, etc.). Tools won't work unless the user has an active connection. If a connection is missing, provide the dashboard URL for them to connect.",
|
|
143
|
+
inputSchema: {},
|
|
144
|
+
annotations: {
|
|
145
|
+
readOnlyHint: true,
|
|
146
|
+
openWorldHint: true,
|
|
147
|
+
},
|
|
148
|
+
}, async () => {
|
|
149
|
+
const res = await client.get("/api/composio/connections");
|
|
150
|
+
if (res.error) {
|
|
151
|
+
return {
|
|
152
|
+
isError: true,
|
|
153
|
+
content: [{ type: "text", text: formatError(res.error, res.status) }],
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const connections = res.data?.connections ?? [];
|
|
157
|
+
if (connections.length === 0) {
|
|
158
|
+
return {
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: "text",
|
|
162
|
+
text: `No integrations connected yet.\n\nTo connect apps like Google Calendar, Gmail, Slack, etc., the user needs to:\n\n1. Open this URL in their browser: ${integrationsUrl}\n2. Click on the app they want to connect\n3. Complete the authorization (sign in with Google, etc.)\n4. Come back here and run check_composio_connections() again to verify\n\nThis is required because these apps use OAuth, which needs a browser for the secure sign-in flow.`,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const active = connections.filter((c) => c.status === "active");
|
|
168
|
+
const pending = connections.filter((c) => c.status !== "active");
|
|
169
|
+
let text = `## Connected Integrations\n\n`;
|
|
170
|
+
text += `**${active.length} active** | ${pending.length} pending\n\n`;
|
|
171
|
+
for (const c of connections) {
|
|
172
|
+
const icon = c.status === "active" ? "✅" : "⏳";
|
|
173
|
+
const label = c.account_label ? ` (${c.account_label})` : "";
|
|
174
|
+
text += `${icon} **${c.toolkit}**${label} — ${c.status}`;
|
|
175
|
+
if (c.connected_at)
|
|
176
|
+
text += ` (connected ${c.connected_at})`;
|
|
177
|
+
text += `\n`;
|
|
178
|
+
}
|
|
179
|
+
if (pending.length > 0) {
|
|
180
|
+
text += `\nPending connections may need re-authorization at: ${integrationsUrl}`;
|
|
181
|
+
}
|
|
182
|
+
text += `\n\nTo connect additional apps: ${integrationsUrl}`;
|
|
183
|
+
return {
|
|
184
|
+
content: [{ type: "text", text }],
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=composio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composio.js","sourceRoot":"","sources":["../../src/tools/composio.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C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IAAI,GAAG,+BAA+B,CAAC;QAC3C,IAAI,IAAI,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,CAAC,MAAM,cAAc,CAAC;QAEtE,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAC/C,MAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,IAAI,IAAI,GAAG,IAAI,MAAM,CAAC,CAAC,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;YACzD,IAAI,CAAC,CAAC,YAAY;gBAAE,IAAI,IAAI,eAAe,CAAC,CAAC,YAAY,GAAG,CAAC;YAC7D,IAAI,IAAI,IAAI,CAAC;QACf,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,IAAI,uDAAuD,eAAe,EAAE,CAAC;QACnF,CAAC;QAED,IAAI,IAAI,mCAAmC,eAAe,EAAE,CAAC;QAE7D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core toolset (default) — list_agents, get_agent, chat_with_agent
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import type { LaunchPathClient } from "../client.js";
|
|
6
|
+
export declare function registerCoreTools(server: McpServer, client: LaunchPathClient): void;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core toolset (default) — list_agents, get_agent, chat_with_agent
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { formatError } from "../client.js";
|
|
6
|
+
export function registerCoreTools(server, client) {
|
|
7
|
+
// --- list_agents ---
|
|
8
|
+
server.registerTool("list_agents", {
|
|
9
|
+
title: "List Agents",
|
|
10
|
+
description: "List all your AI agents with status, model, and counts for tools, knowledge docs, and channels. Use this first to find agent IDs before other operations.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
status: z
|
|
13
|
+
.enum(["active", "draft", "archived"])
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Filter by status: "active", "draft", or "archived"'),
|
|
16
|
+
},
|
|
17
|
+
annotations: {
|
|
18
|
+
readOnlyHint: true,
|
|
19
|
+
openWorldHint: false,
|
|
20
|
+
},
|
|
21
|
+
}, async ({ status }) => {
|
|
22
|
+
const params = status ? `?status=${status}` : "";
|
|
23
|
+
const res = await client.get(`/api/agents${params}`);
|
|
24
|
+
if (res.error) {
|
|
25
|
+
return {
|
|
26
|
+
isError: true,
|
|
27
|
+
content: [{ type: "text", text: formatError(res.error, res.status) }],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const agents = res.data?.agents ?? [];
|
|
31
|
+
if (agents.length === 0) {
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: "No agents found.\n\nTo create your first agent:\n- create_agent_from_prompt — describe what the agent should do and AI generates it\n- create_agent — create a blank agent for manual configuration",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Build a human-readable summary alongside the raw data
|
|
42
|
+
const agentList = agents;
|
|
43
|
+
let text = `## Your Agents (${agentList.length})\n\n`;
|
|
44
|
+
for (const a of agentList) {
|
|
45
|
+
const counts = a._counts;
|
|
46
|
+
const parts = [];
|
|
47
|
+
if (counts?.knowledge_docs)
|
|
48
|
+
parts.push(`${counts.knowledge_docs} docs`);
|
|
49
|
+
if (counts?.tools)
|
|
50
|
+
parts.push(`${counts.tools} tools`);
|
|
51
|
+
if (counts?.channels)
|
|
52
|
+
parts.push(`${counts.channels} channels`);
|
|
53
|
+
const meta = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
54
|
+
text += `- **${a.name}** [${a.status}]${meta}\n ID: ${a.id}\n`;
|
|
55
|
+
if (a.description)
|
|
56
|
+
text += ` ${a.description}\n`;
|
|
57
|
+
}
|
|
58
|
+
text += `\n---\nFull data:\n${JSON.stringify(agentList, null, 2)}`;
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text }],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
// --- get_agent ---
|
|
64
|
+
server.registerTool("get_agent", {
|
|
65
|
+
title: "Get Agent",
|
|
66
|
+
description: "Read full agent configuration: system prompt, personality, model, greeting, tool guidelines, and status. Use list_agents first if you don't have the agent_id.",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
agent_id: z.string().describe("The agent's UUID"),
|
|
69
|
+
},
|
|
70
|
+
annotations: {
|
|
71
|
+
readOnlyHint: true,
|
|
72
|
+
openWorldHint: false,
|
|
73
|
+
},
|
|
74
|
+
}, async ({ agent_id }) => {
|
|
75
|
+
const res = await client.get(`/api/agents/${agent_id}`);
|
|
76
|
+
if (res.error) {
|
|
77
|
+
return {
|
|
78
|
+
isError: true,
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: "text",
|
|
82
|
+
text: formatError(res.error, res.status, "Use list_agents to find valid agent IDs."),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
// --- chat_with_agent ---
|
|
92
|
+
server.registerTool("chat_with_agent", {
|
|
93
|
+
title: "Chat with Agent",
|
|
94
|
+
description: "Send a test message to an agent and get a response. Supports multi-turn conversations via conversation_id. Use this to test agent behavior after making changes.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
agent_id: z.string().describe("The agent's UUID"),
|
|
97
|
+
message: z.string().describe("The message to send to the agent"),
|
|
98
|
+
conversation_id: z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe("Conversation ID for multi-turn. Omit for a new conversation."),
|
|
102
|
+
},
|
|
103
|
+
annotations: {
|
|
104
|
+
readOnlyHint: false,
|
|
105
|
+
openWorldHint: true,
|
|
106
|
+
idempotentHint: false,
|
|
107
|
+
},
|
|
108
|
+
}, async ({ agent_id, message, conversation_id }) => {
|
|
109
|
+
const body = { message };
|
|
110
|
+
if (conversation_id)
|
|
111
|
+
body.conversationId = conversation_id;
|
|
112
|
+
const res = await client.consumeSSE("POST", `/api/agents/${agent_id}/chat`, body);
|
|
113
|
+
if (res.error) {
|
|
114
|
+
return {
|
|
115
|
+
isError: true,
|
|
116
|
+
content: [
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
text: formatError(res.error, res.status, "Verify the agent_id is correct and the agent is active."),
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const text = res.data?.text ?? "No response received.";
|
|
125
|
+
return {
|
|
126
|
+
content: [{ type: "text", text }],
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/tools/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAwB;IAC3E,sBAAsB;IACtB,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;QACE,KAAK,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AAM,CAAC,UAAU,CACjC,MAAM,EACN,eAAe,QAAQ,OAAO,EAC9B,IAAI,CACL,CAAC;QAEF,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,WAAW,CACf,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,MAAM,EACV,yDAAyD,CAC1D;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,uBAAuB,CAAC;QACvD,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations toolset (on-demand) — browse apps, list actions, check connections
|
|
3
|
+
*/
|
|
4
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import type { LaunchPathClient } from "../client.js";
|
|
6
|
+
export declare function registerIntegrationTools(server: McpServer, client: LaunchPathClient): void;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations toolset (on-demand) — browse apps, list actions, check connections
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { formatError } from "../client.js";
|
|
6
|
+
export function registerIntegrationTools(server, client) {
|
|
7
|
+
const integrationsUrl = `${client.dashboardUrl}/dashboard/settings/integrations`;
|
|
8
|
+
// --- browse_integrations ---
|
|
9
|
+
server.registerTool("browse_integrations", {
|
|
10
|
+
title: "Browse Integrations",
|
|
11
|
+
description: 'Browse 900+ available app integrations (Google Calendar, Gmail, Slack, Sheets, HubSpot, etc.). Search by name to find the right app. Returns app slug, auth requirements, and action count. Example: browse_integrations(search: "calendar")',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
search: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Search query to filter apps (e.g., "calendar", "email", "crm")'),
|
|
17
|
+
},
|
|
18
|
+
annotations: {
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
}, async ({ search }) => {
|
|
23
|
+
const params = search ? `?search=${encodeURIComponent(search)}` : "";
|
|
24
|
+
const res = await client.get(`/api/composio/apps${params}`);
|
|
25
|
+
if (res.error) {
|
|
26
|
+
return {
|
|
27
|
+
isError: true,
|
|
28
|
+
content: [{ type: "text", text: formatError(res.error, res.status) }],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const apps = res.data?.apps ?? [];
|
|
32
|
+
if (apps.length === 0) {
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: search
|
|
38
|
+
? `No integrations found matching "${search}". Try a broader search term (e.g., "email" instead of "gmail").`
|
|
39
|
+
: "No integrations available.",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const summary = apps.slice(0, 30).map((a) => ({
|
|
45
|
+
toolkit: a.toolkit,
|
|
46
|
+
name: a.name,
|
|
47
|
+
category: a.category,
|
|
48
|
+
description: a.description,
|
|
49
|
+
requires_auth: !a.noAuth,
|
|
50
|
+
auth_types: a.authSchemes ?? [],
|
|
51
|
+
actions_count: a.toolsCount ?? 0,
|
|
52
|
+
}));
|
|
53
|
+
let text = `Found ${apps.length} integrations${search ? ` matching "${search}"` : ""} (showing first ${summary.length}):\n\n`;
|
|
54
|
+
text += JSON.stringify(summary, null, 2);
|
|
55
|
+
text += `\n\n## Next Steps\n`;
|
|
56
|
+
text += `1. Pick an app from the list above (use the "toolkit" slug value)\n`;
|
|
57
|
+
text += `2. Run list_app_actions(toolkit: "<slug>") to see what actions it can perform\n`;
|
|
58
|
+
text += `3. Run check_connections() to see if the user has already connected this app\n`;
|
|
59
|
+
text += `4. If not connected, the user needs to authorize at: ${integrationsUrl}`;
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text }],
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
// --- list_app_actions ---
|
|
65
|
+
server.registerTool("list_app_actions", {
|
|
66
|
+
title: "List App Actions",
|
|
67
|
+
description: "List all available actions for an integrated app. Shows action slugs (the exact names you need), descriptions, and which ones are most commonly used. Use this to find the exact action names needed for add_agent_tool.",
|
|
68
|
+
inputSchema: {
|
|
69
|
+
toolkit: z
|
|
70
|
+
.string()
|
|
71
|
+
.describe('App toolkit slug from browse_integrations (e.g., "googlecalendar", "gmail", "slack")'),
|
|
72
|
+
include_schemas: z
|
|
73
|
+
.boolean()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("Include full parameter schemas for each action. Set to true if you need to understand what inputs each action requires. Default: false."),
|
|
76
|
+
},
|
|
77
|
+
annotations: {
|
|
78
|
+
readOnlyHint: true,
|
|
79
|
+
openWorldHint: true,
|
|
80
|
+
},
|
|
81
|
+
}, async ({ toolkit, include_schemas }) => {
|
|
82
|
+
const params = new URLSearchParams({ toolkit });
|
|
83
|
+
if (include_schemas)
|
|
84
|
+
params.set("include_schemas", "true");
|
|
85
|
+
const res = await client.get(`/api/composio/tools?${params.toString()}`);
|
|
86
|
+
if (res.error) {
|
|
87
|
+
return {
|
|
88
|
+
isError: true,
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: formatError(res.error, res.status, "Verify the toolkit slug is correct. Use browse_integrations to find valid slugs."),
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const tools = res.data?.tools ?? [];
|
|
98
|
+
if (tools.length === 0) {
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: `No actions found for app "${toolkit}". Verify the slug with browse_integrations.`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const important = tools.filter((t) => t.isImportant);
|
|
109
|
+
const other = tools.filter((t) => !t.isImportant);
|
|
110
|
+
let text = `## Actions for "${toolkit}" (${tools.length} total, ${important.length} recommended)\n\n`;
|
|
111
|
+
if (important.length > 0) {
|
|
112
|
+
text += `### Recommended actions (most commonly used):\n${JSON.stringify(important, null, 2)}\n\n`;
|
|
113
|
+
}
|
|
114
|
+
if (other.length > 0) {
|
|
115
|
+
text += `### Other available actions:\n${JSON.stringify(other, null, 2)}\n\n`;
|
|
116
|
+
}
|
|
117
|
+
text += `## How to add this to an agent\n\n`;
|
|
118
|
+
text += `1. First, check the user has connected this app: check_connections()\n`;
|
|
119
|
+
text += ` - If NOT connected, they need to authorize at: ${integrationsUrl}\n`;
|
|
120
|
+
text += ` - OAuth apps (Google, Slack, GitHub) require browser authorization — this cannot be done from the terminal\n\n`;
|
|
121
|
+
text += `2. Once connected, enable the tools-config toolset: enable_toolset("tools-config")\n\n`;
|
|
122
|
+
text += `3. Then add the integration to the agent:\n`;
|
|
123
|
+
text += ` add_agent_tool(\n`;
|
|
124
|
+
text += ` agent_id: "<agent_id>",\n`;
|
|
125
|
+
text += ` tool_type: "integration",\n`;
|
|
126
|
+
text += ` display_name: "${toolkit}",\n`;
|
|
127
|
+
text += ` description: "What this integration does for the agent",\n`;
|
|
128
|
+
text += ` config: {\n`;
|
|
129
|
+
text += ` toolkit: "${toolkit}",\n`;
|
|
130
|
+
text += ` toolkit_name: "${tools[0]?.name?.split(" ")[0] ?? toolkit}",\n`;
|
|
131
|
+
text += ` enabled_actions: [${important.slice(0, 3).map((t) => `"${t.slug}"`).join(", ")}]\n`;
|
|
132
|
+
text += ` }\n`;
|
|
133
|
+
text += ` )\n\n`;
|
|
134
|
+
text += `4. Finally, update the agent's tool_guidelines with instructions on when and how to use these actions.`;
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text }],
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
// --- check_connections ---
|
|
140
|
+
server.registerTool("check_connections", {
|
|
141
|
+
title: "Check App Connections",
|
|
142
|
+
description: "Check which app integrations the user has authorized (Google Calendar, Gmail, Slack, etc.). Integrations won't work unless the user has an active connection. If a connection is missing, provide the dashboard URL for them to connect.",
|
|
143
|
+
inputSchema: {},
|
|
144
|
+
annotations: {
|
|
145
|
+
readOnlyHint: true,
|
|
146
|
+
openWorldHint: true,
|
|
147
|
+
},
|
|
148
|
+
}, async () => {
|
|
149
|
+
const res = await client.get("/api/composio/connections");
|
|
150
|
+
if (res.error) {
|
|
151
|
+
return {
|
|
152
|
+
isError: true,
|
|
153
|
+
content: [{ type: "text", text: formatError(res.error, res.status) }],
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const connections = res.data?.connections ?? [];
|
|
157
|
+
if (connections.length === 0) {
|
|
158
|
+
return {
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: "text",
|
|
162
|
+
text: `No app integrations connected yet.\n\nTo connect apps like Google Calendar, Gmail, Slack, etc., the user needs to:\n\n1. Open this URL in their browser: ${integrationsUrl}\n2. Click on the app they want to connect\n3. Complete the authorization (sign in with Google, etc.)\n4. Come back here and run check_connections() again to verify\n\nThis is required because these apps use OAuth, which needs a browser for the secure sign-in flow.`,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const active = connections.filter((c) => c.status === "active");
|
|
168
|
+
const pending = connections.filter((c) => c.status !== "active");
|
|
169
|
+
let text = `## Connected Apps\n\n`;
|
|
170
|
+
text += `**${active.length} active** | ${pending.length} pending\n\n`;
|
|
171
|
+
for (const c of connections) {
|
|
172
|
+
const icon = c.status === "active" ? "✅" : "⏳";
|
|
173
|
+
const label = c.account_label ? ` (${c.account_label})` : "";
|
|
174
|
+
text += `${icon} **${c.toolkit}**${label} — ${c.status}`;
|
|
175
|
+
if (c.connected_at)
|
|
176
|
+
text += ` (connected ${c.connected_at})`;
|
|
177
|
+
text += `\n`;
|
|
178
|
+
}
|
|
179
|
+
if (pending.length > 0) {
|
|
180
|
+
text += `\nPending connections may need re-authorization at: ${integrationsUrl}`;
|
|
181
|
+
}
|
|
182
|
+
text += `\n\nTo connect additional apps: ${integrationsUrl}`;
|
|
183
|
+
return {
|
|
184
|
+
content: [{ type: "text", text }],
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=integrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,UAAU,wBAAwB,CACtC,MAAiB,EACjB,MAAwB;IAExB,MAAM,eAAe,GAAG,GAAG,MAAM,CAAC,YAAY,kCAAkC,CAAC;IAEjF,8BAA8B;IAC9B,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,8OAA8O;QAChP,WAAW,EAAE;YACX,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,gEAAgE,CACjE;SACJ;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,IAAI;SACpB;KACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GA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IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,IAAI,uDAAuD,eAAe,EAAE,CAAC;QACnF,CAAC;QAED,IAAI,IAAI,mCAAmC,eAAe,EAAE,CAAC;QAE7D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge toolset (default) — list, scrape, discover_pages, add_faq, edit_faq,
|
|
3
|
+
* generate_faqs, delete, clear_knowledge
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import type { LaunchPathClient } from "../client.js";
|
|
7
|
+
export declare function registerKnowledgeTools(server: McpServer, client: LaunchPathClient): void;
|