@delega-dev/mcp 1.0.3 → 1.0.5

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 (2) hide show
  1. package/dist/index.js +22 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10,9 +10,11 @@ var DEFAULT_BASE_URL = "http://127.0.0.1:18890";
10
10
  var DelegaClient = class {
11
11
  baseUrl;
12
12
  agentKey;
13
+ pathPrefix;
13
14
  constructor(baseUrl, agentKey) {
14
15
  this.baseUrl = (baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, "");
15
16
  this.agentKey = agentKey;
17
+ this.pathPrefix = this.baseUrl.includes("api.delega.dev") ? "/v1" : "/api";
16
18
  }
17
19
  async request(method, path, body, query) {
18
20
  const url = new URL(path, this.baseUrl);
@@ -52,45 +54,45 @@ var DelegaClient = class {
52
54
  if (params.label !== void 0) query.label = params.label;
53
55
  if (params.due !== void 0) query.due = params.due;
54
56
  if (params.completed !== void 0) query.completed = String(params.completed);
55
- return this.request("GET", "/api/tasks", void 0, query);
57
+ return this.request("GET", `${this.pathPrefix}/tasks`, void 0, query);
56
58
  }
57
59
  async getTask(taskId) {
58
- return this.request("GET", `/api/tasks/${taskId}`);
60
+ return this.request("GET", `${this.pathPrefix}/tasks/${taskId}`);
59
61
  }
60
62
  async createTask(data) {
61
- return this.request("POST", "/api/tasks", data);
63
+ return this.request("POST", `${this.pathPrefix}/tasks`, data);
62
64
  }
63
65
  async updateTask(taskId, data) {
64
- return this.request("PUT", `/api/tasks/${taskId}`, data);
66
+ return this.request("PUT", `${this.pathPrefix}/tasks/${taskId}`, data);
65
67
  }
66
68
  async completeTask(taskId) {
67
- return this.request("POST", `/api/tasks/${taskId}/complete`);
69
+ return this.request("POST", `${this.pathPrefix}/tasks/${taskId}/complete`);
68
70
  }
69
71
  async deleteTask(taskId) {
70
- return this.request("DELETE", `/api/tasks/${taskId}`);
72
+ return this.request("DELETE", `${this.pathPrefix}/tasks/${taskId}`);
71
73
  }
72
74
  // ── Comments ──
73
75
  async addComment(taskId, data) {
74
76
  return this.request(
75
77
  "POST",
76
- `/api/tasks/${taskId}/comments`,
78
+ `${this.pathPrefix}/tasks/${taskId}/comments`,
77
79
  data
78
80
  );
79
81
  }
80
82
  // ── Projects ──
81
83
  async listProjects() {
82
- return this.request("GET", "/api/projects");
84
+ return this.request("GET", `${this.pathPrefix}/projects`);
83
85
  }
84
86
  // ── Stats ──
85
87
  async getStats() {
86
- return this.request("GET", "/api/stats");
88
+ return this.request("GET", `${this.pathPrefix}/stats`);
87
89
  }
88
90
  // ── Agents ──
89
91
  async listAgents() {
90
- return this.request("GET", "/api/agents");
92
+ return this.request("GET", `${this.pathPrefix}/agents`);
91
93
  }
92
94
  async registerAgent(data) {
93
- return this.request("POST", "/api/agents", data);
95
+ return this.request("POST", `${this.pathPrefix}/agents`, data);
94
96
  }
95
97
  };
96
98
 
@@ -105,7 +107,15 @@ function formatTask(t) {
105
107
  if (t.description) lines.push(` Description: ${t.description}`);
106
108
  if (t.project?.name ?? t.project_name)
107
109
  lines.push(` Project: ${t.project?.name ?? t.project_name}`);
108
- if (t.labels?.length) lines.push(` Labels: ${t.labels.join(", ")}`);
110
+ const labels = Array.isArray(t.labels) ? t.labels : typeof t.labels === "string" ? (() => {
111
+ try {
112
+ const p = JSON.parse(t.labels);
113
+ return Array.isArray(p) ? p : [];
114
+ } catch {
115
+ return [];
116
+ }
117
+ })() : [];
118
+ if (labels.length) lines.push(` Labels: ${labels.join(", ")}`);
109
119
  if (t.priority) lines.push(` Priority: ${t.priority}`);
110
120
  if (t.due_date) lines.push(` Due: ${t.due_date}`);
111
121
  lines.push(` Completed: ${t.completed ? "yes" : "no"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delega-dev/mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "mcpName": "io.github.delega-dev/delega",
5
5
  "description": "MCP server for Delega — task infrastructure for AI agents",
6
6
  "type": "module",