@pxlabz/tasq-mcp 0.1.18 → 0.1.19
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 +8 -0
- package/dist/tasq-mcp.js +250 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,6 +73,14 @@ so `tasq project share` and the web Share dialog are the only ways in.
|
|
|
73
73
|
| `time_list` | `tasq time list` | `workspace`, `task` |
|
|
74
74
|
| `time_edit` | `tasq time edit` | `workspace`, `entryId`, `duration`, `day`, `note` (`null` clears), `billable` |
|
|
75
75
|
| `time_delete` | `tasq time delete` | `workspace`, `entryId` |
|
|
76
|
+
| `client_hours` | `tasq clients hours` | `workspace`, `client`, `month` (`YYYY-MM`), `billableOnly` |
|
|
77
|
+
| `my_week` | `tasq week` | `workspace`, `day` (`YYYY-MM-DD`) |
|
|
78
|
+
| `time_draft_get` | `tasq timesheet show` | `workspace`, `draftId`: the draft from a `timesheet_due` or `timesheet_reply` event, with the member's day |
|
|
79
|
+
| `time_draft_save` | `tasq timesheet save` | `workspace`, `draftId`, `lines` (`task`, `duration`, `billable?`, `evidence?`), `message?` |
|
|
80
|
+
| `client_billing` | `tasq clients billing` | `workspace`, `client` |
|
|
81
|
+
| `billing_period_close` | `tasq clients close` | `workspace`, `client`, `month` (admins) |
|
|
82
|
+
| `billing_period_mark_invoiced` | `tasq clients invoice` | `workspace`, `client`, `month`, `invoiceRef` (admins) |
|
|
83
|
+
| `billing_period_reopen` | `tasq clients reopen` | `workspace`, `client`, `month` (admins) |
|
|
76
84
|
| `comment_add` | `tasq comment add` | `workspace`, `body`, `task`, `project`, `replyTo`, `thread`, `mentions` |
|
|
77
85
|
| `thread_view` | `tasq thread view` | `workspace`, `threadId` |
|
|
78
86
|
| `thread_context` | `tasq thread context` | `workspace`, `threadId`, `format` (`markdown` by default) |
|
package/dist/tasq-mcp.js
CHANGED
|
@@ -22463,6 +22463,62 @@ var TasqClient = class _TasqClient {
|
|
|
22463
22463
|
update: (slug, input) => this.dispatch("time.update", slug, input),
|
|
22464
22464
|
delete: (slug, input) => this.dispatch("time.delete", slug, input)
|
|
22465
22465
|
};
|
|
22466
|
+
/**
|
|
22467
|
+
* Clients (initiatives) and their hours. Member-only; refused unless a team
|
|
22468
|
+
* with a project for the client has Client hours on.
|
|
22469
|
+
*/
|
|
22470
|
+
clients = {
|
|
22471
|
+
/**
|
|
22472
|
+
* One month of a client's hours by billable flag, project and person.
|
|
22473
|
+
* `month` is `YYYY-MM`; `billableOnly` counts billable entries only.
|
|
22474
|
+
*/
|
|
22475
|
+
hours: (slug, clientId, month, options = {}) => this.#get(
|
|
22476
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/hours`,
|
|
22477
|
+
{ month, billable: options.billableOnly ? "billable" : "all" }
|
|
22478
|
+
),
|
|
22479
|
+
/** A client's billing months, newest first, with each one's hours and state. */
|
|
22480
|
+
billing: (slug, clientId) => this.#get(
|
|
22481
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/billing`
|
|
22482
|
+
)
|
|
22483
|
+
};
|
|
22484
|
+
/** The caller's own time (TM-2, My week). */
|
|
22485
|
+
me = {
|
|
22486
|
+
/**
|
|
22487
|
+
* The caller's Monday-to-Sunday week around `day` (`YYYY-MM-DD`), that
|
|
22488
|
+
* day's entries, and tasks they worked on that day with no time logged.
|
|
22489
|
+
* `tz` is the IANA zone that decides which edits fall on the day.
|
|
22490
|
+
*/
|
|
22491
|
+
week: (slug, day, options = {}) => this.#get(
|
|
22492
|
+
`/workspaces/${encodeURIComponent(slug)}/me/week`,
|
|
22493
|
+
options.tz ? { day, tz: options.tz } : { day }
|
|
22494
|
+
)
|
|
22495
|
+
};
|
|
22496
|
+
/**
|
|
22497
|
+
* Agent timesheet drafts (TM-2). The drafting agent reads a draft and the
|
|
22498
|
+
* member's day and saves lines; the member requests, logs, dismisses or
|
|
22499
|
+
* replies. Agent keys are refused the member's side by policy.
|
|
22500
|
+
*/
|
|
22501
|
+
timeDrafts = {
|
|
22502
|
+
get: async (slug, draftId) => (await this.#get(
|
|
22503
|
+
`/workspaces/${encodeURIComponent(slug)}/time-drafts/${encodeURIComponent(draftId)}`
|
|
22504
|
+
)).draft,
|
|
22505
|
+
/** The member's week around `day`, read by the agent that drafts it. */
|
|
22506
|
+
memberWeek: (slug, memberId, day) => this.#get(
|
|
22507
|
+
`/workspaces/${encodeURIComponent(slug)}/members/${encodeURIComponent(memberId)}/week`,
|
|
22508
|
+
{ day }
|
|
22509
|
+
),
|
|
22510
|
+
request: (slug, input) => this.dispatch("timeDraft.request", slug, input),
|
|
22511
|
+
save: (slug, input) => this.dispatch("timeDraft.save", slug, input),
|
|
22512
|
+
confirm: (slug, input) => this.dispatch("timeDraft.confirm", slug, input),
|
|
22513
|
+
dismiss: (slug, input) => this.dispatch("timeDraft.dismiss", slug, input),
|
|
22514
|
+
reply: (slug, input) => this.dispatch("timeDraft.reply", slug, input)
|
|
22515
|
+
};
|
|
22516
|
+
/** Close, invoice and reopen a client's month (admins only). */
|
|
22517
|
+
billingPeriods = {
|
|
22518
|
+
close: (slug, input) => this.dispatch("billingPeriod.close", slug, input),
|
|
22519
|
+
markInvoiced: (slug, input) => this.dispatch("billingPeriod.markInvoiced", slug, input),
|
|
22520
|
+
reopen: (slug, input) => this.dispatch("billingPeriod.reopen", slug, input)
|
|
22521
|
+
};
|
|
22466
22522
|
projects = {
|
|
22467
22523
|
list: async (slug) => (await this.#get(
|
|
22468
22524
|
`/workspaces/${encodeURIComponent(slug)}/projects`
|
|
@@ -30706,7 +30762,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
30706
30762
|
// package.json
|
|
30707
30763
|
var package_default = {
|
|
30708
30764
|
name: "@pxlabz/tasq-mcp",
|
|
30709
|
-
version: "0.1.
|
|
30765
|
+
version: "0.1.19",
|
|
30710
30766
|
description: "MCP stdio server for Tasq: tasks, threads, comments and mentions for MCP-capable agents",
|
|
30711
30767
|
keywords: [
|
|
30712
30768
|
"tasq",
|
|
@@ -31130,6 +31186,25 @@ async function resolveProjectId(client, slug, ref) {
|
|
|
31130
31186
|
}
|
|
31131
31187
|
return matched[0]?.id ?? "";
|
|
31132
31188
|
}
|
|
31189
|
+
async function resolveClientId(client, slug, ref) {
|
|
31190
|
+
const trimmed = ref.trim();
|
|
31191
|
+
if (UUID_PATTERN2.test(trimmed)) return trimmed;
|
|
31192
|
+
const wanted = trimmed.toLowerCase();
|
|
31193
|
+
const matched = (await client.initiatives.list(slug)).filter(
|
|
31194
|
+
(initiative) => initiative.name.toLowerCase() === wanted
|
|
31195
|
+
);
|
|
31196
|
+
if (matched.length === 0) {
|
|
31197
|
+
throw new UsageError(
|
|
31198
|
+
`No client named "${ref}" in this workspace. Call initiative_list to see the names.`
|
|
31199
|
+
);
|
|
31200
|
+
}
|
|
31201
|
+
if (matched.length > 1) {
|
|
31202
|
+
throw new UsageError(
|
|
31203
|
+
`"${ref}" matches ${matched.length} clients. Pass the client id.`
|
|
31204
|
+
);
|
|
31205
|
+
}
|
|
31206
|
+
return matched[0]?.id ?? "";
|
|
31207
|
+
}
|
|
31133
31208
|
function mentionCandidate(member) {
|
|
31134
31209
|
const name = member.name ?? "(no name)";
|
|
31135
31210
|
return member.type === "agent" ? `${name} (agent)` : `${name} <${member.email ?? "no email"}> (person)`;
|
|
@@ -31260,6 +31335,7 @@ var BILLABLE_VALUES = {
|
|
|
31260
31335
|
unset: "not_set"
|
|
31261
31336
|
};
|
|
31262
31337
|
var DURATION_INPUT = external_exports.string().describe("How long, e.g. 1h 30m, 90m, 1.5h or 1:30; at most 24h per entry.");
|
|
31338
|
+
var billingMonth = external_exports.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/).describe("YYYY-MM, the month to act on.");
|
|
31263
31339
|
var workspaceFields = {
|
|
31264
31340
|
workspace: external_exports.string().optional().describe("Workspace slug; defaults to TASQ_WORKSPACE.")
|
|
31265
31341
|
};
|
|
@@ -31704,6 +31780,179 @@ var definitions = [
|
|
|
31704
31780
|
return { data: response.result };
|
|
31705
31781
|
}
|
|
31706
31782
|
}),
|
|
31783
|
+
define({
|
|
31784
|
+
name: "client_hours",
|
|
31785
|
+
description: "One month of a client's logged hours by billable flag, project and person, plus the entries with no billable flag yet.",
|
|
31786
|
+
schema: external_exports.object({
|
|
31787
|
+
...workspaceFields,
|
|
31788
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31789
|
+
month: external_exports.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/).optional().describe("YYYY-MM (default: this month)."),
|
|
31790
|
+
billableOnly: external_exports.boolean().optional().describe("Count billable entries only.")
|
|
31791
|
+
}),
|
|
31792
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31793
|
+
const slug = requireWorkspace(config2, input);
|
|
31794
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31795
|
+
const month = input.month ?? localToday().slice(0, 7);
|
|
31796
|
+
const hours = await client.clients.hours(slug, clientId, month, {
|
|
31797
|
+
billableOnly: input.billableOnly === true
|
|
31798
|
+
});
|
|
31799
|
+
return {
|
|
31800
|
+
data: hours,
|
|
31801
|
+
lines: [
|
|
31802
|
+
`${hours.name}, ${hours.month}: ${formatMinutes(hours.totals.total)} logged, ${formatMinutes(hours.totals.billable)} billable, ${formatMinutes(hours.totals.notSet)} not set.`
|
|
31803
|
+
]
|
|
31804
|
+
};
|
|
31805
|
+
}
|
|
31806
|
+
}),
|
|
31807
|
+
define({
|
|
31808
|
+
name: "my_week",
|
|
31809
|
+
description: "Your Monday-to-Sunday week of logged time, one day's entries, and the tasks you changed or commented on that day without logging time.",
|
|
31810
|
+
schema: external_exports.object({
|
|
31811
|
+
...workspaceFields,
|
|
31812
|
+
day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("YYYY-MM-DD (default: today).")
|
|
31813
|
+
}),
|
|
31814
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31815
|
+
const slug = requireWorkspace(config2, input);
|
|
31816
|
+
const day = input.day ?? localToday();
|
|
31817
|
+
const result2 = await client.me.week(slug, day, {
|
|
31818
|
+
tz: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
31819
|
+
});
|
|
31820
|
+
return {
|
|
31821
|
+
data: result2,
|
|
31822
|
+
lines: [
|
|
31823
|
+
`Week of ${result2.from}: ${formatMinutes(result2.totalMinutes)} logged; ${result2.day}: ${result2.entries.length} entries, ${result2.unlogged.length} tasks with no time yet.`
|
|
31824
|
+
]
|
|
31825
|
+
};
|
|
31826
|
+
}
|
|
31827
|
+
}),
|
|
31828
|
+
define({
|
|
31829
|
+
name: "time_draft_get",
|
|
31830
|
+
description: "Read the timesheet draft a timesheet_due or timesheet_reply event names, with the member's day and the conversation.",
|
|
31831
|
+
schema: external_exports.object({
|
|
31832
|
+
...workspaceFields,
|
|
31833
|
+
draftId: external_exports.string().uuid().describe("The timeDraftId from the event.")
|
|
31834
|
+
}),
|
|
31835
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31836
|
+
const slug = requireWorkspace(config2, input);
|
|
31837
|
+
const draft = await client.timeDrafts.get(slug, input.draftId);
|
|
31838
|
+
const day = await client.timeDrafts.memberWeek(slug, draft.memberId, draft.day);
|
|
31839
|
+
return {
|
|
31840
|
+
data: { draft, day },
|
|
31841
|
+
lines: [
|
|
31842
|
+
`Draft for ${draft.day} (${draft.state}): ${day.unlogged.length} tasks with no time, ${day.entries.length} entries already logged, ${draft.messages.length} messages.`
|
|
31843
|
+
]
|
|
31844
|
+
};
|
|
31845
|
+
}
|
|
31846
|
+
}),
|
|
31847
|
+
define({
|
|
31848
|
+
name: "time_draft_save",
|
|
31849
|
+
description: "Save a timesheet draft's lines, replacing earlier ones; nothing is logged until the member confirms.",
|
|
31850
|
+
schema: external_exports.object({
|
|
31851
|
+
...workspaceFields,
|
|
31852
|
+
draftId: external_exports.string().uuid().describe("The draft to write."),
|
|
31853
|
+
lines: external_exports.array(
|
|
31854
|
+
external_exports.object({
|
|
31855
|
+
task: external_exports.string().describe("Task key such as ENG-12, or a task UUID."),
|
|
31856
|
+
duration: external_exports.string().describe("How long, such as 1h30m, 45m or 1.5h."),
|
|
31857
|
+
billable: BILLABLE_INPUT.optional().describe("yes or no; unset by default."),
|
|
31858
|
+
evidence: external_exports.string().max(200).optional().describe("One line on why, such as 2 comments, moved to In review.")
|
|
31859
|
+
})
|
|
31860
|
+
).max(30),
|
|
31861
|
+
message: external_exports.string().max(2e3).optional().describe("A short note to the member about the draft.")
|
|
31862
|
+
}),
|
|
31863
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31864
|
+
const slug = requireWorkspace(config2, input);
|
|
31865
|
+
const lines = [];
|
|
31866
|
+
for (const line of input.lines) {
|
|
31867
|
+
const draftLine = {
|
|
31868
|
+
taskId: await resolveTaskId(client, slug, line.task),
|
|
31869
|
+
minutes: resolveDurationMinutes(line.duration)
|
|
31870
|
+
};
|
|
31871
|
+
if (line.billable !== void 0) draftLine.billable = BILLABLE_VALUES[line.billable];
|
|
31872
|
+
if (line.evidence !== void 0) draftLine.evidence = line.evidence;
|
|
31873
|
+
lines.push(draftLine);
|
|
31874
|
+
}
|
|
31875
|
+
const save = { draftId: input.draftId, lines };
|
|
31876
|
+
if (input.message !== void 0) save.message = input.message;
|
|
31877
|
+
const response = await client.timeDrafts.save(slug, save);
|
|
31878
|
+
return { data: response.result };
|
|
31879
|
+
}
|
|
31880
|
+
}),
|
|
31881
|
+
define({
|
|
31882
|
+
name: "client_billing",
|
|
31883
|
+
description: "A client's billing months, newest first: each month's hours and whether it is open, closed or invoiced.",
|
|
31884
|
+
schema: external_exports.object({
|
|
31885
|
+
...workspaceFields,
|
|
31886
|
+
client: external_exports.string().describe("Client (initiative) id or name.")
|
|
31887
|
+
}),
|
|
31888
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31889
|
+
const slug = requireWorkspace(config2, input);
|
|
31890
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31891
|
+
const billing = await client.clients.billing(slug, clientId);
|
|
31892
|
+
return {
|
|
31893
|
+
data: billing,
|
|
31894
|
+
lines: billing.months.map(
|
|
31895
|
+
(month) => `${month.month}: ${formatMinutes(month.total)} logged, ${month.period ? month.period.state : "open"}.`
|
|
31896
|
+
)
|
|
31897
|
+
};
|
|
31898
|
+
}
|
|
31899
|
+
}),
|
|
31900
|
+
define({
|
|
31901
|
+
name: "billing_period_close",
|
|
31902
|
+
description: "Close a client's month so its hours can no longer be logged, edited or moved (admins only).",
|
|
31903
|
+
schema: external_exports.object({
|
|
31904
|
+
...workspaceFields,
|
|
31905
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31906
|
+
month: billingMonth
|
|
31907
|
+
}),
|
|
31908
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31909
|
+
const slug = requireWorkspace(config2, input);
|
|
31910
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31911
|
+
const response = await client.billingPeriods.close(slug, {
|
|
31912
|
+
clientId,
|
|
31913
|
+
month: input.month
|
|
31914
|
+
});
|
|
31915
|
+
return { data: response.result };
|
|
31916
|
+
}
|
|
31917
|
+
}),
|
|
31918
|
+
define({
|
|
31919
|
+
name: "billing_period_mark_invoiced",
|
|
31920
|
+
description: "Mark a client's month invoiced with an optional reference label, closing it if it is still open (admins only).",
|
|
31921
|
+
schema: external_exports.object({
|
|
31922
|
+
...workspaceFields,
|
|
31923
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31924
|
+
month: billingMonth,
|
|
31925
|
+
invoiceRef: external_exports.string().max(120).optional().describe("Invoice number or reference, to find the invoice elsewhere.")
|
|
31926
|
+
}),
|
|
31927
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31928
|
+
const slug = requireWorkspace(config2, input);
|
|
31929
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31930
|
+
const response = await client.billingPeriods.markInvoiced(slug, {
|
|
31931
|
+
clientId,
|
|
31932
|
+
month: input.month,
|
|
31933
|
+
invoiceRef: input.invoiceRef ?? null
|
|
31934
|
+
});
|
|
31935
|
+
return { data: response.result };
|
|
31936
|
+
}
|
|
31937
|
+
}),
|
|
31938
|
+
define({
|
|
31939
|
+
name: "billing_period_reopen",
|
|
31940
|
+
description: "Reopen a client's closed or invoiced month so its hours can change again (admins only).",
|
|
31941
|
+
schema: external_exports.object({
|
|
31942
|
+
...workspaceFields,
|
|
31943
|
+
client: external_exports.string().describe("Client (initiative) id or name."),
|
|
31944
|
+
month: billingMonth
|
|
31945
|
+
}),
|
|
31946
|
+
run: async ({ client, config: config2 }, input) => {
|
|
31947
|
+
const slug = requireWorkspace(config2, input);
|
|
31948
|
+
const clientId = await resolveClientId(client, slug, input.client);
|
|
31949
|
+
const response = await client.billingPeriods.reopen(slug, {
|
|
31950
|
+
clientId,
|
|
31951
|
+
month: input.month
|
|
31952
|
+
});
|
|
31953
|
+
return { data: response.result };
|
|
31954
|
+
}
|
|
31955
|
+
}),
|
|
31707
31956
|
define({
|
|
31708
31957
|
name: "comment_add",
|
|
31709
31958
|
description: "Comment on a task or a project, optionally replying and mentioning people or agents.",
|