@monadsag/productive-mcp 1.2.48
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/LICENSE +190 -0
- package/NOTICE +6 -0
- package/README.md +353 -0
- package/build/api/bookings-client.js +249 -0
- package/build/api/capacity.js +279 -0
- package/build/api/client.js +1296 -0
- package/build/api/errors.js +50 -0
- package/build/api/invoice-time-entries.js +256 -0
- package/build/api/pages-tree.js +106 -0
- package/build/api/time-entry-notes.js +75 -0
- package/build/api/types.js +1 -0
- package/build/auth/logo.js +21 -0
- package/build/auth/self-resolver.js +61 -0
- package/build/config/index.js +24 -0
- package/build/index.js +15 -0
- package/build/prompts/timesheet.js +285 -0
- package/build/server.js +55 -0
- package/build/tools/absences.js +502 -0
- package/build/tools/activities.js +140 -0
- package/build/tools/bookings.js +531 -0
- package/build/tools/budget-services.js +168 -0
- package/build/tools/budgets.js +276 -0
- package/build/tools/capacity.js +281 -0
- package/build/tools/changeset.js +41 -0
- package/build/tools/comments.js +469 -0
- package/build/tools/companies.js +73 -0
- package/build/tools/custom-field-resolver.js +92 -0
- package/build/tools/custom-fields.js +155 -0
- package/build/tools/folders.js +516 -0
- package/build/tools/include-resolver.js +45 -0
- package/build/tools/invoice-actions.js +476 -0
- package/build/tools/invoice-defaults.js +65 -0
- package/build/tools/invoice-time-entries.js +320 -0
- package/build/tools/invoices.js +657 -0
- package/build/tools/my-tasks.js +100 -0
- package/build/tools/page-children.js +129 -0
- package/build/tools/pages.js +466 -0
- package/build/tools/people.js +147 -0
- package/build/tools/projects.js +77 -0
- package/build/tools/recent-updates.js +112 -0
- package/build/tools/registry.js +409 -0
- package/build/tools/subtasks.js +245 -0
- package/build/tools/task-backlog.js +106 -0
- package/build/tools/task-dependencies.js +244 -0
- package/build/tools/task-list-move.js +65 -0
- package/build/tools/task-lists.js +535 -0
- package/build/tools/task-reposition.js +199 -0
- package/build/tools/task-status.js +178 -0
- package/build/tools/tasks.js +738 -0
- package/build/tools/time-entries.js +736 -0
- package/build/tools/time-entry-approval.js +103 -0
- package/build/tools/time-entry-delete.js +72 -0
- package/build/tools/time-entry-update.js +126 -0
- package/build/tools/timers.js +195 -0
- package/build/tools/todos.js +342 -0
- package/build/tools/tool-helpers.js +114 -0
- package/build/tools/toolsets.js +153 -0
- package/build/tools/whoami.js +64 -0
- package/build/tools/workflow-statuses.js +81 -0
- package/build/utils/errors.js +67 -0
- package/build/utils/mentions.js +98 -0
- package/npm-shrinkwrap.json +1159 -0
- package/package.json +79 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { toMcpError } from '../utils/errors.js';
|
|
3
|
+
/** Coerce "true"/"false" strings to booleans (some MCP clients send strings). */
|
|
4
|
+
const coerceBoolean = z.preprocess((v) => (v === 'true' ? true : v === 'false' ? false : v), z.boolean());
|
|
5
|
+
const listPeopleSchema = z.object({
|
|
6
|
+
company_id: z.string().optional(),
|
|
7
|
+
project_id: z.string().optional(),
|
|
8
|
+
is_active: coerceBoolean.default(true),
|
|
9
|
+
email: z.string().optional(),
|
|
10
|
+
limit: z.coerce.number().min(1).max(200).default(30),
|
|
11
|
+
});
|
|
12
|
+
const getPersonSchema = z.object({
|
|
13
|
+
person_id: z.string().min(1, 'Person ID is required'),
|
|
14
|
+
});
|
|
15
|
+
export async function listPeopleTool(client, args) {
|
|
16
|
+
try {
|
|
17
|
+
const params = listPeopleSchema.parse(args || {});
|
|
18
|
+
const response = await client.listPeople({
|
|
19
|
+
company_id: params.company_id,
|
|
20
|
+
project_id: params.project_id,
|
|
21
|
+
is_active: params.is_active,
|
|
22
|
+
email: params.email,
|
|
23
|
+
limit: params.limit,
|
|
24
|
+
});
|
|
25
|
+
if (!response || !response.data || response.data.length === 0) {
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: 'No people found matching the criteria.',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const peopleText = response.data
|
|
36
|
+
.filter((person) => person && person.attributes)
|
|
37
|
+
.map((person) => {
|
|
38
|
+
const attrs = person.attributes;
|
|
39
|
+
const name = [attrs.first_name, attrs.last_name].filter(Boolean).join(' ');
|
|
40
|
+
const lines = [`• ${name} (ID: ${person.id})`];
|
|
41
|
+
if (attrs.email)
|
|
42
|
+
lines.push(` Email: ${attrs.email}`);
|
|
43
|
+
if (attrs.title)
|
|
44
|
+
lines.push(` Title: ${attrs.title}`);
|
|
45
|
+
lines.push(` Active: ${attrs.deactivated_at ? 'no' : 'yes'}`);
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
})
|
|
48
|
+
.join('\n\n');
|
|
49
|
+
const summary = `Found ${response.data.length} ${response.data.length !== 1 ? 'people' : 'person'}${response.meta?.total_count ? ` (showing ${response.data.length} of ${response.meta.total_count})` : ''}:\n\n${peopleText}`;
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: 'text',
|
|
54
|
+
text: summary,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw toMcpError(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export async function getPersonTool(client, args) {
|
|
64
|
+
try {
|
|
65
|
+
const params = getPersonSchema.parse(args);
|
|
66
|
+
const response = await client.getPerson(params.person_id);
|
|
67
|
+
if (!response || !response.data) {
|
|
68
|
+
return {
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: 'text',
|
|
72
|
+
text: `No person found with ID: ${params.person_id}`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const person = response.data;
|
|
78
|
+
const attrs = person.attributes;
|
|
79
|
+
const name = [attrs.first_name, attrs.last_name].filter(Boolean).join(' ');
|
|
80
|
+
const lines = [`${name} (ID: ${person.id})`, `Email: ${attrs.email}`];
|
|
81
|
+
if (attrs.title)
|
|
82
|
+
lines.push(`Title: ${attrs.title}`);
|
|
83
|
+
lines.push(`Active: ${attrs.deactivated_at ? 'no' : 'yes'}`);
|
|
84
|
+
if (attrs.created_at)
|
|
85
|
+
lines.push(`Created: ${attrs.created_at}`);
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: 'text',
|
|
90
|
+
text: lines.join('\n'),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw toMcpError(error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export const listPeopleDefinition = {
|
|
100
|
+
name: 'list_people',
|
|
101
|
+
description: 'List people/members in the organization. Use project_id to see who is on a specific project, or company_id to filter by client. Returns person IDs usable anywhere a person_id is required (e.g. create_time_entry, task assignment).',
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
properties: {
|
|
105
|
+
company_id: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
description: 'Filter people by company ID',
|
|
108
|
+
},
|
|
109
|
+
project_id: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: 'Filter people by project ID (shows who is on a project)',
|
|
112
|
+
},
|
|
113
|
+
is_active: {
|
|
114
|
+
type: 'boolean',
|
|
115
|
+
description: 'Filter by active status (default: true)',
|
|
116
|
+
default: true,
|
|
117
|
+
},
|
|
118
|
+
email: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
description: 'Filter by email address',
|
|
121
|
+
},
|
|
122
|
+
limit: {
|
|
123
|
+
type: 'number',
|
|
124
|
+
description: 'Number of people to return (1-200, default 30)',
|
|
125
|
+
minimum: 1,
|
|
126
|
+
maximum: 200,
|
|
127
|
+
default: 30,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
annotations: { title: 'List people', readOnlyHint: true, openWorldHint: true },
|
|
132
|
+
};
|
|
133
|
+
export const getPersonDefinition = {
|
|
134
|
+
name: 'get_person',
|
|
135
|
+
description: 'Get details of a specific person by their ID.',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
person_id: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'The ID of the person to retrieve (required)',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
required: ['person_id'],
|
|
145
|
+
},
|
|
146
|
+
annotations: { title: 'Get person', readOnlyHint: true, openWorldHint: true },
|
|
147
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildIncludeMap, resolveName } from './include-resolver.js';
|
|
3
|
+
import { toMcpError } from '../utils/errors.js';
|
|
4
|
+
const listProjectsSchema = z.object({
|
|
5
|
+
status: z.enum(['active', 'archived']).optional(),
|
|
6
|
+
company_id: z.string().optional(),
|
|
7
|
+
limit: z.coerce.number().min(1).max(200).default(30).optional(),
|
|
8
|
+
});
|
|
9
|
+
export async function listProjectsTool(client, args) {
|
|
10
|
+
try {
|
|
11
|
+
const params = listProjectsSchema.parse(args || {});
|
|
12
|
+
const response = await client.listProjects({
|
|
13
|
+
status: params.status,
|
|
14
|
+
company_id: params.company_id,
|
|
15
|
+
limit: params.limit,
|
|
16
|
+
});
|
|
17
|
+
if (!response || !response.data || response.data.length === 0) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: 'No projects found matching the criteria.',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const nameMap = buildIncludeMap(response.included);
|
|
28
|
+
const projectsText = response.data
|
|
29
|
+
.filter((project) => project && project.attributes)
|
|
30
|
+
.map((project) => {
|
|
31
|
+
const companyId = project.relationships?.company?.data?.id;
|
|
32
|
+
const companyName = resolveName(nameMap, 'companies', companyId);
|
|
33
|
+
return `• ${project.attributes.name} (ID: ${project.id})
|
|
34
|
+
Status: ${project.attributes.status}
|
|
35
|
+
${companyName ? `Company: ${companyName}` : companyId ? `Company ID: ${companyId}` : ''}`;
|
|
36
|
+
})
|
|
37
|
+
.join('\n\n');
|
|
38
|
+
const summary = `Found ${response.data.length} project${response.data.length !== 1 ? 's' : ''}${response.meta?.total_count ? ` (showing ${response.data.length} of ${response.meta.total_count})` : ''}:\n\n${projectsText}`;
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: summary,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
throw toMcpError(error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const listProjectsDefinition = {
|
|
53
|
+
name: 'list_projects',
|
|
54
|
+
description: "List projects, optionally filtered by company_id or by active/archived status. Each result includes the project's ID, status, and resolved company name. Use a project ID to scope list_tasks, list_folders, and list_custom_fields to that project — the typical drill-down is list_companies -> list_projects -> list_tasks. Returns 30 results by default; raise limit (max 200) for large workspaces.",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
status: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
enum: ['active', 'archived'],
|
|
61
|
+
description: 'Filter by project status: active or archived',
|
|
62
|
+
},
|
|
63
|
+
company_id: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Filter projects to a single company (get the ID from list_companies)',
|
|
66
|
+
},
|
|
67
|
+
limit: {
|
|
68
|
+
type: 'number',
|
|
69
|
+
description: 'Number of projects to return (default 30, max 200)',
|
|
70
|
+
minimum: 1,
|
|
71
|
+
maximum: 200,
|
|
72
|
+
default: 30,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
annotations: { title: 'List projects', readOnlyHint: true, openWorldHint: true },
|
|
77
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { formatChangeset } from './changeset.js';
|
|
3
|
+
import { toMcpError } from '../utils/errors.js';
|
|
4
|
+
const RecentUpdatesRequestSchema = z.object({
|
|
5
|
+
project_id: z.string().optional(),
|
|
6
|
+
days_back: z.coerce.number().min(1).max(30).default(7),
|
|
7
|
+
limit: z.coerce.number().min(1).max(200).optional(),
|
|
8
|
+
});
|
|
9
|
+
export async function getRecentUpdates(client, args) {
|
|
10
|
+
try {
|
|
11
|
+
const params = RecentUpdatesRequestSchema.parse(args);
|
|
12
|
+
// Calculate date range
|
|
13
|
+
const afterDate = new Date();
|
|
14
|
+
afterDate.setDate(afterDate.getDate() - params.days_back);
|
|
15
|
+
const after = afterDate.toISOString();
|
|
16
|
+
// Get activities for the specified timeframe
|
|
17
|
+
const response = await client.listActivities({
|
|
18
|
+
project_id: params.project_id,
|
|
19
|
+
after,
|
|
20
|
+
event: 'update', // Focus on updates only
|
|
21
|
+
limit: params.limit || 100,
|
|
22
|
+
});
|
|
23
|
+
const activities = response.data;
|
|
24
|
+
// Group activities by item type and summarize
|
|
25
|
+
const summary = {};
|
|
26
|
+
const detailedUpdates = [];
|
|
27
|
+
for (const activity of activities) {
|
|
28
|
+
const itemType = activity.attributes.item_type;
|
|
29
|
+
const itemId = activity.attributes.item_id;
|
|
30
|
+
if (!summary[itemType]) {
|
|
31
|
+
summary[itemType] = { count: 0, items: new Set() };
|
|
32
|
+
}
|
|
33
|
+
summary[itemType].count++;
|
|
34
|
+
summary[itemType].items.add(itemId);
|
|
35
|
+
detailedUpdates.push({
|
|
36
|
+
date: new Date(activity.attributes.created_at).toLocaleString(),
|
|
37
|
+
type: itemType,
|
|
38
|
+
id: itemId,
|
|
39
|
+
changes: formatChangeset(activity.attributes.changeset),
|
|
40
|
+
creator: activity.relationships?.creator?.data?.id,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let output = `## Recent Updates Summary (Last ${params.days_back} Days)\n\n`;
|
|
44
|
+
if (params.project_id) {
|
|
45
|
+
output += `**Project ID:** ${params.project_id}\n\n`;
|
|
46
|
+
}
|
|
47
|
+
if (Object.keys(summary).length === 0) {
|
|
48
|
+
output += 'No updates found in the specified timeframe.';
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
output += '### Summary by Item Type:\n';
|
|
52
|
+
for (const [itemType, data] of Object.entries(summary)) {
|
|
53
|
+
output += `• **${itemType}**: ${data.count} updates across ${data.items.size} items\n`;
|
|
54
|
+
}
|
|
55
|
+
output += '\n### Detailed Updates:\n\n';
|
|
56
|
+
// Sort by date (most recent first)
|
|
57
|
+
detailedUpdates.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
|
58
|
+
for (const update of detailedUpdates) {
|
|
59
|
+
output += `**${update.date}** - ${update.type} (ID: ${update.id})\n`;
|
|
60
|
+
if (update.creator) {
|
|
61
|
+
output += ` 👤 Updated by: Person ID ${update.creator}\n`;
|
|
62
|
+
}
|
|
63
|
+
if (update.changes.length > 0) {
|
|
64
|
+
output += ' 📝 Changes:\n';
|
|
65
|
+
for (const change of update.changes) {
|
|
66
|
+
output += ` • ${change}\n`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
output += '\n';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: output,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw toMcpError(error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const getRecentUpdatesTool = {
|
|
86
|
+
name: 'get_recent_updates',
|
|
87
|
+
description: 'Summarize recent update events (edits only — not creates or deletes) from the last N days (default 7, max 30), grouped by item type with counts plus a chronological detail list. Optionally scope to one project_id. Built on the same activity feed as list_activities; reach for list_activities when you need the raw, fully filterable event stream (including creates/deletes or a custom date range). Creators are shown as raw person IDs, not resolved names.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
project_id: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Optional project ID to filter updates for a specific project',
|
|
94
|
+
},
|
|
95
|
+
days_back: {
|
|
96
|
+
type: 'number',
|
|
97
|
+
description: 'Number of days to look back for recent updates (1-30, default: 7)',
|
|
98
|
+
minimum: 1,
|
|
99
|
+
maximum: 30,
|
|
100
|
+
default: 7,
|
|
101
|
+
},
|
|
102
|
+
limit: {
|
|
103
|
+
type: 'number',
|
|
104
|
+
description: 'Maximum number of updates to analyze (1-200, default: 100)',
|
|
105
|
+
minimum: 1,
|
|
106
|
+
maximum: 200,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
additionalProperties: false,
|
|
110
|
+
},
|
|
111
|
+
annotations: { title: 'Get recent updates', readOnlyHint: true, openWorldHint: true },
|
|
112
|
+
};
|