projoflow-mcp-server 1.0.1 → 1.0.3
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/index.js +39 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,18 +9,19 @@ import {
|
|
|
9
9
|
import { createClient } from "@supabase/supabase-js";
|
|
10
10
|
|
|
11
11
|
// Supabase config - all values from environment variables
|
|
12
|
-
const SUPABASE_URL = process.env.
|
|
13
|
-
const SUPABASE_ANON_KEY = process.env.ZFLOW_SUPABASE_ANON_KEY;
|
|
12
|
+
const SUPABASE_URL = process.env.PROJOFLOW_SUPABASE_URL || process.env.ZFLOW_SUPABASE_URL;
|
|
13
|
+
const SUPABASE_ANON_KEY = process.env.PROJOFLOW_SUPABASE_ANON_KEY || process.env.ZFLOW_SUPABASE_ANON_KEY;
|
|
14
14
|
|
|
15
15
|
// MCP service account credentials
|
|
16
|
-
const MCP_EMAIL = process.env.ZFLOW_MCP_EMAIL;
|
|
17
|
-
const MCP_PASSWORD = process.env.ZFLOW_MCP_PASSWORD;
|
|
16
|
+
const MCP_EMAIL = process.env.PROJOFLOW_MCP_EMAIL || process.env.ZFLOW_MCP_EMAIL;
|
|
17
|
+
const MCP_PASSWORD = process.env.PROJOFLOW_MCP_PASSWORD || process.env.ZFLOW_MCP_PASSWORD;
|
|
18
18
|
|
|
19
19
|
// Validate required env vars
|
|
20
20
|
const missing = [];
|
|
21
|
-
if (!
|
|
22
|
-
if (!
|
|
23
|
-
if (!
|
|
21
|
+
if (!SUPABASE_URL) missing.push("PROJOFLOW_SUPABASE_URL");
|
|
22
|
+
if (!SUPABASE_ANON_KEY) missing.push("PROJOFLOW_SUPABASE_ANON_KEY");
|
|
23
|
+
if (!MCP_EMAIL) missing.push("PROJOFLOW_MCP_EMAIL");
|
|
24
|
+
if (!MCP_PASSWORD) missing.push("PROJOFLOW_MCP_PASSWORD");
|
|
24
25
|
|
|
25
26
|
if (missing.length > 0) {
|
|
26
27
|
console.error(`ERROR: Missing required environment variables: ${missing.join(", ")}`);
|
|
@@ -124,9 +125,17 @@ const TOOLS = [
|
|
|
124
125
|
required: ["project_id"]
|
|
125
126
|
}
|
|
126
127
|
},
|
|
128
|
+
{
|
|
129
|
+
name: "list_workspace_members",
|
|
130
|
+
description: "List all members/users in the workspace (use to find user IDs for task assignment)",
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
127
136
|
{
|
|
128
137
|
name: "create_task",
|
|
129
|
-
description: "Create a new task in a project",
|
|
138
|
+
description: "Create a new task in a project. Use list_workspace_members to find user IDs for assignment.",
|
|
130
139
|
inputSchema: {
|
|
131
140
|
type: "object",
|
|
132
141
|
properties: {
|
|
@@ -136,7 +145,8 @@ const TOOLS = [
|
|
|
136
145
|
status: { type: "string", enum: ["todo", "in_progress", "review", "done"], default: "todo" },
|
|
137
146
|
priority: { type: "string", enum: ["low", "medium", "high", "urgent"], default: "medium" },
|
|
138
147
|
due_date: { type: "string", description: "Due date (YYYY-MM-DD)" },
|
|
139
|
-
estimated_hours: { type: "number" }
|
|
148
|
+
estimated_hours: { type: "number" },
|
|
149
|
+
assigned_to: { type: "string", description: "User ID to assign the task to (get from list_workspace_members)" }
|
|
140
150
|
},
|
|
141
151
|
required: ["project_id", "title"]
|
|
142
152
|
}
|
|
@@ -347,9 +357,25 @@ async function handleTool(name, args) {
|
|
|
347
357
|
return data;
|
|
348
358
|
}
|
|
349
359
|
|
|
360
|
+
case "list_workspace_members": {
|
|
361
|
+
// Get workspace members with their user info
|
|
362
|
+
const { data, error } = await supabase
|
|
363
|
+
.from("workspace_members")
|
|
364
|
+
.select("user_id, role, users(id, email, name)")
|
|
365
|
+
.order("created_at");
|
|
366
|
+
if (error) throw new Error(error.message);
|
|
367
|
+
// Flatten the response for easier use
|
|
368
|
+
return data.map(m => ({
|
|
369
|
+
user_id: m.user_id,
|
|
370
|
+
role: m.role,
|
|
371
|
+
email: m.users?.email,
|
|
372
|
+
name: m.users?.name || m.users?.email
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
|
|
350
376
|
case "list_tasks": {
|
|
351
377
|
let query = supabase.from("tasks")
|
|
352
|
-
.select("
|
|
378
|
+
.select("*, users(id, email, name)")
|
|
353
379
|
.eq("project_id", args.project_id)
|
|
354
380
|
.order("position").order("created_at");
|
|
355
381
|
if (args.status) query = query.eq("status", args.status);
|
|
@@ -378,9 +404,10 @@ async function handleTool(name, args) {
|
|
|
378
404
|
status: args.status || "todo",
|
|
379
405
|
priority: args.priority || "medium",
|
|
380
406
|
due_date: args.due_date,
|
|
381
|
-
estimated_hours: args.estimated_hours
|
|
407
|
+
estimated_hours: args.estimated_hours,
|
|
408
|
+
assigned_to: args.assigned_to
|
|
382
409
|
})
|
|
383
|
-
.select()
|
|
410
|
+
.select("*, users(id, email, name)")
|
|
384
411
|
.single();
|
|
385
412
|
if (error) throw new Error(error.message);
|
|
386
413
|
return data;
|