- API Client: Full Wrike API v4 with OAuth2/token auth, pagination, error handling - 60+ Tools across 14 categories: tasks, folders, projects, spaces, contacts, comments, timelogs, attachments, workflows, custom-fields, approvals, groups, invitations, webhooks - 22 React Apps: task-dashboard, task-detail, task-grid, task-board, project-dashboard, project-detail, project-grid, folder-tree, space-overview, gantt-view, time-dashboard, time-entries, member-workload, comment-thread, approval-manager, workflow-editor, custom-fields-manager, attachment-gallery, search-results, activity-feed, sprint-board, reports-dashboard - All apps: dark theme, client-side state, standalone directories - Full TypeScript types for all Wrike API entities - Comprehensive README with setup instructions Replaces single-file stub with production-ready MCP server
198 lines
5.6 KiB
TypeScript
198 lines
5.6 KiB
TypeScript
// Wrike Projects Tools
|
|
|
|
import { WrikeClient } from '../clients/wrike.js';
|
|
|
|
export function registerProjectsTools(client: WrikeClient) {
|
|
return [
|
|
{
|
|
name: 'wrike_list_projects',
|
|
description: 'List all projects',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
descendants: {
|
|
type: 'boolean',
|
|
description: 'Include descendant projects',
|
|
},
|
|
deleted: {
|
|
type: 'boolean',
|
|
description: 'Include deleted projects',
|
|
},
|
|
updatedDate: {
|
|
type: 'string',
|
|
description: 'Filter by updated date',
|
|
},
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const folders = await client.listFolders({ ...args, project: true });
|
|
const projects = folders.filter(f => f.project);
|
|
return { projects, count: projects.length };
|
|
},
|
|
},
|
|
{
|
|
name: 'wrike_get_project',
|
|
description: 'Get details of a specific project',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
projectId: {
|
|
type: 'string',
|
|
description: 'Project ID (folder ID)',
|
|
},
|
|
},
|
|
required: ['projectId'],
|
|
},
|
|
handler: async (args: any) => {
|
|
const project = await client.getFolder(args.projectId);
|
|
return { project };
|
|
},
|
|
},
|
|
{
|
|
name: 'wrike_create_project',
|
|
description: 'Create a new project',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
parentFolderId: {
|
|
type: 'string',
|
|
description: 'Parent folder ID',
|
|
},
|
|
title: {
|
|
type: 'string',
|
|
description: 'Project title',
|
|
},
|
|
description: {
|
|
type: 'string',
|
|
description: 'Project description',
|
|
},
|
|
ownerIds: {
|
|
type: 'array',
|
|
items: { type: 'string' },
|
|
description: 'Project owner user IDs',
|
|
},
|
|
status: {
|
|
type: 'string',
|
|
description: 'Project status',
|
|
enum: ['Green', 'Yellow', 'Red', 'Completed', 'OnHold', 'Cancelled'],
|
|
},
|
|
startDate: {
|
|
type: 'string',
|
|
description: 'Project start date (ISO 8601)',
|
|
},
|
|
endDate: {
|
|
type: 'string',
|
|
description: 'Project end date (ISO 8601)',
|
|
},
|
|
},
|
|
required: ['parentFolderId', 'title'],
|
|
},
|
|
handler: async (args: any) => {
|
|
const { parentFolderId, title, description, ownerIds, status, startDate, endDate } = args;
|
|
const project = await client.createFolder(parentFolderId, {
|
|
title,
|
|
description,
|
|
project: {
|
|
ownerIds,
|
|
status,
|
|
startDate,
|
|
endDate,
|
|
},
|
|
});
|
|
return { project, message: 'Project created successfully' };
|
|
},
|
|
},
|
|
{
|
|
name: 'wrike_update_project',
|
|
description: 'Update an existing project',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
projectId: {
|
|
type: 'string',
|
|
description: 'Project ID',
|
|
},
|
|
title: {
|
|
type: 'string',
|
|
description: 'New project title',
|
|
},
|
|
description: {
|
|
type: 'string',
|
|
description: 'New project description',
|
|
},
|
|
ownerIds: {
|
|
type: 'array',
|
|
items: { type: 'string' },
|
|
description: 'Updated owner IDs',
|
|
},
|
|
status: {
|
|
type: 'string',
|
|
description: 'Updated project status',
|
|
enum: ['Green', 'Yellow', 'Red', 'Completed', 'OnHold', 'Cancelled'],
|
|
},
|
|
startDate: {
|
|
type: 'string',
|
|
description: 'Updated start date',
|
|
},
|
|
endDate: {
|
|
type: 'string',
|
|
description: 'Updated end date',
|
|
},
|
|
},
|
|
required: ['projectId'],
|
|
},
|
|
handler: async (args: any) => {
|
|
const { projectId, title, description, ...projectFields } = args;
|
|
const updateData: any = {};
|
|
if (title) updateData.title = title;
|
|
if (description) updateData.description = description;
|
|
if (Object.keys(projectFields).length > 0) {
|
|
updateData.project = projectFields;
|
|
}
|
|
const project = await client.updateFolder(projectId, updateData);
|
|
return { project, message: 'Project updated successfully' };
|
|
},
|
|
},
|
|
{
|
|
name: 'wrike_delete_project',
|
|
description: 'Delete a project',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
projectId: {
|
|
type: 'string',
|
|
description: 'Project ID',
|
|
},
|
|
},
|
|
required: ['projectId'],
|
|
},
|
|
handler: async (args: any) => {
|
|
await client.deleteFolder(args.projectId);
|
|
return { message: 'Project deleted successfully', projectId: args.projectId };
|
|
},
|
|
},
|
|
{
|
|
name: 'wrike_list_project_tasks',
|
|
description: 'List all tasks in a project',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
projectId: {
|
|
type: 'string',
|
|
description: 'Project ID',
|
|
},
|
|
descendants: {
|
|
type: 'boolean',
|
|
description: 'Include tasks from descendant folders',
|
|
},
|
|
},
|
|
required: ['projectId'],
|
|
},
|
|
handler: async (args: any) => {
|
|
const tasks = await client.listTasks(args.projectId, { descendants: args.descendants });
|
|
return { tasks, count: tasks.length };
|
|
},
|
|
},
|
|
];
|
|
}
|