@botuyo/mcp 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.
Files changed (38) hide show
  1. package/README.md +93 -0
  2. package/dist/client.d.ts +36 -0
  3. package/dist/client.js +84 -0
  4. package/dist/client.js.map +1 -0
  5. package/dist/index.d.ts +19 -0
  6. package/dist/index.js +86 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/tools/create_agent.d.ts +4 -0
  9. package/dist/tools/create_agent.js +21 -0
  10. package/dist/tools/create_agent.js.map +1 -0
  11. package/dist/tools/get_agent.d.ts +4 -0
  12. package/dist/tools/get_agent.js +16 -0
  13. package/dist/tools/get_agent.js.map +1 -0
  14. package/dist/tools/get_agent_status.d.ts +4 -0
  15. package/dist/tools/get_agent_status.js +16 -0
  16. package/dist/tools/get_agent_status.js.map +1 -0
  17. package/dist/tools/index.d.ts +8 -0
  18. package/dist/tools/index.js +36 -0
  19. package/dist/tools/index.js.map +1 -0
  20. package/dist/tools/list_agents.d.ts +4 -0
  21. package/dist/tools/list_agents.js +10 -0
  22. package/dist/tools/list_agents.js.map +1 -0
  23. package/dist/tools/list_available_tools.d.ts +4 -0
  24. package/dist/tools/list_available_tools.js +9 -0
  25. package/dist/tools/list_available_tools.js.map +1 -0
  26. package/dist/tools/publish_agent.d.ts +4 -0
  27. package/dist/tools/publish_agent.js +17 -0
  28. package/dist/tools/publish_agent.js.map +1 -0
  29. package/dist/tools/update_agent.d.ts +4 -0
  30. package/dist/tools/update_agent.js +33 -0
  31. package/dist/tools/update_agent.js.map +1 -0
  32. package/dist/tools/update_enabled_tools.d.ts +4 -0
  33. package/dist/tools/update_enabled_tools.js +27 -0
  34. package/dist/tools/update_enabled_tools.js.map +1 -0
  35. package/dist/tools/upsert_stage.d.ts +4 -0
  36. package/dist/tools/upsert_stage.js +39 -0
  37. package/dist/tools/upsert_stage.js.map +1 -0
  38. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @botuyo/mcp — BotUyo MCP Server
2
+
3
+ Create and manage BotUyo AI agents directly from your AI coding tools — **no cloning, no building**.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@botuyo/mcp.svg)](https://www.npmjs.com/package/@botuyo/mcp)
6
+
7
+ ## Quickstart
8
+
9
+ ### 1. Get your API Key
10
+
11
+ Go to [admin.botuyo.com](https://admin.botuyo.com) → your tenant → **Settings → API Keys** and copy your `pk_live_...` key.
12
+
13
+ ### 2. Add to your MCP client
14
+
15
+ The config is the same for **all MCP-compatible tools**:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "botuyo": {
21
+ "command": "npx",
22
+ "args": ["-y", "@botuyo/mcp"],
23
+ "env": {
24
+ "BOTUYO_API_KEY": "pk_live_your_key_here"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ **Where to put this config:**
32
+
33
+ | Tool | Config file |
34
+ |---|---|
35
+ | **Antigravity (VS Code)** | VS Code settings → MCP → Add server |
36
+ | **Claude Desktop** | `~/.config/claude/claude_desktop_config.json` |
37
+ | **Cursor** | `.cursor/mcp.json` in your project |
38
+ | **Windsurf** | `~/.codeium/windsurf/mcp_config.json` |
39
+ | **Continue** | `.continue/config.json` |
40
+
41
+ ### 3. Start building agents
42
+
43
+ Once connected, ask your AI assistant things like:
44
+
45
+ > *"Create a new agent called 'Soporte' for my tenant"*
46
+ > *"Update Mar's objective to focus on sales"*
47
+ > *"Add a welcomeStage that greets guests in Spanish"*
48
+ > *"Enable the EscalateToHuman and SearchKnowledgeBase tools on Mar"*
49
+ > *"Publish the agent"*
50
+
51
+ ## Available Tools
52
+
53
+ | Tool | Description | Role Required |
54
+ |---|---|---|
55
+ | `list_agents` | List all agents | viewer+ |
56
+ | `get_agent` | Get full agent config | viewer+ |
57
+ | `get_agent_status` | Channel status + admin link | viewer+ |
58
+ | `create_agent` | Create a new agent | developer+ |
59
+ | `update_agent` | Update identity (tone, language, etc.) | developer+ |
60
+ | `upsert_stage` | Create/edit a conversation stage | developer+ |
61
+ | `list_available_tools` | List tools available to your tenant | viewer+ |
62
+ | `update_enabled_tools` | Enable/disable tools on an agent | developer+ |
63
+ | `publish_agent` | Publish or unpublish an agent | developer+ |
64
+
65
+ ## Roles
66
+
67
+ | Role | Read | Write | Publish |
68
+ |---|---|---|---|
69
+ | `owner` | ✅ | ✅ | ✅ |
70
+ | `admin` | ✅ | ✅ | ✅ |
71
+ | `developer` | ✅ | ✅ | ✅ |
72
+ | `viewer` | ✅ | ❌ | ❌ |
73
+
74
+ ## Channel Integrations
75
+
76
+ Connecting channels (WhatsApp, Instagram, Telegram, Web) must be done from [admin.botuyo.com](https://admin.botuyo.com) — they require interactive flows (QR scans, OAuth, etc.).
77
+
78
+ Use `get_agent_status` to check which channels are connected. It returns a direct link to the admin panel for any missing channel.
79
+
80
+ ## Build from source
81
+
82
+ ```sh
83
+ cd packages/mcp
84
+ npm install
85
+ npm run build
86
+ ```
87
+
88
+ ## Test with MCP Inspector
89
+
90
+ ```sh
91
+ cd packages/mcp
92
+ BOTUYO_API_KEY=pk_live_... npm run inspect
93
+ ```
@@ -0,0 +1,36 @@
1
+ /**
2
+ * BotuyoApiClient - Thin HTTP wrapper around the BotUyo REST API
3
+ * All MCP tools go through this client.
4
+ */
5
+ export interface BotuyoClientConfig {
6
+ apiUrl: string;
7
+ apiKey: string;
8
+ }
9
+ export interface AuthResult {
10
+ token: string;
11
+ tenantId: string;
12
+ tenantName: string;
13
+ role: string;
14
+ canWrite: boolean;
15
+ channels: Array<{
16
+ type: string;
17
+ status: string;
18
+ }>;
19
+ adminPanelUrl: string;
20
+ }
21
+ export declare class BotuyoApiClient {
22
+ private config;
23
+ private token;
24
+ private authResult;
25
+ private tokenExpiresAt;
26
+ constructor(config: BotuyoClientConfig);
27
+ /** Exchange API key for a JWT and cache it for 55 minutes */
28
+ authenticate(): Promise<AuthResult>;
29
+ /** Make an authenticated GET request */
30
+ get<T = any>(path: string): Promise<T>;
31
+ /** Make an authenticated POST request */
32
+ post<T = any>(path: string, data: unknown): Promise<T>;
33
+ /** Make an authenticated PUT request */
34
+ put<T = any>(path: string, data: unknown): Promise<T>;
35
+ private parseJson;
36
+ }
package/dist/client.js ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * BotuyoApiClient - Thin HTTP wrapper around the BotUyo REST API
3
+ * All MCP tools go through this client.
4
+ */
5
+ import fetch from 'node-fetch';
6
+ export class BotuyoApiClient {
7
+ config;
8
+ token = null;
9
+ authResult = null;
10
+ tokenExpiresAt = 0;
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+ /** Exchange API key for a JWT and cache it for 55 minutes */
15
+ async authenticate() {
16
+ const now = Date.now();
17
+ if (this.token && this.authResult && now < this.tokenExpiresAt) {
18
+ return this.authResult;
19
+ }
20
+ const res = await fetch(`${this.config.apiUrl}/api/v1/mcp/auth`, {
21
+ method: 'POST',
22
+ headers: {
23
+ 'x-api-key': this.config.apiKey,
24
+ 'Content-Type': 'application/json'
25
+ }
26
+ });
27
+ const body = await this.parseJson(res);
28
+ if (!body.success) {
29
+ throw new Error(`Authentication failed: ${body.error || 'Unknown error'}`);
30
+ }
31
+ this.token = body.data.token;
32
+ this.authResult = body.data;
33
+ this.tokenExpiresAt = now + 55 * 60 * 1000; // 55 min (token expires in 1h)
34
+ return this.authResult;
35
+ }
36
+ /** Make an authenticated GET request */
37
+ async get(path) {
38
+ await this.authenticate();
39
+ const res = await fetch(`${this.config.apiUrl}${path}`, {
40
+ headers: { Authorization: `Bearer ${this.token}` }
41
+ });
42
+ return this.parseJson(res);
43
+ }
44
+ /** Make an authenticated POST request */
45
+ async post(path, data) {
46
+ await this.authenticate();
47
+ const res = await fetch(`${this.config.apiUrl}${path}`, {
48
+ method: 'POST',
49
+ headers: {
50
+ Authorization: `Bearer ${this.token}`,
51
+ 'Content-Type': 'application/json'
52
+ },
53
+ body: JSON.stringify(data)
54
+ });
55
+ return this.parseJson(res);
56
+ }
57
+ /** Make an authenticated PUT request */
58
+ async put(path, data) {
59
+ await this.authenticate();
60
+ const res = await fetch(`${this.config.apiUrl}${path}`, {
61
+ method: 'PUT',
62
+ headers: {
63
+ Authorization: `Bearer ${this.token}`,
64
+ 'Content-Type': 'application/json'
65
+ },
66
+ body: JSON.stringify(data)
67
+ });
68
+ return this.parseJson(res);
69
+ }
70
+ async parseJson(res) {
71
+ const text = await res.text();
72
+ try {
73
+ const json = JSON.parse(text);
74
+ if (!res.ok && !json.success) {
75
+ throw new Error(json.error || `HTTP ${res.status}`);
76
+ }
77
+ return json;
78
+ }
79
+ catch (e) {
80
+ throw new Error(`HTTP ${res.status}: ${text.slice(0, 200)}`);
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmB,MAAM,YAAY,CAAA;AAiB5C,MAAM,OAAO,eAAe;IAClB,MAAM,CAAoB;IAC1B,KAAK,GAAkB,IAAI,CAAA;IAC3B,UAAU,GAAsB,IAAI,CAAA;IACpC,cAAc,GAAW,CAAC,CAAA;IAElC,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,YAAY;QAChB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,IAAI,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,kBAAkB,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM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3
+ * BotUyo MCP Server — Entry Point
4
+ *
5
+ * Usage (Claude Desktop / Cursor config):
6
+ * {
7
+ * "mcpServers": {
8
+ * "botuyo": {
9
+ * "command": "node",
10
+ * "args": ["/path/to/packages/mcp/dist/index.js"],
11
+ * "env": {
12
+ * "BOTUYO_API_KEY": "pk_live_...",
13
+ * "BOTUYO_API_URL": "https://api.botuyo.com" // optional, defaults to production
14
+ * }
15
+ * }
16
+ * }
17
+ * }
18
+ */
19
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * BotUyo MCP Server — Entry Point
4
+ *
5
+ * Usage (Claude Desktop / Cursor config):
6
+ * {
7
+ * "mcpServers": {
8
+ * "botuyo": {
9
+ * "command": "node",
10
+ * "args": ["/path/to/packages/mcp/dist/index.js"],
11
+ * "env": {
12
+ * "BOTUYO_API_KEY": "pk_live_...",
13
+ * "BOTUYO_API_URL": "https://api.botuyo.com" // optional, defaults to production
14
+ * }
15
+ * }
16
+ * }
17
+ * }
18
+ */
19
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
20
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
21
+ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
22
+ import { BotuyoApiClient } from './client.js';
23
+ import { ALL_TOOLS, TOOL_HANDLERS } from './tools/index.js';
24
+ // ─── Config ────────────────────────────────────────────────────────────────────
25
+ const API_KEY = process.env.BOTUYO_API_KEY;
26
+ const API_URL = process.env.BOTUYO_API_URL || 'https://api.botuyo.com';
27
+ if (!API_KEY) {
28
+ console.error('[botuyo-mcp] Error: BOTUYO_API_KEY environment variable is required');
29
+ process.exit(1);
30
+ }
31
+ // ─── Client ────────────────────────────────────────────────────────────────────
32
+ const client = new BotuyoApiClient({ apiKey: API_KEY, apiUrl: API_URL });
33
+ // ─── MCP Server ────────────────────────────────────────────────────────────────
34
+ const server = new Server({ name: 'botuyo-mcp', version: '0.1.0' }, { capabilities: { tools: {} } });
35
+ /** List all available MCP tools */
36
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
37
+ tools: ALL_TOOLS
38
+ }));
39
+ /** Dispatch tool calls */
40
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
41
+ const { name, arguments: args } = request.params;
42
+ const handler = TOOL_HANDLERS[name];
43
+ if (!handler) {
44
+ return {
45
+ content: [{ type: 'text', text: `Unknown tool: ${name}` }],
46
+ isError: true
47
+ };
48
+ }
49
+ try {
50
+ const result = await handler(client, args || {});
51
+ return {
52
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
53
+ };
54
+ }
55
+ catch (error) {
56
+ const msg = error instanceof Error ? error.message : String(error);
57
+ return {
58
+ content: [{ type: 'text', text: `Error: ${msg}` }],
59
+ isError: true
60
+ };
61
+ }
62
+ });
63
+ // ─── Start ─────────────────────────────────────────────────────────────────────
64
+ async function main() {
65
+ // Verify credentials on startup
66
+ try {
67
+ const auth = await client.authenticate();
68
+ console.error(`[botuyo-mcp] ✓ Connected to tenant "${auth.tenantName}" as ${auth.role}`);
69
+ if (!auth.canWrite) {
70
+ console.error('[botuyo-mcp] ⚠ Your role is viewer — write operations will be rejected');
71
+ }
72
+ }
73
+ catch (err) {
74
+ const msg = err instanceof Error ? err.message : String(err);
75
+ console.error(`[botuyo-mcp] ✗ Auth failed: ${msg}`);
76
+ process.exit(1);
77
+ }
78
+ const transport = new StdioServerTransport();
79
+ await server.connect(transport);
80
+ console.error('[botuyo-mcp] Server running via stdio');
81
+ }
82
+ main().catch((err) => {
83
+ console.error('[botuyo-mcp] Fatal error:', err);
84
+ process.exit(1);
85
+ });
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,O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AC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC5D,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAA;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC/B,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAA;AACxD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const CREATE_AGENT_TOOL: Tool;
4
+ export declare function createAgentHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,21 @@
1
+ export const CREATE_AGENT_TOOL = {
2
+ name: 'create_agent',
3
+ description: 'Create a new agent for the tenant. The agent is created in "draft" status. Use update_agent to configure identity, stages, and tools afterward. Requires role: owner, admin, or developer.',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ name: { type: 'string', description: 'Display name of the agent (e.g. "Mar 🌊")' },
8
+ description: { type: 'string', description: 'Brief description of what this agent does' },
9
+ type: { type: 'string', description: 'Agent type. Use "agent" (default)', enum: ['agent'] }
10
+ },
11
+ required: ['name']
12
+ }
13
+ };
14
+ export async function createAgentHandler(client, args) {
15
+ return client.post('/api/v1/mcp/agents', {
16
+ name: args.name,
17
+ description: args.description || '',
18
+ type: args.type || 'agent'
19
+ });
20
+ }
21
+ //# sourceMappingURL=create_agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_agent.js","sourceRoot":"","sources":["../../src/tools/create_agent.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,4LAA4L;IACzM,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;YAClF,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;YACzF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE;SAC5F;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB,EAAE,IAA6B;IAC7F,OAAO,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE;QACvC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;QACnC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO;KAC3B,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const GET_AGENT_TOOL: Tool;
4
+ export declare function getAgentHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,16 @@
1
+ export const GET_AGENT_TOOL = {
2
+ name: 'get_agent',
3
+ description: 'Get the full configuration of a specific agent, including identity (tone, language, objective, customInstructions), stages, and enabled tools.',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' }
8
+ },
9
+ required: ['agentId']
10
+ }
11
+ };
12
+ export async function getAgentHandler(client, args) {
13
+ const agentId = args.agentId;
14
+ return client.get(`/api/v1/mcp/agents/${agentId}`);
15
+ }
16
+ //# sourceMappingURL=get_agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_agent.js","sourceRoot":"","sources":["../../src/tools/get_agent.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,gJAAgJ;IAC7J,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;SACxE;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAuB,EAAE,IAA6B;IAC1F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiB,CAAA;IACtC,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;AACpD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const GET_AGENT_STATUS_TOOL: Tool;
4
+ export declare function getAgentStatusHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,16 @@
1
+ export const GET_AGENT_STATUS_TOOL = {
2
+ name: 'get_agent_status',
3
+ description: 'Get the channel connection status of an agent (WhatsApp, Instagram, Telegram, Web). Shows which channels are connected and provides a direct link to the admin panel to connect missing channels.',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' }
8
+ },
9
+ required: ['agentId']
10
+ }
11
+ };
12
+ export async function getAgentStatusHandler(client, args) {
13
+ const agentId = args.agentId;
14
+ return client.get(`/api/v1/mcp/agents/${agentId}/status`);
15
+ }
16
+ //# sourceMappingURL=get_agent_status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_agent_status.js","sourceRoot":"","sources":["../../src/tools/get_agent_status.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mMAAmM;IAChN,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;SACxE;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAuB,EAAE,IAA6B;IAChG,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiB,CAAA;IACtC,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAO,SAAS,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * MCP Tools Registry — exports ALL_TOOLS and TOOL_HANDLERS
3
+ */
4
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
5
+ import type { BotuyoApiClient } from '../client.js';
6
+ export declare const ALL_TOOLS: Tool[];
7
+ export type ToolHandler = (client: BotuyoApiClient, args: Record<string, unknown>) => Promise<unknown>;
8
+ export declare const TOOL_HANDLERS: Record<string, ToolHandler>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * MCP Tools Registry — exports ALL_TOOLS and TOOL_HANDLERS
3
+ */
4
+ // Import all tool definitions
5
+ import { LIST_AGENTS_TOOL, listAgentsHandler } from './list_agents.js';
6
+ import { GET_AGENT_TOOL, getAgentHandler } from './get_agent.js';
7
+ import { GET_AGENT_STATUS_TOOL, getAgentStatusHandler } from './get_agent_status.js';
8
+ import { CREATE_AGENT_TOOL, createAgentHandler } from './create_agent.js';
9
+ import { UPDATE_AGENT_TOOL, updateAgentHandler } from './update_agent.js';
10
+ import { UPSERT_STAGE_TOOL, upsertStageHandler } from './upsert_stage.js';
11
+ import { LIST_TOOLS_TOOL, listToolsHandler } from './list_available_tools.js';
12
+ import { UPDATE_ENABLED_TOOLS_TOOL, updateEnabledToolsHandler } from './update_enabled_tools.js';
13
+ import { PUBLISH_AGENT_TOOL, publishAgentHandler } from './publish_agent.js';
14
+ export const ALL_TOOLS = [
15
+ LIST_AGENTS_TOOL,
16
+ GET_AGENT_TOOL,
17
+ GET_AGENT_STATUS_TOOL,
18
+ CREATE_AGENT_TOOL,
19
+ UPDATE_AGENT_TOOL,
20
+ UPSERT_STAGE_TOOL,
21
+ LIST_TOOLS_TOOL,
22
+ UPDATE_ENABLED_TOOLS_TOOL,
23
+ PUBLISH_AGENT_TOOL,
24
+ ];
25
+ export const TOOL_HANDLERS = {
26
+ list_agents: listAgentsHandler,
27
+ get_agent: getAgentHandler,
28
+ get_agent_status: getAgentStatusHandler,
29
+ create_agent: createAgentHandler,
30
+ update_agent: updateAgentHandler,
31
+ upsert_stage: upsertStageHandler,
32
+ list_available_tools: listToolsHandler,
33
+ update_enabled_tools: updateEnabledToolsHandler,
34
+ publish_agent: publishAgentHandler,
35
+ };
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B,gBAAgB;IAChB,cAAc;IACd,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,yBAAyB;IACzB,kBAAkB;CACnB,CAAA;AAID,MAAM,CAAC,MAAM,aAAa,GAAgC;IACxD,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,eAAe;IAC1B,gBAAgB,EAAE,qBAAqB;IACvC,YAAY,EAAE,kBAAkB;IAChC,YAAY,EAAE,kBAAkB;IAChC,YAAY,EAAE,kBAAkB;IAChC,oBAAoB,EAAE,gBAAgB;IACtC,oBAAoB,EAAE,yBAAyB;IAC/C,aAAa,EAAE,mBAAmB;CACnC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const LIST_AGENTS_TOOL: Tool;
4
+ export declare function listAgentsHandler(client: BotuyoApiClient, _args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,10 @@
1
+ export const LIST_AGENTS_TOOL = {
2
+ name: 'list_agents',
3
+ description: 'Lists all agents for the authenticated tenant. Returns id, name, description, status (draft/published), and how many tools each agent has enabled.',
4
+ inputSchema: { type: 'object', properties: {}, required: [] }
5
+ };
6
+ export async function listAgentsHandler(client, _args) {
7
+ const res = await client.get('/api/v1/mcp/agents');
8
+ return res;
9
+ }
10
+ //# sourceMappingURL=list_agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list_agents.js","sourceRoot":"","sources":["../../src/tools/list_agents.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oJAAoJ;IACjK,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;CAC9D,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAuB,EAAE,KAA8B;IAC7F,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAClD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const LIST_TOOLS_TOOL: Tool;
4
+ export declare function listToolsHandler(client: BotuyoApiClient, _args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,9 @@
1
+ export const LIST_TOOLS_TOOL = {
2
+ name: 'list_available_tools',
3
+ description: 'List all tools available for this tenant. Returns both "core" tools (available to all tenants) and "tenant" tools (custom tools specific to your tenant). Use tool IDs when enabling tools with update_enabled_tools or configuring stage tools.',
4
+ inputSchema: { type: 'object', properties: {}, required: [] }
5
+ };
6
+ export async function listToolsHandler(client, _args) {
7
+ return client.get('/api/v1/mcp/tools');
8
+ }
9
+ //# sourceMappingURL=list_available_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list_available_tools.js","sourceRoot":"","sources":["../../src/tools/list_available_tools.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,kPAAkP;IAC/P,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;CAC9D,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAuB,EAAE,KAA8B;IAC5F,OAAO,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AACxC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const PUBLISH_AGENT_TOOL: Tool;
4
+ export declare function publishAgentHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,17 @@
1
+ export const PUBLISH_AGENT_TOOL = {
2
+ name: 'publish_agent',
3
+ description: 'Publish or unpublish an agent. Published agents are live and handle incoming conversations. Unpublished agents are in "draft" status.\n\nRequires role: owner, admin, or developer.',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' },
8
+ publish: { type: 'boolean', description: 'true = publish (go live), false = unpublish (back to draft)' }
9
+ },
10
+ required: ['agentId', 'publish']
11
+ }
12
+ };
13
+ export async function publishAgentHandler(client, args) {
14
+ const { agentId, publish } = args;
15
+ return client.put(`/api/v1/mcp/agents/${agentId}/publish`, { publish });
16
+ }
17
+ //# sourceMappingURL=publish_agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish_agent.js","sourceRoot":"","sources":["../../src/tools/publish_agent.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qLAAqL;IAClM,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACvE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6DAA6D,EAAE;SACzG;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAuB,EAAE,IAA6B;IAC9F,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAiB,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;AACnF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const UPDATE_AGENT_TOOL: Tool;
4
+ export declare function updateAgentHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,33 @@
1
+ export const UPDATE_AGENT_TOOL = {
2
+ name: 'update_agent',
3
+ description: `Update an agent's identity configuration (tone, language, objective, custom instructions) and/or top-level name/description.
4
+
5
+ Use this to configure WHO the agent is. For defining WHAT the agent does in each conversation flow, use upsert_stage.
6
+ For changing which tools the agent can call, use update_enabled_tools.
7
+
8
+ Requires role: owner, admin, or developer.`,
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' },
13
+ name: { type: 'string', description: 'Agent display name' },
14
+ description: { type: 'string', description: 'Agent description' },
15
+ identity: {
16
+ type: 'object',
17
+ description: 'Identity configuration for the agent',
18
+ properties: {
19
+ tone: { type: 'string', description: 'Personality tone (e.g. "Cálida, experta, persuasiva con FOMO natural")' },
20
+ language: { type: 'string', description: 'BCP-47 language code (e.g. "es-AR", "en-US", "pt-BR")' },
21
+ objective: { type: 'string', description: 'Primary objective of the agent' },
22
+ customInstructions: { type: 'string', description: 'Custom instructions that override default behavior. Supports markdown.' }
23
+ }
24
+ }
25
+ },
26
+ required: ['agentId']
27
+ }
28
+ };
29
+ export async function updateAgentHandler(client, args) {
30
+ const { agentId, ...rest } = args;
31
+ return client.put(`/api/v1/mcp/agents/${agentId}`, rest);
32
+ }
33
+ //# sourceMappingURL=update_agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update_agent.js","sourceRoot":"","sources":["../../src/tools/update_agent.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE;;;;;2CAK4B;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACvE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;YAC3D,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;gBACnD,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wEAAwE,EAAE;oBAC/G,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uDAAuD,EAAE;oBAClG,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;oBAC5E,kBAAkB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wEAAwE,EAAE;iBAC9H;aACF;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB,EAAE,IAA6B;IAC7F,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAiB,EAAE,EAAE,IAAI,CAAC,CAAA;AACpE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const UPDATE_ENABLED_TOOLS_TOOL: Tool;
4
+ export declare function updateEnabledToolsHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,27 @@
1
+ export const UPDATE_ENABLED_TOOLS_TOOL = {
2
+ name: 'update_enabled_tools',
3
+ description: `Set which tools are enabled for an agent. This REPLACES the current list of enabled tools.
4
+
5
+ Use list_available_tools to see the valid tool IDs for your tenant first.
6
+
7
+ Requires role: owner, admin, or developer.`,
8
+ inputSchema: {
9
+ type: 'object',
10
+ properties: {
11
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' },
12
+ toolIds: {
13
+ type: 'array',
14
+ items: { type: 'string' },
15
+ description: 'Array of tool IDs to enable (replaces current list). Get valid IDs from list_available_tools.'
16
+ }
17
+ },
18
+ required: ['agentId', 'toolIds']
19
+ }
20
+ };
21
+ export async function updateEnabledToolsHandler(client, args) {
22
+ const { agentId, toolIds } = args;
23
+ return client.put(`/api/v1/mcp/agents/${agentId}`, {
24
+ enabledTools: toolIds
25
+ });
26
+ }
27
+ //# sourceMappingURL=update_enabled_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update_enabled_tools.js","sourceRoot":"","sources":["../../src/tools/update_enabled_tools.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,yBAAyB,GAAS;IAC7C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE;;;;2CAI4B;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACvE,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,+FAA+F;aAC7G;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,MAAuB,EAAE,IAA6B;IACpG,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAiB,EAAE,EAAE;QAC3D,YAAY,EAAE,OAAO;KACtB,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { BotuyoApiClient } from '../client.js';
3
+ export declare const UPSERT_STAGE_TOOL: Tool;
4
+ export declare function upsertStageHandler(client: BotuyoApiClient, args: Record<string, unknown>): Promise<any>;
@@ -0,0 +1,39 @@
1
+ export const UPSERT_STAGE_TOOL = {
2
+ name: 'upsert_stage',
3
+ description: `Create or update a named stage in an agent's conversation flow.
4
+
5
+ A stage defines what the agent does at a particular step in the conversation.
6
+ Each stage has a list of "actions" that the agent can take (send_message, use_tool, go_to_stage, etc.).
7
+
8
+ Examples of stage names: "welcomeStage", "salesStage", "hostStage", "checkoutStage"
9
+
10
+ The stage config is merged with existing stages — existing stages you don't specify are kept unchanged.
11
+
12
+ Requires role: owner, admin, or developer.`,
13
+ inputSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ agentId: { type: 'string', description: 'The MongoDB ID of the agent' },
17
+ stageName: { type: 'string', description: 'Name key for this stage (e.g. "welcomeStage", "salesStage")' },
18
+ stageConfig: {
19
+ type: 'object',
20
+ description: 'Full stage configuration object. See BotUyo stage schema for full details.',
21
+ properties: {
22
+ label: { type: 'string', description: 'Human-readable label for this stage' },
23
+ instruction: { type: 'string', description: 'Instructions for the AI in this stage' },
24
+ tools: { type: 'array', items: { type: 'string' }, description: 'Tool IDs available in this stage' },
25
+ trigger: { type: 'string', description: 'Optional trigger condition' },
26
+ channels: { type: 'array', items: { type: 'string' }, description: 'Channels where this stage is active' }
27
+ }
28
+ }
29
+ },
30
+ required: ['agentId', 'stageName', 'stageConfig']
31
+ }
32
+ };
33
+ export async function upsertStageHandler(client, args) {
34
+ const { agentId, stageName, stageConfig } = args;
35
+ return client.put(`/api/v1/mcp/agents/${agentId}`, {
36
+ stages: { [stageName]: stageConfig }
37
+ });
38
+ }
39
+ //# sourceMappingURL=upsert_stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsert_stage.js","sourceRoot":"","sources":["../../src/tools/upsert_stage.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE;;;;;;;;;2CAS4B;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;YACvE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;YACzG,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4EAA4E;gBACzF,UAAU,EAAE;oBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;oBAC7E,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uCAAuC,EAAE;oBACrF,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE;oBACpG,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;oBACtE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,qCAAqC,EAAE;iBAC3G;aACF;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC;KAClD;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB,EAAE,IAA6B;IAC7F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAChD,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAiB,EAAE,EAAE;QAC3D,MAAM,EAAE,EAAE,CAAC,SAAmB,CAAC,EAAE,WAAW,EAAE;KAC/C,CAAC,CAAA;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@botuyo/mcp",
3
+ "version": "0.1.0",
4
+ "description": "BotUyo MCP Server — create and manage AI agents via Model Context Protocol",
5
+ "keywords": ["mcp", "botuyo", "ai-agents", "chatbot", "model-context-protocol"],
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "bin": {
9
+ "botuyo-mcp": "dist/index.js"
10
+ },
11
+ "files": ["dist", "README.md"],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc -w",
15
+ "start": "node dist/index.js",
16
+ "inspect": "npx @modelcontextprotocol/inspector node dist/index.js",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@modelcontextprotocol/sdk": "^1.7.0",
24
+ "node-fetch": "^3.3.2",
25
+ "zod": "^3.22.4"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.0.0",
29
+ "typescript": "^5.3.3"
30
+ },
31
+ "engines": {
32
+ "node": ">=18"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/MarcoAR1/botuyo-backend.git",
37
+ "directory": "packages/mcp"
38
+ },
39
+ "homepage": "https://botuyo.com",
40
+ "license": "MIT"
41
+ }