@chandshantanu/agentbuilder-mcp-server 0.2.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/.env.example +7 -0
- package/AGENT_CREATION_GUIDE.md +724 -0
- package/AGENT_CREATION_TEST_PLAN.md +514 -0
- package/AGENT_DEPLOYMENT_GUIDE.md +509 -0
- package/GETTING_STARTED.md +435 -0
- package/LOCAL_DEVELOPMENT_TESTING_GUIDE.md +358 -0
- package/PRODUCTION_DEPLOYMENT_GUIDE.md +486 -0
- package/README.md +978 -0
- package/claude_desktop_config.example.json +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2751 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
- package/setup-production.sh +130 -0
- package/setup.sh +88 -0
- package/src/index.ts +3104 -0
- package/test-connection.js +154 -0
- package/tsconfig.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
# AgentBuilder MCP Server
|
|
2
|
+
|
|
3
|
+
**Version**: 0.1.0
|
|
4
|
+
**License**: MIT
|
|
5
|
+
|
|
6
|
+
A Model Context Protocol (MCP) server that enables Claude Code to create and manage workflows in the AgentBuilder platform with **production-ready OAuth 2.0 workspace authentication**.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🎯 Features
|
|
11
|
+
|
|
12
|
+
This MCP server provides Claude Code with the following capabilities:
|
|
13
|
+
|
|
14
|
+
### **🆕 Agent Creation & Management (NEW!)**
|
|
15
|
+
- ✅ **Create Agents** - Create new agents from scratch with complete configuration
|
|
16
|
+
- ✅ **Set Wizard Configuration** - Define user onboarding wizards with OAuth, credentials, and platform config
|
|
17
|
+
- ✅ **Set Agent Graph** - Define LangGraph workflows with nodes and edges
|
|
18
|
+
- ✅ **Validate Agents** - Pre-publish validation of agent configuration
|
|
19
|
+
- ✅ **Publish Agents** - Publish agents to marketplace
|
|
20
|
+
- ✅ **Update Agents** - Modify agent metadata and configuration
|
|
21
|
+
|
|
22
|
+
📖 **See [AGENT_CREATION_GUIDE.md](AGENT_CREATION_GUIDE.md) for complete documentation**
|
|
23
|
+
|
|
24
|
+
### Workflow Management
|
|
25
|
+
- ✅ **Create Workflows** - Build new workflows with nodes and edges
|
|
26
|
+
- ✅ **List Workflows** - View all your workflows
|
|
27
|
+
- ✅ **Get Workflow Details** - Retrieve specific workflow information
|
|
28
|
+
- ✅ **Update Workflows** - Modify existing workflows
|
|
29
|
+
- ✅ **Execute Workflows** - Run workflows with input data
|
|
30
|
+
- ✅ **Monitor Executions** - Check execution status and results
|
|
31
|
+
- ✅ **Delete Workflows** - Remove workflows
|
|
32
|
+
- ✅ **Validate Workflows** - Check workflow structure before saving
|
|
33
|
+
|
|
34
|
+
### Agent Operations
|
|
35
|
+
- ✅ **List Agents** - Browse marketplace agents with filtering
|
|
36
|
+
- ✅ **Get Agent Details** - View agent information
|
|
37
|
+
- ✅ **Execute Agents** - Run pre-built agents
|
|
38
|
+
- ✅ **Deploy Agents** - Deploy agents to Kubernetes
|
|
39
|
+
|
|
40
|
+
### Dashboard Configuration
|
|
41
|
+
- ✅ **Create Dashboards** - Configure agent-specific dashboards
|
|
42
|
+
- ✅ **Add Widgets** - Add analytics, stats, and custom widgets
|
|
43
|
+
- ✅ **Configure Pages** - Set up landing, configuration, and dashboard pages
|
|
44
|
+
|
|
45
|
+
### Authentication & Security
|
|
46
|
+
- ✅ **OAuth 2.0 Production Auth** - Secure workspace-scoped connections
|
|
47
|
+
- ✅ **Multi-Tenant Isolation** - Each connection tied to specific user + workspace
|
|
48
|
+
- ✅ **Automatic Token Refresh** - Tokens auto-refresh with 5-minute buffer
|
|
49
|
+
- ✅ **Encrypted Storage** - AES-256-GCM encrypted token storage
|
|
50
|
+
- ✅ **Dev/Test Mode** - Direct token auth for local development
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 📋 Prerequisites
|
|
55
|
+
|
|
56
|
+
- **Node.js** 18.0.0 or higher
|
|
57
|
+
- **AgentBuilder Backend** running (local or production)
|
|
58
|
+
- **Claude Code CLI** installed
|
|
59
|
+
- **AgentBuilder Account** with workspace access
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🚀 Installation
|
|
64
|
+
|
|
65
|
+
### Step 1: Install Dependencies
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd agentbuilder-mcp-server
|
|
69
|
+
npm install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Step 2: Build the Server
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm run build
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Step 3: Configure Environment
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Copy example env file
|
|
82
|
+
cp .env.example .env
|
|
83
|
+
|
|
84
|
+
# Edit .env with your configuration
|
|
85
|
+
nano .env
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**`.env` Configuration:**
|
|
89
|
+
```bash
|
|
90
|
+
# AgentBuilder API Base URL
|
|
91
|
+
AGENTBUILDER_API_URL=http://localhost:8000
|
|
92
|
+
# Or for production:
|
|
93
|
+
# AGENTBUILDER_API_URL=https://api.agentbuilder.com
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🔐 Authentication Setup
|
|
99
|
+
|
|
100
|
+
### 🌟 **Production OAuth 2.0** (Recommended)
|
|
101
|
+
|
|
102
|
+
OAuth 2.0 provides secure, workspace-scoped authentication for production use.
|
|
103
|
+
|
|
104
|
+
#### Step 1: Create MCP Connection in Dashboard
|
|
105
|
+
|
|
106
|
+
1. **Login to AgentBuilder Dashboard**:
|
|
107
|
+
```
|
|
108
|
+
https://app.agentbuilder.com
|
|
109
|
+
# Or local: http://localhost:5173
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. **Navigate to MCP Settings**:
|
|
113
|
+
- Go to **Settings** → **MCP Connections**
|
|
114
|
+
- Click **"Connect MCP"** button
|
|
115
|
+
|
|
116
|
+
3. **Complete OAuth Flow**:
|
|
117
|
+
- You'll be redirected to Supabase OAuth
|
|
118
|
+
- Authenticate and grant permissions
|
|
119
|
+
- Select target workspace for this connection
|
|
120
|
+
|
|
121
|
+
4. **Copy Connection ID**:
|
|
122
|
+
- After successful OAuth, you'll see a connection ID
|
|
123
|
+
- Format: `mcp_conn_abc123xyz`
|
|
124
|
+
- **Copy this ID** - you'll need it for Claude Code
|
|
125
|
+
|
|
126
|
+
#### Step 2: Configure in Claude Code
|
|
127
|
+
|
|
128
|
+
Once you have your connection ID, you'll use it in Claude Code.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### 🧪 **Dev/Test Mode** (Local Development)
|
|
133
|
+
|
|
134
|
+
For local development, you can use direct JWT token authentication.
|
|
135
|
+
|
|
136
|
+
#### Get JWT Token from Supabase
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Method 1: From Browser DevTools
|
|
140
|
+
1. Login to frontend (http://localhost:5173)
|
|
141
|
+
2. Open DevTools (F12)
|
|
142
|
+
3. Go to Application → Local Storage
|
|
143
|
+
4. Find supabase.auth.token
|
|
144
|
+
5. Copy the access_token value
|
|
145
|
+
|
|
146
|
+
# Method 2: From API (if you have credentials)
|
|
147
|
+
curl -X POST http://localhost:8000/api/v1/auth/login \
|
|
148
|
+
-H "Content-Type: application/json" \
|
|
149
|
+
-d '{"email":"your@email.com","password":"password"}'
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🔧 Configuration for Claude Code
|
|
155
|
+
|
|
156
|
+
### Step 1: Add to Claude Code MCP Settings
|
|
157
|
+
|
|
158
|
+
Edit your Claude Code settings file:
|
|
159
|
+
|
|
160
|
+
**Location**: `~/.claude/settings.local.json`
|
|
161
|
+
|
|
162
|
+
**Add this configuration:**
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"agentbuilder": {
|
|
168
|
+
"command": "node",
|
|
169
|
+
"args": ["/Users/shantanuchandra/code/agentbuilder/agentbuilder-mcp-server/dist/index.js"],
|
|
170
|
+
"env": {
|
|
171
|
+
"AGENTBUILDER_API_URL": "http://localhost:8000"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Adjust the path** to match where you cloned the repository.
|
|
179
|
+
|
|
180
|
+
### Step 2: Restart Claude Code
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Restart Claude Code to load the new MCP server
|
|
184
|
+
claude code
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Step 3: Verify Connection
|
|
188
|
+
|
|
189
|
+
In Claude Code, ask:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
List the available MCP tools
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
You should see tools like:
|
|
196
|
+
- `agentbuilder:set_auth_token`
|
|
197
|
+
- `agentbuilder:create_workflow`
|
|
198
|
+
- `agentbuilder:list_workflows`
|
|
199
|
+
- etc.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 🎮 Usage Examples
|
|
204
|
+
|
|
205
|
+
### 1. Authenticate with OAuth 2.0 (Production)
|
|
206
|
+
|
|
207
|
+
**Recommended for production use with workspace isolation.**
|
|
208
|
+
|
|
209
|
+
**In Claude Code:**
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
Connect to my AgentBuilder workspace using connection ID mcp_conn_abc123xyz
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Claude will call:
|
|
216
|
+
```typescript
|
|
217
|
+
set_connection({ connection_id: "mcp_conn_abc123xyz" })
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Response:**
|
|
221
|
+
```
|
|
222
|
+
✅ Successfully connected to AgentBuilder workspace: "My Production Workspace"
|
|
223
|
+
|
|
224
|
+
Connection Status: active
|
|
225
|
+
Connection ID: mcp_conn_abc123xyz
|
|
226
|
+
|
|
227
|
+
You can now create workflows, and they will be saved to this workspace.
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### 1b. Authenticate with Token (Dev/Test)
|
|
233
|
+
|
|
234
|
+
**For local development only. Use OAuth for production.**
|
|
235
|
+
|
|
236
|
+
**In Claude Code:**
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
Use the agentbuilder MCP server to set my auth token: <your_jwt_token_here>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Claude will call:
|
|
243
|
+
```typescript
|
|
244
|
+
set_auth_token({ token: "your_jwt_token" })
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Note:** This method is deprecated for production. Shows warning message.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### 2. Create a Simple Workflow
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
Create a workflow called "Email Notification" that:
|
|
255
|
+
1. Triggers on webhook
|
|
256
|
+
2. Sends an email notification
|
|
257
|
+
3. Logs the result
|
|
258
|
+
|
|
259
|
+
Use the agentbuilder MCP server.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Claude will call:
|
|
263
|
+
```typescript
|
|
264
|
+
create_workflow({
|
|
265
|
+
name: "Email Notification",
|
|
266
|
+
description: "Send email notifications on webhook trigger",
|
|
267
|
+
nodes: [
|
|
268
|
+
{
|
|
269
|
+
id: "trigger-1",
|
|
270
|
+
type: "TRIGGER",
|
|
271
|
+
data: { trigger_type: "webhook" }
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "email-1",
|
|
275
|
+
type: "EMAIL_SEND",
|
|
276
|
+
data: {
|
|
277
|
+
to: "user@example.com",
|
|
278
|
+
subject: "Notification",
|
|
279
|
+
body: "Event triggered"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
id: "log-1",
|
|
284
|
+
type: "LOG",
|
|
285
|
+
data: { level: "info" }
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
edges: [
|
|
289
|
+
{ source: "trigger-1", target: "email-1" },
|
|
290
|
+
{ source: "email-1", target: "log-1" }
|
|
291
|
+
],
|
|
292
|
+
category: "automation"
|
|
293
|
+
})
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### 3. List Your Workflows
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
Show me all my active workflows using the agentbuilder MCP server
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Claude will call:
|
|
305
|
+
```typescript
|
|
306
|
+
list_workflows({ status: "active" })
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### 4. Execute a Workflow
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Execute workflow ID "67abc123" with the input:
|
|
315
|
+
{
|
|
316
|
+
"email": "test@example.com",
|
|
317
|
+
"name": "Test User"
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Claude will call:
|
|
322
|
+
```typescript
|
|
323
|
+
execute_workflow({
|
|
324
|
+
workflow_id: "67abc123",
|
|
325
|
+
input: {
|
|
326
|
+
email: "test@example.com",
|
|
327
|
+
name: "Test User"
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### 5. Check Execution Status
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
What's the status of execution "exec_xyz789"?
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Claude will call:
|
|
341
|
+
```typescript
|
|
342
|
+
get_execution_status({ execution_id: "exec_xyz789" })
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
### 6. Complex Workflow Creation
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
Create a customer onboarding workflow with the following steps:
|
|
351
|
+
1. Webhook trigger receives customer data
|
|
352
|
+
2. Validate email format
|
|
353
|
+
3. Check if customer exists in database
|
|
354
|
+
4. If new customer:
|
|
355
|
+
- Create account
|
|
356
|
+
- Send welcome email
|
|
357
|
+
- Add to mailing list
|
|
358
|
+
5. If existing customer:
|
|
359
|
+
- Update profile
|
|
360
|
+
- Send "welcome back" email
|
|
361
|
+
6. Log all actions
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Claude will intelligently structure this into a workflow with conditional nodes, proper edges, and error handling.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## 🛠️ Available Tools
|
|
369
|
+
|
|
370
|
+
### Authentication
|
|
371
|
+
|
|
372
|
+
#### `set_connection` (Production - Recommended)
|
|
373
|
+
Connect to AgentBuilder workspace using OAuth 2.0 connection ID.
|
|
374
|
+
|
|
375
|
+
**Parameters:**
|
|
376
|
+
- `connection_id` (string, required): MCP connection ID from dashboard (format: `mcp_conn_xxx`)
|
|
377
|
+
|
|
378
|
+
**Example:**
|
|
379
|
+
```typescript
|
|
380
|
+
set_connection({ connection_id: "mcp_conn_abc123xyz" })
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Response:**
|
|
384
|
+
```json
|
|
385
|
+
{
|
|
386
|
+
"content": [{
|
|
387
|
+
"type": "text",
|
|
388
|
+
"text": "✅ Successfully connected to AgentBuilder workspace: \"Production Workspace\"\n\nConnection Status: active\nConnection ID: mcp_conn_abc123xyz\n\nYou can now create workflows, and they will be saved to this workspace."
|
|
389
|
+
}]
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Features:**
|
|
394
|
+
- ✅ Workspace-scoped access (workflows saved to specific workspace)
|
|
395
|
+
- ✅ Automatic token refresh (no manual token management)
|
|
396
|
+
- ✅ Multi-tenant isolation
|
|
397
|
+
- ✅ Secure encrypted token storage
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
#### `set_auth_token` (Dev/Test Only - Deprecated)
|
|
402
|
+
Set the JWT authentication token for API requests.
|
|
403
|
+
|
|
404
|
+
**⚠️ Deprecated:** Use `set_connection` for production. This method is for dev/test only.
|
|
405
|
+
|
|
406
|
+
**Parameters:**
|
|
407
|
+
- `token` (string, required): Supabase JWT token
|
|
408
|
+
|
|
409
|
+
**Example:**
|
|
410
|
+
```typescript
|
|
411
|
+
set_auth_token({ token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." })
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Workflow Management
|
|
417
|
+
|
|
418
|
+
#### `create_workflow`
|
|
419
|
+
Create a new workflow.
|
|
420
|
+
|
|
421
|
+
**Parameters:**
|
|
422
|
+
- `name` (string, required): Workflow name
|
|
423
|
+
- `description` (string): Workflow description
|
|
424
|
+
- `nodes` (array): Array of workflow nodes
|
|
425
|
+
- `edges` (array): Array of connections between nodes
|
|
426
|
+
- `category` (string): Workflow category (automation, data_processing, etc.)
|
|
427
|
+
|
|
428
|
+
**Example:**
|
|
429
|
+
```typescript
|
|
430
|
+
create_workflow({
|
|
431
|
+
name: "Data Processing Pipeline",
|
|
432
|
+
description: "Process CSV data and send results",
|
|
433
|
+
nodes: [...],
|
|
434
|
+
edges: [...],
|
|
435
|
+
category: "data_processing"
|
|
436
|
+
})
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
#### `list_workflows`
|
|
440
|
+
List workflows for the authenticated user.
|
|
441
|
+
|
|
442
|
+
**Parameters:**
|
|
443
|
+
- `limit` (number): Number of results (default: 20)
|
|
444
|
+
- `offset` (number): Pagination offset (default: 0)
|
|
445
|
+
- `status` (string): Filter by status (draft, active, archived)
|
|
446
|
+
|
|
447
|
+
**Example:**
|
|
448
|
+
```typescript
|
|
449
|
+
list_workflows({ limit: 10, status: "active" })
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### `get_workflow`
|
|
453
|
+
Get details of a specific workflow.
|
|
454
|
+
|
|
455
|
+
**Parameters:**
|
|
456
|
+
- `workflow_id` (string, required): Workflow ID
|
|
457
|
+
|
|
458
|
+
**Example:**
|
|
459
|
+
```typescript
|
|
460
|
+
get_workflow({ workflow_id: "67abc123" })
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### `update_workflow`
|
|
464
|
+
Update an existing workflow.
|
|
465
|
+
|
|
466
|
+
**Parameters:**
|
|
467
|
+
- `workflow_id` (string, required): Workflow ID
|
|
468
|
+
- `updates` (object, required): Fields to update
|
|
469
|
+
|
|
470
|
+
**Example:**
|
|
471
|
+
```typescript
|
|
472
|
+
update_workflow({
|
|
473
|
+
workflow_id: "67abc123",
|
|
474
|
+
updates: {
|
|
475
|
+
name: "Updated Workflow Name",
|
|
476
|
+
status: "active"
|
|
477
|
+
}
|
|
478
|
+
})
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### `delete_workflow`
|
|
482
|
+
Delete a workflow.
|
|
483
|
+
|
|
484
|
+
**Parameters:**
|
|
485
|
+
- `workflow_id` (string, required): Workflow ID to delete
|
|
486
|
+
|
|
487
|
+
**Example:**
|
|
488
|
+
```typescript
|
|
489
|
+
delete_workflow({ workflow_id: "67abc123" })
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
#### `validate_workflow`
|
|
493
|
+
Validate workflow structure.
|
|
494
|
+
|
|
495
|
+
**Parameters:**
|
|
496
|
+
- `workflow` (object, required): Workflow object to validate
|
|
497
|
+
|
|
498
|
+
**Example:**
|
|
499
|
+
```typescript
|
|
500
|
+
validate_workflow({
|
|
501
|
+
workflow: {
|
|
502
|
+
nodes: [...],
|
|
503
|
+
edges: [...]
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
### Workflow Execution
|
|
511
|
+
|
|
512
|
+
#### `execute_workflow`
|
|
513
|
+
Execute a workflow.
|
|
514
|
+
|
|
515
|
+
**Parameters:**
|
|
516
|
+
- `workflow_id` (string, required): Workflow ID
|
|
517
|
+
- `input` (object): Input data for execution
|
|
518
|
+
|
|
519
|
+
**Example:**
|
|
520
|
+
```typescript
|
|
521
|
+
execute_workflow({
|
|
522
|
+
workflow_id: "67abc123",
|
|
523
|
+
input: { user_id: "123", action: "process" }
|
|
524
|
+
})
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
#### `get_execution_status`
|
|
528
|
+
Get execution status and results.
|
|
529
|
+
|
|
530
|
+
**Parameters:**
|
|
531
|
+
- `execution_id` (string, required): Execution ID
|
|
532
|
+
|
|
533
|
+
**Example:**
|
|
534
|
+
```typescript
|
|
535
|
+
get_execution_status({ execution_id: "exec_xyz789" })
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
#### `list_executions`
|
|
539
|
+
List workflow executions.
|
|
540
|
+
|
|
541
|
+
**Parameters:**
|
|
542
|
+
- `workflow_id` (string): Filter by workflow ID (optional)
|
|
543
|
+
|
|
544
|
+
**Example:**
|
|
545
|
+
```typescript
|
|
546
|
+
list_executions({ workflow_id: "67abc123" })
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## 🔍 Troubleshooting
|
|
552
|
+
|
|
553
|
+
### OAuth Connection Issues
|
|
554
|
+
|
|
555
|
+
#### Issue: Connection ID Invalid
|
|
556
|
+
|
|
557
|
+
**Symptoms:**
|
|
558
|
+
- Error: "Failed to connect with connection ID"
|
|
559
|
+
- "Connection not found or inactive"
|
|
560
|
+
|
|
561
|
+
**Solution:**
|
|
562
|
+
```bash
|
|
563
|
+
# 1. Verify connection ID format
|
|
564
|
+
# Correct: mcp_conn_abc123xyz
|
|
565
|
+
# Incorrect: abc123 (missing prefix)
|
|
566
|
+
|
|
567
|
+
# 2. Check connection status in dashboard
|
|
568
|
+
# Go to Settings → MCP Connections
|
|
569
|
+
# Ensure connection is "active" (not expired/revoked)
|
|
570
|
+
|
|
571
|
+
# 3. Create new connection if needed
|
|
572
|
+
# Click "Connect MCP" in dashboard
|
|
573
|
+
# Complete OAuth flow
|
|
574
|
+
# Copy new connection ID
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
#### Issue: Connection Expired
|
|
580
|
+
|
|
581
|
+
**Symptoms:**
|
|
582
|
+
- "Connection has expired"
|
|
583
|
+
- "Token refresh failed"
|
|
584
|
+
|
|
585
|
+
**Solution:**
|
|
586
|
+
```bash
|
|
587
|
+
# OAuth connections have automatic refresh, but if the connection has been
|
|
588
|
+
# inactive for >30 days, it may expire.
|
|
589
|
+
|
|
590
|
+
# Solution: Create new connection
|
|
591
|
+
1. Go to dashboard → Settings → MCP Connections
|
|
592
|
+
2. Revoke old connection
|
|
593
|
+
3. Click "Connect MCP" to create new connection
|
|
594
|
+
4. Use new connection ID in Claude Code
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
#### Issue: Wrong Workspace
|
|
600
|
+
|
|
601
|
+
**Symptoms:**
|
|
602
|
+
- Workflows not appearing in expected workspace
|
|
603
|
+
- "Access denied to workspace"
|
|
604
|
+
|
|
605
|
+
**Solution:**
|
|
606
|
+
```bash
|
|
607
|
+
# Each MCP connection is tied to a specific workspace
|
|
608
|
+
|
|
609
|
+
# To use different workspace:
|
|
610
|
+
1. Create new MCP connection in dashboard
|
|
611
|
+
2. Select correct workspace during OAuth flow
|
|
612
|
+
3. Use new connection ID in Claude Code
|
|
613
|
+
|
|
614
|
+
# To check current connection's workspace:
|
|
615
|
+
# In Claude Code: "What workspace am I connected to?"
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
### Issue: MCP Server Not Found
|
|
621
|
+
|
|
622
|
+
**Symptoms:**
|
|
623
|
+
- Claude Code doesn't show agentbuilder tools
|
|
624
|
+
- Error: "MCP server not found"
|
|
625
|
+
|
|
626
|
+
**Solution:**
|
|
627
|
+
```bash
|
|
628
|
+
# Check settings file
|
|
629
|
+
cat ~/.claude/settings.local.json
|
|
630
|
+
|
|
631
|
+
# Verify path to dist/index.js is correct
|
|
632
|
+
ls -la /Users/shantanuchandra/code/agentbuilder/agentbuilder-mcp-server/dist/index.js
|
|
633
|
+
|
|
634
|
+
# Rebuild server
|
|
635
|
+
cd agentbuilder-mcp-server
|
|
636
|
+
npm run build
|
|
637
|
+
|
|
638
|
+
# Restart Claude Code
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
### Issue: Authentication Failed
|
|
644
|
+
|
|
645
|
+
**Symptoms:**
|
|
646
|
+
- API calls return 401 Unauthorized
|
|
647
|
+
- "Authentication token required" errors
|
|
648
|
+
|
|
649
|
+
**Solution:**
|
|
650
|
+
```bash
|
|
651
|
+
# Get fresh JWT token:
|
|
652
|
+
# 1. Login to frontend (http://localhost:5173)
|
|
653
|
+
# 2. Open browser DevTools (F12)
|
|
654
|
+
# 3. Go to Application → Local Storage
|
|
655
|
+
# 4. Find supabase.auth.token
|
|
656
|
+
# 5. Copy the access_token value
|
|
657
|
+
|
|
658
|
+
# Then set token in Claude Code:
|
|
659
|
+
# "Set my agentbuilder auth token: <copied_token>"
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
### Issue: Backend Not Running
|
|
665
|
+
|
|
666
|
+
**Symptoms:**
|
|
667
|
+
- Connection refused errors
|
|
668
|
+
- "Cannot connect to http://localhost:8000"
|
|
669
|
+
|
|
670
|
+
**Solution:**
|
|
671
|
+
```bash
|
|
672
|
+
# Start backend
|
|
673
|
+
cd backend
|
|
674
|
+
source venv/bin/activate
|
|
675
|
+
uvicorn app.main:app --reload --port 8000
|
|
676
|
+
|
|
677
|
+
# Verify backend is running
|
|
678
|
+
curl http://localhost:8000/api/v1/health
|
|
679
|
+
# Expected: {"status": "healthy"}
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
---
|
|
683
|
+
|
|
684
|
+
### Issue: TypeScript Compilation Errors
|
|
685
|
+
|
|
686
|
+
**Symptoms:**
|
|
687
|
+
- Build fails with type errors
|
|
688
|
+
- "Cannot find module" errors
|
|
689
|
+
|
|
690
|
+
**Solution:**
|
|
691
|
+
```bash
|
|
692
|
+
# Clean and reinstall
|
|
693
|
+
rm -rf node_modules dist package-lock.json
|
|
694
|
+
npm install
|
|
695
|
+
npm run build
|
|
696
|
+
|
|
697
|
+
# If still failing, check Node.js version
|
|
698
|
+
node --version # Should be 18.0.0+
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
## 📊 Architecture
|
|
704
|
+
|
|
705
|
+
### OAuth 2.0 Flow
|
|
706
|
+
|
|
707
|
+
```
|
|
708
|
+
┌──────────────────┐
|
|
709
|
+
│ User Browser │
|
|
710
|
+
│ (Dashboard) │
|
|
711
|
+
└────────┬─────────┘
|
|
712
|
+
│ 1. Click "Connect MCP"
|
|
713
|
+
↓
|
|
714
|
+
┌──────────────────────────────┐
|
|
715
|
+
│ AgentBuilder Backend │
|
|
716
|
+
│ POST /api/v1/mcp/oauth/init │
|
|
717
|
+
└────────┬─────────────────────┘
|
|
718
|
+
│ 2. Generate state token
|
|
719
|
+
│ Return authorization URL
|
|
720
|
+
↓
|
|
721
|
+
┌──────────────────┐
|
|
722
|
+
│ Supabase OAuth │
|
|
723
|
+
│ (Auth Flow) │
|
|
724
|
+
└────────┬─────────┘
|
|
725
|
+
│ 3. User authenticates
|
|
726
|
+
│ Grants permissions
|
|
727
|
+
↓
|
|
728
|
+
┌──────────────────────────────┐
|
|
729
|
+
│ AgentBuilder Backend │
|
|
730
|
+
│ GET /api/v1/mcp/oauth/callback
|
|
731
|
+
│ - Validate state │
|
|
732
|
+
│ - Exchange code for tokens │
|
|
733
|
+
│ - Encrypt tokens (AES-256) │
|
|
734
|
+
│ - Store in mcp_connections │
|
|
735
|
+
│ - Return connection_id │
|
|
736
|
+
└────────┬─────────────────────┘
|
|
737
|
+
│ 4. connection_id: mcp_conn_xxx
|
|
738
|
+
↓
|
|
739
|
+
┌──────────────────┐
|
|
740
|
+
│ User Browser │
|
|
741
|
+
│ (Shows ID) │
|
|
742
|
+
└──────────────────┘
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### MCP Request Flow
|
|
746
|
+
|
|
747
|
+
```
|
|
748
|
+
┌─────────────────┐
|
|
749
|
+
│ Claude Code │
|
|
750
|
+
│ (User CLI) │
|
|
751
|
+
└────────┬────────┘
|
|
752
|
+
│ MCP Protocol (stdio)
|
|
753
|
+
│ Tool: set_connection(connection_id)
|
|
754
|
+
↓
|
|
755
|
+
┌─────────────────────────────────────┐
|
|
756
|
+
│ AgentBuilder MCP Server │
|
|
757
|
+
│ - Validates connection ID │
|
|
758
|
+
│ - Adds X-MCP-Connection-ID header │
|
|
759
|
+
│ - Tool handlers │
|
|
760
|
+
└────────┬────────────────────────────┘
|
|
761
|
+
│ HTTP/REST API
|
|
762
|
+
│ Header: X-MCP-Connection-ID
|
|
763
|
+
↓
|
|
764
|
+
┌─────────────────────────────────────┐
|
|
765
|
+
│ AgentBuilder Backend │
|
|
766
|
+
│ (FastAPI on port 8000) │
|
|
767
|
+
│ Middleware: │
|
|
768
|
+
│ 1. Validate connection exists │
|
|
769
|
+
│ 2. Check token expiry (auto-refresh)
|
|
770
|
+
│ 3. Verify workspace ownership │
|
|
771
|
+
│ 4. Check RBAC permissions │
|
|
772
|
+
│ 5. Inject workspace context │
|
|
773
|
+
└────────┬────────────────────────────┘
|
|
774
|
+
│ MongoDB
|
|
775
|
+
↓
|
|
776
|
+
┌─────────────────────────────────────┐
|
|
777
|
+
│ MongoDB Database │
|
|
778
|
+
│ - mcp_connections (encrypted tokens)│
|
|
779
|
+
│ - workflows (with source tracking) │
|
|
780
|
+
│ - executions collection │
|
|
781
|
+
└─────────────────────────────────────┘
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
## 🧪 Testing
|
|
787
|
+
|
|
788
|
+
### Manual Testing
|
|
789
|
+
|
|
790
|
+
```bash
|
|
791
|
+
# 1. Build and install
|
|
792
|
+
npm run build
|
|
793
|
+
|
|
794
|
+
# 2. Test directly (with auth token)
|
|
795
|
+
export AGENTBUILDER_AUTH_TOKEN="your_token_here"
|
|
796
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
### Integration Testing with Claude Code
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
# Start Claude Code
|
|
803
|
+
claude code
|
|
804
|
+
|
|
805
|
+
# In Claude Code, run test commands:
|
|
806
|
+
# "List available agentbuilder MCP tools"
|
|
807
|
+
# "Create a test workflow named 'Test Workflow'"
|
|
808
|
+
# "List all workflows"
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
---
|
|
812
|
+
|
|
813
|
+
## 🚀 Development
|
|
814
|
+
|
|
815
|
+
### Local Development
|
|
816
|
+
|
|
817
|
+
```bash
|
|
818
|
+
# Run in watch mode
|
|
819
|
+
npm run watch
|
|
820
|
+
|
|
821
|
+
# In another terminal, test changes
|
|
822
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
### Adding New Tools
|
|
826
|
+
|
|
827
|
+
1. **Add tool definition** in `getTools()` method
|
|
828
|
+
2. **Add handler** in `setupHandlers()` switch statement
|
|
829
|
+
3. **Implement handler method** (e.g., `handleNewTool()`)
|
|
830
|
+
4. **Rebuild and test**
|
|
831
|
+
|
|
832
|
+
**Example:**
|
|
833
|
+
|
|
834
|
+
```typescript
|
|
835
|
+
// 1. Add tool definition
|
|
836
|
+
{
|
|
837
|
+
name: 'duplicate_workflow',
|
|
838
|
+
description: 'Duplicate an existing workflow',
|
|
839
|
+
inputSchema: {
|
|
840
|
+
type: 'object',
|
|
841
|
+
properties: {
|
|
842
|
+
workflow_id: { type: 'string' },
|
|
843
|
+
new_name: { type: 'string' }
|
|
844
|
+
},
|
|
845
|
+
required: ['workflow_id', 'new_name']
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// 2. Add to switch statement
|
|
850
|
+
case 'duplicate_workflow':
|
|
851
|
+
return await this.handleDuplicateWorkflow(args);
|
|
852
|
+
|
|
853
|
+
// 3. Implement handler
|
|
854
|
+
private async handleDuplicateWorkflow(args: any) {
|
|
855
|
+
// Get original workflow
|
|
856
|
+
const original = await this.client.getWorkflow(args.workflow_id);
|
|
857
|
+
|
|
858
|
+
// Create duplicate with new name
|
|
859
|
+
const duplicate = await this.client.createWorkflow({
|
|
860
|
+
...original.data,
|
|
861
|
+
name: args.new_name
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
return {
|
|
865
|
+
content: [{
|
|
866
|
+
type: 'text',
|
|
867
|
+
text: JSON.stringify(duplicate, null, 2)
|
|
868
|
+
}]
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
---
|
|
874
|
+
|
|
875
|
+
## 📝 Examples
|
|
876
|
+
|
|
877
|
+
### Example 1: Complete Onboarding Workflow
|
|
878
|
+
|
|
879
|
+
```
|
|
880
|
+
Create a complete customer onboarding workflow using agentbuilder that:
|
|
881
|
+
|
|
882
|
+
1. Triggers when webhook receives new signup
|
|
883
|
+
2. Validates email and phone number
|
|
884
|
+
3. Creates user account in database
|
|
885
|
+
4. Sends welcome email with verification link
|
|
886
|
+
5. Adds user to "New Customers" mailing list
|
|
887
|
+
6. Schedules follow-up email for 3 days later
|
|
888
|
+
7. Logs all steps for auditing
|
|
889
|
+
8. On any error, sends alert to admin
|
|
890
|
+
|
|
891
|
+
Make it production-ready with proper error handling.
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
### Example 2: Data Processing Pipeline
|
|
895
|
+
|
|
896
|
+
```
|
|
897
|
+
Build a data processing workflow in agentbuilder that:
|
|
898
|
+
|
|
899
|
+
1. Triggers on CSV file upload
|
|
900
|
+
2. Validates CSV format
|
|
901
|
+
3. Cleans data (remove duplicates, fix formatting)
|
|
902
|
+
4. Enriches data with external API calls
|
|
903
|
+
5. Saves processed data to database
|
|
904
|
+
6. Generates summary report
|
|
905
|
+
7. Emails report to stakeholder
|
|
906
|
+
8. Archives original file
|
|
907
|
+
|
|
908
|
+
Include retry logic for API calls and proper error notifications.
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
### Example 3: Monitoring Workflow
|
|
912
|
+
|
|
913
|
+
```
|
|
914
|
+
Create a monitoring workflow that:
|
|
915
|
+
|
|
916
|
+
1. Runs every 5 minutes (cron trigger)
|
|
917
|
+
2. Checks website uptime
|
|
918
|
+
3. Tests API endpoints
|
|
919
|
+
4. Monitors database connections
|
|
920
|
+
5. If any checks fail:
|
|
921
|
+
- Send Slack alert
|
|
922
|
+
- Create incident ticket
|
|
923
|
+
- Trigger automated recovery if possible
|
|
924
|
+
6. Log all check results
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
## 🔒 Security Best Practices
|
|
930
|
+
|
|
931
|
+
### 1. Don't Commit Tokens
|
|
932
|
+
|
|
933
|
+
```bash
|
|
934
|
+
# Never commit .env files
|
|
935
|
+
echo ".env" >> .gitignore
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
### 2. Rotate Tokens Regularly
|
|
939
|
+
|
|
940
|
+
```bash
|
|
941
|
+
# Get new token from Supabase every session
|
|
942
|
+
# Set expiration time in Supabase settings
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
### 3. Use Environment Variables
|
|
946
|
+
|
|
947
|
+
```bash
|
|
948
|
+
# Set token via environment, not hardcoded
|
|
949
|
+
export AGENTBUILDER_AUTH_TOKEN="token_here"
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
---
|
|
953
|
+
|
|
954
|
+
## 🆘 Support
|
|
955
|
+
|
|
956
|
+
**Issues?** Report at: https://github.com/agentbuilder/agentbuilder/issues
|
|
957
|
+
|
|
958
|
+
**Documentation**: See main [AgentBuilder Docs](../docs/README.md)
|
|
959
|
+
|
|
960
|
+
**Questions?** Contact: support@agentbuilder.com
|
|
961
|
+
|
|
962
|
+
---
|
|
963
|
+
|
|
964
|
+
## 📄 License
|
|
965
|
+
|
|
966
|
+
MIT License - See [LICENSE](LICENSE) file for details
|
|
967
|
+
|
|
968
|
+
---
|
|
969
|
+
|
|
970
|
+
## 🙏 Acknowledgments
|
|
971
|
+
|
|
972
|
+
- Built with [Model Context Protocol](https://modelcontextprotocol.io/) SDK
|
|
973
|
+
- Integrates with [AgentBuilder Platform](../README.md)
|
|
974
|
+
- Powered by [Claude Code](https://claude.ai/code)
|
|
975
|
+
|
|
976
|
+
---
|
|
977
|
+
|
|
978
|
+
**Happy workflow building!** 🚀
|