@studiometa/productive-mcp 0.6.4 → 0.7.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B2DTeltj.js","sources":["../src/formatters.ts","../src/handlers/utils.ts","../src/handlers/bookings.ts","../src/handlers/comments.ts","../src/handlers/companies.ts","../src/handlers/deals.ts","../src/handlers/help.ts","../src/handlers/people.ts","../src/handlers/projects.ts","../src/handlers/reports.ts","../src/handlers/services.ts","../src/handlers/tasks.ts","../src/handlers/time.ts","../src/handlers/timers.ts","../src/handlers/index.ts"],"sourcesContent":["/**\n * Response formatters for agent-friendly output\n *\n * This module re-exports formatters from @studiometa/productive-cli\n * with MCP-specific defaults (no relationship IDs, no timestamps).\n *\n * Supports compact mode to reduce token usage by omitting verbose fields\n * like descriptions and notes from list responses.\n */\n\nimport {\n formatTimeEntry as cliFormatTimeEntry,\n formatProject as cliFormatProject,\n formatTask as cliFormatTask,\n formatPerson as cliFormatPerson,\n formatService as cliFormatService,\n formatCompany as cliFormatCompany,\n formatComment as cliFormatComment,\n formatTimer as cliFormatTimer,\n formatDeal as cliFormatDeal,\n formatBooking as cliFormatBooking,\n formatListResponse as cliFormatListResponse,\n type JsonApiResource,\n type JsonApiMeta,\n type FormatOptions,\n type FormattedPagination,\n} from '@studiometa/productive-cli';\n\n// Re-export types\nexport type { JsonApiResource, JsonApiMeta, FormatOptions, FormattedPagination };\n\n/**\n * MCP-specific format options\n * - No relationship IDs (cleaner output for agents)\n * - No timestamps (reduce noise)\n * - HTML stripping enabled\n */\nconst MCP_FORMAT_OPTIONS: FormatOptions = {\n includeRelationshipIds: false,\n includeTimestamps: false,\n stripHtml: true,\n};\n\n/**\n * Extended format options for MCP with compact mode\n */\nexport interface McpFormatOptions {\n compact?: boolean;\n included?: JsonApiResource[];\n}\n\n/**\n * Remove verbose fields from an object for compact output\n */\nfunction compactify<T extends Record<string, unknown>>(obj: T, fieldsToRemove: string[]): T {\n const result = { ...obj };\n for (const field of fieldsToRemove) {\n delete result[field];\n }\n return result;\n}\n\n/**\n * Format time entry for agent consumption\n */\nexport function formatTimeEntry(\n entry: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatTimeEntry(entry, MCP_FORMAT_OPTIONS);\n if (options?.compact) {\n return compactify(result, ['note', 'billable_time', 'approved']);\n }\n return result;\n}\n\n/**\n * Format project for agent consumption\n */\nexport function formatProject(\n project: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatProject(project, MCP_FORMAT_OPTIONS);\n if (options?.compact) {\n return compactify(result, ['budget']);\n }\n return result;\n}\n\n/**\n * Format task for agent consumption\n * Tasks use included resources to resolve project/company names\n */\nexport function formatTask(\n task: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatTask(task, { ...MCP_FORMAT_OPTIONS, included: options?.included });\n if (options?.compact) {\n return compactify(result, [\n 'description',\n 'initial_estimate',\n 'worked_time',\n 'remaining_time',\n 'project', // Keep project_name but remove nested object\n 'company', // Keep company name inline if needed\n ]);\n }\n return result;\n}\n\n/**\n * Format person for agent consumption\n */\nexport function formatPerson(\n person: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatPerson(person, MCP_FORMAT_OPTIONS);\n if (options?.compact) {\n return compactify(result, ['title', 'first_name', 'last_name']); // Keep 'name' which combines them\n }\n return result;\n}\n\n/**\n * Format service for agent consumption\n */\nexport function formatService(\n service: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatService(service, MCP_FORMAT_OPTIONS);\n if (options?.compact) {\n return compactify(result, ['budgeted_time', 'worked_time']);\n }\n return result;\n}\n\n/**\n * Format company for agent consumption\n */\nexport function formatCompany(\n company: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatCompany(company, MCP_FORMAT_OPTIONS);\n if (options?.compact) {\n return compactify(result, ['billing_name', 'domain', 'due_days']);\n }\n return result;\n}\n\n/**\n * Format comment for agent consumption\n */\nexport function formatComment(\n comment: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatComment(comment, { ...MCP_FORMAT_OPTIONS, included: options?.included });\n return result;\n}\n\n/**\n * Format timer for agent consumption\n */\nexport function formatTimer(\n timer: JsonApiResource,\n _options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatTimer(timer, MCP_FORMAT_OPTIONS);\n return result;\n}\n\n/**\n * Format deal for agent consumption\n */\nexport function formatDeal(\n deal: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatDeal(deal, { ...MCP_FORMAT_OPTIONS, included: options?.included });\n if (options?.compact) {\n return compactify(result, ['won_at', 'lost_at']);\n }\n return result;\n}\n\n/**\n * Format booking for agent consumption\n */\nexport function formatBooking(\n booking: JsonApiResource,\n options?: McpFormatOptions,\n): Record<string, unknown> {\n const result = cliFormatBooking(booking, { ...MCP_FORMAT_OPTIONS, included: options?.included });\n if (options?.compact) {\n return compactify(result, ['approved_at', 'rejected_at', 'rejected_reason']);\n }\n return result;\n}\n\n/**\n * Format list response with pagination\n *\n * @param data - Array of JSON:API resources\n * @param formatter - Formatter function (item, options?) => T\n * @param meta - Pagination metadata\n * @param options - MCP format options (compact, included)\n */\nexport function formatListResponse<T>(\n data: JsonApiResource[],\n formatter: (item: JsonApiResource, options?: McpFormatOptions) => T,\n meta?: JsonApiMeta,\n options?: McpFormatOptions,\n): { data: T[]; meta?: FormattedPagination } {\n // Create a wrapper that passes MCP options to the formatter\n const wrappedFormatter = (item: JsonApiResource, _cliOptions?: FormatOptions) => {\n return formatter(item, options);\n };\n\n const result = cliFormatListResponse(data, wrappedFormatter, meta, {\n ...MCP_FORMAT_OPTIONS,\n included: options?.included,\n });\n\n return result as { data: T[]; meta?: FormattedPagination };\n}\n","/**\n * Utility functions for resource handlers\n */\n\nimport type { ToolResult } from './types.js';\n\n/**\n * Helper to create a successful JSON response\n */\nexport function jsonResult(data: unknown): ToolResult {\n return {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n}\n\n/**\n * Helper to create an error response\n */\nexport function errorResult(message: string): ToolResult {\n return {\n content: [{ type: 'text', text: `Error: ${message}` }],\n isError: true,\n };\n}\n\n/**\n * Convert unknown filter to string filter for API\n */\nexport function toStringFilter(\n filter?: Record<string, unknown>,\n): Record<string, string> | undefined {\n if (!filter) return undefined;\n const result: Record<string, string> = {};\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null) {\n result[key] = String(value);\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n","/**\n * Bookings resource handler\n */\n\nimport type { HandlerContext, BookingArgs, ToolResult } from './types.js';\n\nimport { formatBooking, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\n/** Default includes for bookings */\nconst DEFAULT_BOOKING_INCLUDE = ['person', 'service'];\n\nexport async function handleBookings(\n action: string,\n args: BookingArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage, include: userInclude } = ctx;\n const { id, person_id, service_id, event_id, started_on, ended_on, time, note } = args;\n // Merge default includes with user-provided includes\n const include = userInclude?.length\n ? [...new Set([...DEFAULT_BOOKING_INCLUDE, ...userInclude])]\n : DEFAULT_BOOKING_INCLUDE;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getBooking(id, { include });\n return jsonResult(formatBooking(result.data, { ...formatOptions, included: result.included }));\n }\n\n if (action === 'create') {\n if (!person_id || !started_on || !ended_on) {\n return errorResult('person_id, started_on, and ended_on are required for create');\n }\n if (!service_id && !event_id) {\n return errorResult('service_id or event_id is required for create');\n }\n const result = await api.createBooking({\n person_id,\n service_id,\n event_id,\n started_on,\n ended_on,\n time,\n note,\n });\n return jsonResult({ success: true, ...formatBooking(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n const updateData: Parameters<typeof api.updateBooking>[1] = {};\n if (started_on !== undefined) updateData.started_on = started_on;\n if (ended_on !== undefined) updateData.ended_on = ended_on;\n if (time !== undefined) updateData.time = time;\n if (note !== undefined) updateData.note = note;\n const result = await api.updateBooking(id, updateData);\n return jsonResult({ success: true, ...formatBooking(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getBookings({ filter, page, perPage, include });\n return jsonResult(\n formatListResponse(result.data, formatBooking, result.meta, {\n ...formatOptions,\n included: result.included,\n }),\n );\n }\n\n return errorResult(`Invalid action \"${action}\" for bookings. Use: list, get, create, update`);\n}\n","/**\n * Comments resource handler\n */\n\nimport type { HandlerContext, CommentArgs, ToolResult } from './types.js';\n\nimport { formatComment, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\n/** Default includes for comments */\nconst DEFAULT_COMMENT_INCLUDE = ['creator'];\n\nexport async function handleComments(\n action: string,\n args: CommentArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage, include: userInclude } = ctx;\n const { id, body, task_id, deal_id, company_id } = args;\n // Merge default includes with user-provided includes\n const include = userInclude?.length\n ? [...new Set([...DEFAULT_COMMENT_INCLUDE, ...userInclude])]\n : DEFAULT_COMMENT_INCLUDE;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getComment(id, { include });\n return jsonResult(formatComment(result.data, { ...formatOptions, included: result.included }));\n }\n\n if (action === 'create') {\n if (!body) return errorResult('body is required for create');\n if (!task_id && !deal_id && !company_id) {\n return errorResult('task_id, deal_id, or company_id is required for create');\n }\n const result = await api.createComment({\n body,\n task_id,\n deal_id,\n company_id,\n });\n return jsonResult({ success: true, ...formatComment(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n if (!body) return errorResult('body is required for update');\n const result = await api.updateComment(id, { body });\n return jsonResult({ success: true, ...formatComment(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getComments({ filter, page, perPage, include });\n return jsonResult(\n formatListResponse(result.data, formatComment, result.meta, {\n ...formatOptions,\n included: result.included,\n }),\n );\n }\n\n return errorResult(`Invalid action \"${action}\" for comments. Use: list, get, create, update`);\n}\n","/**\n * Companies resource handler\n */\n\nimport type { HandlerContext, CompanyArgs, ToolResult } from './types.js';\n\nimport { formatCompany, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handleCompanies(\n action: string,\n args: CompanyArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage } = ctx;\n const { id, name } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getCompany(id);\n return jsonResult(formatCompany(result.data, formatOptions));\n }\n\n if (action === 'create') {\n if (!name) return errorResult('name is required for create');\n const result = await api.createCompany({ name });\n return jsonResult({ success: true, ...formatCompany(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n const updateData: Parameters<typeof api.updateCompany>[1] = {};\n if (name !== undefined) updateData.name = name;\n const result = await api.updateCompany(id, updateData);\n return jsonResult({ success: true, ...formatCompany(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getCompanies({ filter, page, perPage });\n return jsonResult(formatListResponse(result.data, formatCompany, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for companies. Use: list, get, create, update`);\n}\n","/**\n * Deals resource handler\n */\n\nimport type { HandlerContext, DealArgs, ToolResult } from './types.js';\n\nimport { formatDeal, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\n/** Default includes for deals */\nconst DEFAULT_DEAL_INCLUDE_GET = ['company', 'deal_status', 'responsible'];\nconst DEFAULT_DEAL_INCLUDE_LIST = ['company', 'deal_status'];\n\nexport async function handleDeals(\n action: string,\n args: DealArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage, include: userInclude } = ctx;\n const { id, name, company_id } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const include = userInclude?.length\n ? [...new Set([...DEFAULT_DEAL_INCLUDE_GET, ...userInclude])]\n : DEFAULT_DEAL_INCLUDE_GET;\n const result = await api.getDeal(id, { include });\n return jsonResult(formatDeal(result.data, { ...formatOptions, included: result.included }));\n }\n\n if (action === 'create') {\n if (!name || !company_id) {\n return errorResult('name and company_id are required for create');\n }\n const result = await api.createDeal({ name, company_id });\n return jsonResult({ success: true, ...formatDeal(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n const updateData: Parameters<typeof api.updateDeal>[1] = {};\n if (name !== undefined) updateData.name = name;\n const result = await api.updateDeal(id, updateData);\n return jsonResult({ success: true, ...formatDeal(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const include = userInclude?.length\n ? [...new Set([...DEFAULT_DEAL_INCLUDE_LIST, ...userInclude])]\n : DEFAULT_DEAL_INCLUDE_LIST;\n const result = await api.getDeals({\n filter,\n page,\n perPage,\n include,\n });\n return jsonResult(\n formatListResponse(result.data, formatDeal, result.meta, {\n ...formatOptions,\n included: result.included,\n }),\n );\n }\n\n return errorResult(`Invalid action \"${action}\" for deals. Use: list, get, create, update`);\n}\n","/**\n * Help handler - provides detailed documentation for each resource\n */\n\nimport type { ToolResult } from './types.js';\n\nimport { jsonResult } from './utils.js';\n\ninterface ResourceHelp {\n description: string;\n actions: Record<string, string>;\n filters?: Record<string, string>;\n includes?: string[];\n fields?: Record<string, string>;\n examples?: Array<{ description: string; params: Record<string, unknown> }>;\n}\n\nconst RESOURCE_HELP: Record<string, ResourceHelp> = {\n projects: {\n description: 'Manage projects in Productive.io',\n actions: {\n list: 'List all projects with optional filters',\n get: 'Get a single project by ID with full details',\n },\n filters: {\n query: 'Text search on project name',\n project_type_id: 'Filter by project type',\n company_id: 'Filter by company',\n archived: 'Filter by archived status (true/false)',\n },\n fields: {\n id: 'Unique project identifier',\n name: 'Project name',\n project_number: 'Project reference number',\n archived: 'Whether the project is archived',\n budget: 'Project budget amount',\n },\n examples: [\n {\n description: 'Search projects by name',\n params: { resource: 'projects', action: 'list', query: 'website' },\n },\n {\n description: 'List active projects',\n params: { resource: 'projects', action: 'list', filter: { archived: 'false' } },\n },\n {\n description: 'Get project details',\n params: { resource: 'projects', action: 'get', id: '12345' },\n },\n ],\n },\n\n tasks: {\n description: 'Manage tasks within projects',\n actions: {\n list: 'List tasks with optional filters',\n get: 'Get a single task by ID with full details (description, comments, etc.)',\n create: 'Create a new task (requires title, project_id, task_list_id)',\n update: 'Update an existing task',\n },\n filters: {\n query: 'Text search on task title',\n project_id: 'Filter by project',\n assignee_id: 'Filter by assigned person',\n status: 'Filter by status (open, closed, all)',\n task_list_id: 'Filter by task list',\n },\n includes: [\n 'project',\n 'project.company',\n 'assignee',\n 'workflow_status',\n 'comments',\n 'attachments',\n 'subtasks',\n ],\n fields: {\n id: 'Unique task identifier',\n title: 'Task title',\n description: 'Full task description (HTML)',\n number: 'Task number within project',\n due_date: 'Due date (YYYY-MM-DD)',\n initial_estimate: 'Estimated time in minutes',\n worked_time: 'Logged time in minutes',\n remaining_time: 'Remaining time in minutes',\n closed: 'Whether the task is closed',\n },\n examples: [\n {\n description: 'Search tasks by title',\n params: { resource: 'tasks', action: 'list', query: 'bug fix' },\n },\n {\n description: 'List open tasks for a project',\n params: {\n resource: 'tasks',\n action: 'list',\n filter: { project_id: '12345', status: 'open' },\n },\n },\n {\n description: 'Get task with comments',\n params: {\n resource: 'tasks',\n action: 'get',\n id: '67890',\n include: ['comments', 'assignee'],\n },\n },\n {\n description: 'Create a task',\n params: {\n resource: 'tasks',\n action: 'create',\n title: 'New task',\n project_id: '12345',\n task_list_id: '111',\n },\n },\n ],\n },\n\n time: {\n description: 'Track time entries against services/tasks',\n actions: {\n list: 'List time entries with optional filters',\n get: 'Get a single time entry by ID',\n create: 'Create a new time entry (requires person_id, service_id, date, time)',\n update: 'Update an existing time entry',\n },\n filters: {\n person_id: 'Filter by person',\n service_id: 'Filter by service',\n project_id: 'Filter by project',\n after: 'Filter entries after date (YYYY-MM-DD)',\n before: 'Filter entries before date (YYYY-MM-DD)',\n },\n fields: {\n id: 'Unique time entry identifier',\n date: 'Date of the entry (YYYY-MM-DD)',\n time: 'Time in minutes',\n note: 'Description of work done',\n billable_time: 'Billable time in minutes',\n approved: 'Whether the entry is approved',\n },\n examples: [\n {\n description: 'List my time entries this week',\n params: {\n resource: 'time',\n action: 'list',\n filter: { person_id: 'me', after: '2024-01-15', before: '2024-01-21' },\n },\n },\n {\n description: 'Log 2 hours',\n params: {\n resource: 'time',\n action: 'create',\n service_id: '12345',\n date: '2024-01-16',\n time: 120,\n note: 'Development work',\n },\n },\n ],\n },\n\n services: {\n description: 'Budget line items within projects',\n actions: {\n list: 'List services with optional filters',\n get: 'Get a single service by ID',\n },\n filters: {\n project_id: 'Filter by project',\n deal_id: 'Filter by deal',\n },\n fields: {\n id: 'Unique service identifier',\n name: 'Service name',\n budgeted_time: 'Budgeted time in minutes',\n worked_time: 'Logged time in minutes',\n },\n examples: [\n {\n description: 'List services for a project',\n params: { resource: 'services', action: 'list', filter: { project_id: '12345' } },\n },\n ],\n },\n\n people: {\n description: 'Team members and contacts',\n actions: {\n list: 'List people with optional filters',\n get: 'Get a single person by ID',\n me: 'Get the currently authenticated user',\n },\n filters: {\n query: 'Text search on name or email',\n status: 'Filter by status (active, inactive)',\n },\n fields: {\n id: 'Unique person identifier',\n name: 'Full name',\n first_name: 'First name',\n last_name: 'Last name',\n email: 'Email address',\n title: 'Job title',\n active: 'Whether the person is active',\n },\n examples: [\n { description: 'Get current user', params: { resource: 'people', action: 'me' } },\n {\n description: 'Search people by name',\n params: { resource: 'people', action: 'list', query: 'john' },\n },\n {\n description: 'List active team members',\n params: { resource: 'people', action: 'list', filter: { status: 'active' } },\n },\n ],\n },\n\n companies: {\n description: 'Client companies and organizations',\n actions: {\n list: 'List companies with optional filters',\n get: 'Get a single company by ID',\n create: 'Create a new company (requires name)',\n update: 'Update an existing company',\n },\n filters: {\n query: 'Text search on company name',\n archived: 'Filter by archived status (true/false)',\n },\n fields: {\n id: 'Unique company identifier',\n name: 'Company name',\n billing_name: 'Legal/billing name',\n domain: 'Website domain',\n vat: 'VAT number',\n },\n examples: [\n {\n description: 'Search companies',\n params: { resource: 'companies', action: 'list', query: 'acme' },\n },\n {\n description: 'List active companies',\n params: { resource: 'companies', action: 'list', filter: { archived: 'false' } },\n },\n ],\n },\n\n comments: {\n description: 'Comments on tasks, deals, and other resources',\n actions: {\n list: 'List comments with optional filters',\n get: 'Get a single comment by ID',\n create: 'Create a new comment (requires body and one of: task_id, deal_id, company_id)',\n update: 'Update an existing comment',\n },\n filters: {\n task_id: 'Filter by task',\n deal_id: 'Filter by deal',\n },\n includes: ['creator', 'task', 'deal'],\n fields: {\n id: 'Unique comment identifier',\n body: 'Comment text (may contain HTML)',\n creator: 'Person who created the comment',\n },\n examples: [\n {\n description: 'List comments on a task',\n params: { resource: 'comments', action: 'list', filter: { task_id: '12345' } },\n },\n {\n description: 'Add a comment',\n params: { resource: 'comments', action: 'create', task_id: '12345', body: 'Looking good!' },\n },\n ],\n },\n\n timers: {\n description: 'Active time tracking timers',\n actions: {\n list: 'List active timers',\n get: 'Get a single timer by ID',\n start: 'Start a new timer (requires service_id or time_entry_id)',\n stop: 'Stop an active timer by ID',\n },\n fields: {\n id: 'Unique timer identifier',\n started_at: 'When the timer started (ISO 8601)',\n total_time: 'Elapsed time in seconds',\n },\n examples: [\n { description: 'List active timers', params: { resource: 'timers', action: 'list' } },\n {\n description: 'Start timer on service',\n params: { resource: 'timers', action: 'start', service_id: '12345' },\n },\n { description: 'Stop timer', params: { resource: 'timers', action: 'stop', id: '67890' } },\n ],\n },\n\n deals: {\n description: 'Sales deals and opportunities',\n actions: {\n list: 'List deals with optional filters',\n get: 'Get a single deal by ID',\n create: 'Create a new deal (requires name, company_id)',\n update: 'Update an existing deal',\n },\n filters: {\n query: 'Text search on deal name',\n company_id: 'Filter by company',\n deal_status_id: 'Filter by status',\n },\n includes: ['company', 'deal_status', 'responsible', 'project'],\n fields: {\n id: 'Unique deal identifier',\n name: 'Deal name',\n number: 'Deal number',\n date: 'Deal date',\n status: 'Current status (from deal_status)',\n },\n examples: [\n {\n description: 'Search deals',\n params: { resource: 'deals', action: 'list', query: 'website redesign' },\n },\n {\n description: 'List deals for a company',\n params: { resource: 'deals', action: 'list', filter: { company_id: '12345' } },\n },\n ],\n },\n\n bookings: {\n description: 'Resource scheduling and capacity planning',\n actions: {\n list: 'List bookings with optional filters',\n get: 'Get a single booking by ID',\n create:\n 'Create a new booking (requires person_id, started_on, ended_on, and service_id or event_id)',\n update: 'Update an existing booking',\n },\n filters: {\n person_id: 'Filter by person',\n service_id: 'Filter by service',\n after: 'Filter bookings after date (YYYY-MM-DD)',\n before: 'Filter bookings before date (YYYY-MM-DD)',\n },\n includes: ['person', 'service', 'event'],\n fields: {\n id: 'Unique booking identifier',\n started_on: 'Start date (YYYY-MM-DD)',\n ended_on: 'End date (YYYY-MM-DD)',\n time: 'Time per day in minutes',\n total_time: 'Total booked time in minutes',\n note: 'Booking note',\n },\n examples: [\n {\n description: 'List my bookings',\n params: { resource: 'bookings', action: 'list', filter: { person_id: 'me' } },\n },\n ],\n },\n\n reports: {\n description: 'Generate various reports (time, budget, project, etc.)',\n actions: {\n get: 'Generate a report (requires report_type)',\n },\n filters: {\n person_id: 'Filter by person',\n project_id: 'Filter by project',\n company_id: 'Filter by company',\n after: 'Filter from date (YYYY-MM-DD)',\n before: 'Filter to date (YYYY-MM-DD)',\n },\n fields: {\n report_type:\n 'Type of report: time_reports, project_reports, budget_reports, person_reports, invoice_reports, payment_reports, service_reports, task_reports, company_reports, deal_reports, timesheet_reports',\n group: 'Grouping dimension (varies by report type)',\n from: 'Start date for date range',\n to: 'End date for date range',\n },\n examples: [\n {\n description: 'Time report by person',\n params: {\n resource: 'reports',\n action: 'get',\n report_type: 'time_reports',\n group: 'person',\n from: '2024-01-01',\n to: '2024-01-31',\n },\n },\n {\n description: 'Project budget report',\n params: {\n resource: 'reports',\n action: 'get',\n report_type: 'budget_reports',\n filter: { project_id: '12345' },\n },\n },\n ],\n },\n};\n\n/**\n * Handle help action - returns documentation for a specific resource\n */\nexport function handleHelp(resource: string): ToolResult {\n const help = RESOURCE_HELP[resource];\n\n if (!help) {\n return jsonResult({\n error: `Unknown resource: ${resource}`,\n available_resources: Object.keys(RESOURCE_HELP),\n });\n }\n\n return jsonResult({\n resource,\n ...help,\n });\n}\n\n/**\n * Get help for all resources (overview)\n */\nexport function handleHelpOverview(): ToolResult {\n const overview = Object.entries(RESOURCE_HELP).map(([resource, help]) => ({\n resource,\n description: help.description,\n actions: Object.keys(help.actions),\n }));\n\n return jsonResult({\n message: 'Use action=\"help\" with a specific resource for detailed documentation',\n resources: overview,\n });\n}\n","/**\n * People resource handler\n */\n\nimport type { ProductiveCredentials } from '../auth.js';\nimport type { HandlerContext, CommonArgs, ToolResult } from './types.js';\n\nimport { formatPerson, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handlePeople(\n action: string,\n args: CommonArgs,\n ctx: HandlerContext,\n credentials: ProductiveCredentials,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage } = ctx;\n const { id } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getPerson(id);\n return jsonResult(formatPerson(result.data, formatOptions));\n }\n\n if (action === 'me') {\n if (credentials.userId) {\n const result = await api.getPerson(credentials.userId);\n return jsonResult(formatPerson(result.data, formatOptions));\n }\n return jsonResult({\n message: 'User ID not configured. Set userId in credentials to use this action.',\n organizationId: credentials.organizationId,\n });\n }\n\n if (action === 'list') {\n const result = await api.getPeople({ filter, page, perPage });\n return jsonResult(formatListResponse(result.data, formatPerson, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for people. Use: list, get, me`);\n}\n","/**\n * Projects resource handler\n */\n\nimport type { HandlerContext, CommonArgs, ToolResult } from './types.js';\n\nimport { formatProject, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handleProjects(\n action: string,\n args: CommonArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage } = ctx;\n const { id } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getProject(id);\n return jsonResult(formatProject(result.data, formatOptions));\n }\n\n if (action === 'list') {\n const result = await api.getProjects({ filter, page, perPage });\n return jsonResult(formatListResponse(result.data, formatProject, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for projects. Use: list, get`);\n}\n","/**\n * Reports resource handler\n */\n\nimport type { HandlerContext, CommonArgs, ToolResult } from './types.js';\n\nimport { jsonResult, errorResult } from './utils.js';\n\n/**\n * Report-specific args\n */\ninterface ReportArgs extends CommonArgs {\n report_type?: string;\n group?: string;\n from?: string;\n to?: string;\n person_id?: string;\n project_id?: string;\n company_id?: string;\n deal_id?: string;\n status?: string;\n}\n\n/**\n * Format report data for agent consumption\n * Flattens attributes for easier reading\n */\nfunction formatReportData(data: unknown[]): unknown[] {\n return data.map((item: unknown) => {\n const record = item as { id: string; type: string; attributes: Record<string, unknown> };\n return {\n id: record.id,\n type: record.type,\n ...record.attributes,\n };\n });\n}\n\n/**\n * Valid report types\n */\nconst VALID_REPORT_TYPES = [\n 'time_reports',\n 'project_reports',\n 'budget_reports',\n 'person_reports',\n 'invoice_reports',\n 'payment_reports',\n 'service_reports',\n 'task_reports',\n 'company_reports',\n 'deal_reports',\n 'timesheet_reports',\n];\n\nexport async function handleReports(\n action: string,\n args: ReportArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, filter, page, perPage } = ctx;\n const { report_type, group, from, to, person_id, project_id, company_id, deal_id, status } = args;\n\n if (action !== 'get') {\n return errorResult(`Invalid action \"${action}\" for reports. Use: get`);\n }\n\n if (!report_type) {\n return errorResult(`report_type is required. Valid types: ${VALID_REPORT_TYPES.join(', ')}`);\n }\n\n if (!VALID_REPORT_TYPES.includes(report_type)) {\n return errorResult(\n `Invalid report_type \"${report_type}\". Valid types: ${VALID_REPORT_TYPES.join(', ')}`,\n );\n }\n\n // Build filters based on report type\n const reportFilter: Record<string, string> = { ...filter };\n\n // Date filters (different APIs use different param names)\n if (from) {\n if (report_type === 'invoice_reports') {\n reportFilter.invoice_date_after = from;\n } else if (report_type === 'payment_reports' || report_type === 'deal_reports') {\n reportFilter.date_after = from;\n } else {\n reportFilter.after = from;\n }\n }\n\n if (to) {\n if (report_type === 'invoice_reports') {\n reportFilter.invoice_date_before = to;\n } else if (report_type === 'payment_reports' || report_type === 'deal_reports') {\n reportFilter.date_before = to;\n } else {\n reportFilter.before = to;\n }\n }\n\n // Entity filters\n if (person_id) {\n if (report_type === 'task_reports') {\n reportFilter.assignee_id = person_id;\n } else {\n reportFilter.person_id = person_id;\n }\n }\n\n if (project_id) reportFilter.project_id = project_id;\n if (company_id) reportFilter.company_id = company_id;\n if (deal_id) {\n if (report_type === 'deal_reports') {\n reportFilter.deal_status_id = deal_id;\n } else {\n reportFilter.deal_id = deal_id;\n }\n }\n if (status) {\n if (report_type === 'deal_reports') {\n reportFilter.deal_status_id = status;\n } else {\n reportFilter.status = status;\n }\n }\n\n // Determine default grouping based on report type\n let effectiveGroup = group;\n if (!effectiveGroup) {\n const defaultGroups: Record<string, string> = {\n time_reports: 'person',\n project_reports: 'project',\n budget_reports: 'deal',\n person_reports: 'person',\n invoice_reports: 'invoice',\n payment_reports: 'payment',\n service_reports: 'service',\n task_reports: 'task',\n company_reports: 'company',\n deal_reports: 'deal',\n };\n effectiveGroup = defaultGroups[report_type];\n }\n\n // Determine include based on report type\n const includeMap: Record<string, string[]> = {\n project_reports: ['project'],\n budget_reports: ['deal'],\n person_reports: ['person'],\n invoice_reports: ['invoice'],\n payment_reports: ['payment'],\n service_reports: ['service'],\n task_reports: ['task'],\n company_reports: ['company'],\n deal_reports: ['deal'],\n timesheet_reports: ['person'],\n };\n const include = includeMap[report_type];\n\n const result = await api.getReports(report_type, {\n page,\n perPage,\n filter: reportFilter,\n group: effectiveGroup,\n include,\n });\n\n const formattedData = formatReportData(result.data);\n\n return jsonResult({\n data: formattedData,\n meta: result.meta,\n });\n}\n","/**\n * Services resource handler\n */\n\nimport type { HandlerContext, CommonArgs, ToolResult } from './types.js';\n\nimport { formatService, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handleServices(\n action: string,\n _args: CommonArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage } = ctx;\n\n if (action === 'list') {\n const result = await api.getServices({ filter, page, perPage });\n return jsonResult(formatListResponse(result.data, formatService, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for services. Use: list`);\n}\n","/**\n * Tasks resource handler\n */\n\nimport type { HandlerContext, TaskArgs, ToolResult } from './types.js';\n\nimport { formatTask, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\n/** Default includes for tasks */\nconst DEFAULT_TASK_INCLUDE = ['project', 'project.company'];\n\nexport async function handleTasks(\n action: string,\n args: TaskArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage, include: userInclude } = ctx;\n const { id, title, project_id, task_list_id, description, assignee_id } = args;\n // Merge default includes with user-provided includes\n const include = userInclude?.length\n ? [...new Set([...DEFAULT_TASK_INCLUDE, ...userInclude])]\n : DEFAULT_TASK_INCLUDE;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getTask(id, { include });\n return jsonResult(formatTask(result.data, { ...formatOptions, included: result.included }));\n }\n\n if (action === 'create') {\n if (!title || !project_id || !task_list_id) {\n return errorResult('title, project_id, and task_list_id are required for create');\n }\n const result = await api.createTask({\n title,\n project_id,\n task_list_id,\n assignee_id,\n description,\n });\n return jsonResult({ success: true, ...formatTask(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n const updateData: Parameters<typeof api.updateTask>[1] = {};\n if (title !== undefined) updateData.title = title;\n if (description !== undefined) updateData.description = description;\n if (assignee_id !== undefined) updateData.assignee_id = assignee_id;\n const result = await api.updateTask(id, updateData);\n return jsonResult({ success: true, ...formatTask(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getTasks({ filter, page, perPage, include });\n return jsonResult(\n formatListResponse(result.data, formatTask, result.meta, {\n ...formatOptions,\n included: result.included,\n }),\n );\n }\n\n return errorResult(`Invalid action \"${action}\" for tasks. Use: list, get, create, update`);\n}\n","/**\n * Time entries resource handler\n */\n\nimport type { HandlerContext, CommonArgs, ToolResult } from './types.js';\n\nimport { formatTimeEntry, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handleTime(\n action: string,\n args: CommonArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage } = ctx;\n const { id, person_id, service_id, task_id, time, date, note } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getTimeEntry(id);\n return jsonResult(formatTimeEntry(result.data, formatOptions));\n }\n\n if (action === 'create') {\n if (!person_id || !service_id || !time || !date) {\n return errorResult('person_id, service_id, time, and date are required for create');\n }\n const result = await api.createTimeEntry({\n person_id,\n service_id,\n time,\n date,\n note,\n task_id,\n });\n return jsonResult({ success: true, ...formatTimeEntry(result.data, formatOptions) });\n }\n\n if (action === 'update') {\n if (!id) return errorResult('id is required for update action');\n const updateData: Parameters<typeof api.updateTimeEntry>[1] = {};\n if (time !== undefined) updateData.time = time;\n if (date !== undefined) updateData.date = date;\n if (note !== undefined) updateData.note = note;\n const result = await api.updateTimeEntry(id, updateData);\n return jsonResult({ success: true, ...formatTimeEntry(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getTimeEntries({ filter, page, perPage });\n return jsonResult(formatListResponse(result.data, formatTimeEntry, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for time. Use: list, get, create, update`);\n}\n","/**\n * Timers resource handler\n */\n\nimport type { HandlerContext, TimerArgs, ToolResult } from './types.js';\n\nimport { formatTimer, formatListResponse } from '../formatters.js';\nimport { jsonResult, errorResult } from './utils.js';\n\nexport async function handleTimers(\n action: string,\n args: TimerArgs,\n ctx: HandlerContext,\n): Promise<ToolResult> {\n const { api, formatOptions, filter, page, perPage, include } = ctx;\n const { id, service_id, time_entry_id } = args;\n\n if (action === 'get') {\n if (!id) return errorResult('id is required for get action');\n const result = await api.getTimer(id, { include });\n return jsonResult(formatTimer(result.data, formatOptions));\n }\n\n if (action === 'start' || action === 'create') {\n if (!service_id && !time_entry_id) {\n return errorResult('service_id or time_entry_id is required to start a timer');\n }\n const result = await api.startTimer({ service_id, time_entry_id });\n return jsonResult({ success: true, ...formatTimer(result.data, formatOptions) });\n }\n\n if (action === 'stop') {\n if (!id) return errorResult('id is required to stop a timer');\n const result = await api.stopTimer(id);\n return jsonResult({ success: true, ...formatTimer(result.data, formatOptions) });\n }\n\n if (action === 'list') {\n const result = await api.getTimers({ filter, page, perPage, include });\n return jsonResult(formatListResponse(result.data, formatTimer, result.meta, formatOptions));\n }\n\n return errorResult(`Invalid action \"${action}\" for timers. Use: list, get, start, stop`);\n}\n","/**\n * Tool execution handlers for Productive MCP server\n * These are shared between stdio and HTTP transports\n *\n * Single consolidated tool for minimal token overhead:\n * - productive: resource + action based API\n */\n\nimport { ProductiveApi } from '@studiometa/productive-cli';\n\nimport type { ProductiveCredentials } from '../auth.js';\nimport type { McpFormatOptions } from '../formatters.js';\nimport type { ToolResult, HandlerContext } from './types.js';\n\nimport { handleBookings } from './bookings.js';\nimport { handleComments } from './comments.js';\nimport { handleCompanies } from './companies.js';\nimport { handleDeals } from './deals.js';\nimport { handleHelp, handleHelpOverview } from './help.js';\nimport { handlePeople } from './people.js';\n// Resource handlers\nimport { handleProjects } from './projects.js';\nimport { handleReports } from './reports.js';\nimport { handleServices } from './services.js';\nimport { handleTasks } from './tasks.js';\nimport { handleTime } from './time.js';\nimport { handleTimers } from './timers.js';\nimport { toStringFilter, errorResult } from './utils.js';\n\n// Re-export types\nexport type { ToolResult } from './types.js';\n\n/** Default page size for MCP (smaller than CLI to reduce token usage) */\nconst DEFAULT_PER_PAGE = 20;\n\n/**\n * Args interface for the consolidated tool\n */\ninterface ProductiveArgs {\n resource: string;\n action: string;\n id?: string;\n filter?: Record<string, unknown>;\n page?: number;\n per_page?: number;\n compact?: boolean;\n include?: string[];\n query?: string;\n // Common fields\n person_id?: string;\n service_id?: string;\n task_id?: string;\n company_id?: string;\n time?: number;\n date?: string;\n note?: string;\n // Task fields\n title?: string;\n project_id?: string;\n task_list_id?: string;\n description?: string;\n assignee_id?: string;\n // Company fields\n name?: string;\n // Comment fields\n body?: string;\n deal_id?: string;\n // Timer fields\n time_entry_id?: string;\n // Booking fields\n started_on?: string;\n ended_on?: string;\n event_id?: string;\n // Report fields\n report_type?: string;\n group?: string;\n from?: string;\n to?: string;\n status?: string;\n}\n\n/**\n * Execute a tool with the given credentials and arguments\n */\nexport async function executeToolWithCredentials(\n name: string,\n args: Record<string, unknown>,\n credentials: ProductiveCredentials,\n): Promise<ToolResult> {\n // Initialize API client with provided credentials\n const api = new ProductiveApi({\n token: credentials.apiToken,\n 'org-id': credentials.organizationId,\n 'user-id': credentials.userId,\n } as Record<string, string>);\n\n // Handle the single consolidated tool\n if (name !== 'productive') {\n return errorResult(`Unknown tool: ${name}`);\n }\n\n const { resource, action, filter, page, per_page, compact, include, query, ...restArgs } =\n args as unknown as ProductiveArgs;\n\n // Default compact to false for 'get' action (single resource), true for 'list'\n const isCompact = compact ?? action !== 'get';\n const formatOptions: McpFormatOptions = { compact: isCompact };\n let stringFilter = toStringFilter(filter);\n const perPage = per_page ?? DEFAULT_PER_PAGE;\n\n // Add query to filter if provided (for text search)\n if (query) {\n stringFilter = { ...stringFilter, query };\n }\n\n // Build handler context\n const ctx: HandlerContext = {\n api,\n formatOptions,\n filter: stringFilter,\n page,\n perPage,\n include,\n };\n\n try {\n // Handle help action first (doesn't need API)\n if (action === 'help') {\n return resource ? handleHelp(resource) : handleHelpOverview();\n }\n\n // Route to appropriate resource handler\n switch (resource) {\n case 'projects':\n return await handleProjects(action, restArgs, ctx);\n\n case 'time':\n return await handleTime(action, restArgs, ctx);\n\n case 'tasks':\n return await handleTasks(action, restArgs, ctx);\n\n case 'services':\n return await handleServices(action, restArgs, ctx);\n\n case 'people':\n return await handlePeople(action, restArgs, ctx, credentials);\n\n case 'companies':\n return await handleCompanies(action, restArgs, ctx);\n\n case 'comments':\n return await handleComments(action, restArgs, ctx);\n\n case 'timers':\n return await handleTimers(action, restArgs, ctx);\n\n case 'deals':\n return await handleDeals(action, restArgs, ctx);\n\n case 'bookings':\n return await handleBookings(action, restArgs, ctx);\n\n case 'reports':\n return await handleReports(action, restArgs, ctx);\n\n default:\n return errorResult(`Unknown resource: ${resource}`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return errorResult(message);\n }\n}\n"],"names":["cliFormatTimeEntry","cliFormatProject","cliFormatTask","cliFormatPerson","cliFormatService","cliFormatCompany","cliFormatComment","cliFormatTimer","cliFormatDeal","cliFormatBooking","cliFormatListResponse"],"mappings":";AAqCA,MAAM,qBAAoC;AAAA,EACxC,wBAAwB;AAAA,EACxB,mBAAmB;AAAA,EACnB,WAAW;AACb;AAaA,SAAS,WAA8C,KAAQ,gBAA6B;AAC1F,QAAM,SAAS,EAAE,GAAG,IAAA;AACpB,aAAW,SAAS,gBAAgB;AAClC,WAAO,OAAO,KAAK;AAAA,EACrB;AACA,SAAO;AACT;AAKO,SAAS,gBACd,OACA,SACyB;AACzB,QAAM,SAASA,kBAAmB,OAAO,kBAAkB;AAC3D,MAAI,SAAS,SAAS;AACpB,WAAO,WAAW,QAAQ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K;AACH,eAAO,MAAM,eAAe,QAAQ,UAAU,GAAG;AAAA,MAEnD,KAAK;AACH,eAAO,MAAM,aAAa,QAAQ,UAAU,KAAK,WAAW;AAAA,MAE9D,KAAK;AACH,eAAO,MAAM,gBAAgB,QAAQ,UAAU,GAAG;AAAA,MAEpD,KAAK;AACH,eAAO,MAAM,eAAe,QAAQ,UAAU,GAAG;AAAA,MAEnD,KAAK;AACH,eAAO,MAAM,aAAa,QAAQ,UAAU,GAAG;AAAA,MAEjD,KAAK;AACH,eAAO,MAAM,YAAY,QAAQ,UAAU,GAAG;AAAA,MAEhD,KAAK;AACH,eAAO,MAAM,eAAe,QAAQ,UAAU,GAAG;AAAA,MAEnD,KAAK;AACH,eAAO,MAAM,cAAc,QAAQ,UAAU,GAAG;AAAA,MAElD;AACE,eAAO,YAAY,qBAAqB,QAAQ,EAAE;AAAA,IAAA;AAAA,EAExD,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,WAAO,YAAY,OAAO;AAAA,EAC5B;AACF;"}
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
5
5
  import { getAvailableTools, getAvailablePrompts, handlePrompt, handleToolCall } from "./stdio.js";
6
- import { V as VERSION } from "./version-BRw90xAB.js";
6
+ import { V as VERSION } from "./version-B1rjMbl8.js";
7
7
  function createStdioServer() {
8
8
  const server = new Server(
9
9
  {
package/dist/server.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { toNodeListener } from "h3";
3
3
  import { createServer } from "node:http";
4
4
  import { createHttpApp } from "./http.js";
5
- import { V as VERSION } from "./version-BRw90xAB.js";
5
+ import { V as VERSION } from "./version-B1rjMbl8.js";
6
6
  const DEFAULT_PORT = 3e3;
7
7
  const DEFAULT_HOST = "0.0.0.0";
8
8
  function startHttpServer(port = DEFAULT_PORT, host = DEFAULT_HOST) {
package/dist/stdio.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getConfig, setConfig } from "@studiometa/productive-cli";
2
- import { e as executeToolWithCredentials } from "./index-CmTDkz-y.js";
2
+ import { e as executeToolWithCredentials } from "./index-B2DTeltj.js";
3
3
  import { TOOLS, STDIO_ONLY_TOOLS } from "./tools.js";
4
4
  function getAvailableTools() {
5
5
  return [...TOOLS, ...STDIO_ONLY_TOOLS];
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE,IAAI,EA6DvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAsBlC,CAAC"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE,IAAI,EAgGvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAsBlC,CAAC"}
package/dist/tools.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const TOOLS = [
2
2
  {
3
3
  name: "productive",
4
- description: "Productive.io API. Resources: projects, time, tasks, services, people, companies, comments, timers, deals, bookings. Actions: list, get, create, update (varies by resource), start/stop (timers), me (people). Filters: project_id, person_id, service_id, company_id, after/before (dates).",
4
+ description: "Productive.io API. Resources: projects, time, tasks, services, people, companies, comments, timers, deals, bookings, reports. Actions: list, get, create, update (varies by resource), start/stop (timers), me (people), help (documentation). Use query for text search on list actions. Reports: use resource=reports, action=get with report_type. Filters: project_id, person_id, service_id, company_id, after/before (dates). Use include to fetch related data. Use compact=false for full details (default for get, true for list). Use action=help with a resource for detailed documentation.",
5
5
  inputSchema: {
6
6
  type: "object",
7
7
  properties: {
@@ -17,18 +17,32 @@ const TOOLS = [
17
17
  "comments",
18
18
  "timers",
19
19
  "deals",
20
- "bookings"
20
+ "bookings",
21
+ "reports"
21
22
  ]
22
23
  },
23
24
  action: {
24
25
  type: "string",
25
- enum: ["list", "get", "create", "update", "me", "start", "stop"]
26
+ enum: ["list", "get", "create", "update", "me", "start", "stop", "help"],
27
+ description: 'Action to perform. Use "help" for detailed documentation on a resource.'
26
28
  },
27
29
  id: { type: "string" },
28
30
  filter: { type: "object" },
29
31
  page: { type: "number" },
30
32
  per_page: { type: "number" },
31
- compact: { type: "boolean" },
33
+ compact: {
34
+ type: "boolean",
35
+ description: "Compact output (default: true for list, false for get)"
36
+ },
37
+ include: {
38
+ type: "array",
39
+ items: { type: "string" },
40
+ description: 'Related resources to include (e.g., ["project", "assignee", "comments"])'
41
+ },
42
+ query: {
43
+ type: "string",
44
+ description: "Text search query for list actions (searches name/title fields)"
45
+ },
32
46
  // Common fields
33
47
  person_id: { type: "string" },
34
48
  service_id: { type: "string" },
@@ -53,7 +67,28 @@ const TOOLS = [
53
67
  // Booking fields
54
68
  started_on: { type: "string" },
55
69
  ended_on: { type: "string" },
56
- event_id: { type: "string" }
70
+ event_id: { type: "string" },
71
+ // Report fields
72
+ report_type: {
73
+ type: "string",
74
+ enum: [
75
+ "time_reports",
76
+ "project_reports",
77
+ "budget_reports",
78
+ "person_reports",
79
+ "invoice_reports",
80
+ "payment_reports",
81
+ "service_reports",
82
+ "task_reports",
83
+ "company_reports",
84
+ "deal_reports",
85
+ "timesheet_reports"
86
+ ]
87
+ },
88
+ group: { type: "string" },
89
+ from: { type: "string" },
90
+ to: { type: "string" },
91
+ status: { type: "string" }
57
92
  },
58
93
  required: ["resource", "action"]
59
94
  }
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sources":["../src/tools.ts"],"sourcesContent":["import type { Tool } from '@modelcontextprotocol/sdk/types.js';\n\n/**\n * Single consolidated tool for Productive.io MCP server\n *\n * Optimized for minimal token overhead (~170 tokens vs ~1300 for individual tools)\n */\nexport const TOOLS: Tool[] = [\n {\n name: 'productive',\n description:\n 'Productive.io API. Resources: projects, time, tasks, services, people, companies, comments, timers, deals, bookings. Actions: list, get, create, update (varies by resource), start/stop (timers), me (people). Filters: project_id, person_id, service_id, company_id, after/before (dates).',\n inputSchema: {\n type: 'object',\n properties: {\n resource: {\n type: 'string',\n enum: [\n 'projects',\n 'time',\n 'tasks',\n 'services',\n 'people',\n 'companies',\n 'comments',\n 'timers',\n 'deals',\n 'bookings',\n ],\n },\n action: {\n type: 'string',\n enum: ['list', 'get', 'create', 'update', 'me', 'start', 'stop'],\n },\n id: { type: 'string' },\n filter: { type: 'object' },\n page: { type: 'number' },\n per_page: { type: 'number' },\n compact: { type: 'boolean' },\n // Common fields\n person_id: { type: 'string' },\n service_id: { type: 'string' },\n task_id: { type: 'string' },\n company_id: { type: 'string' },\n time: { type: 'number' },\n date: { type: 'string' },\n note: { type: 'string' },\n // Task fields\n title: { type: 'string' },\n project_id: { type: 'string' },\n task_list_id: { type: 'string' },\n description: { type: 'string' },\n assignee_id: { type: 'string' },\n // Company fields\n name: { type: 'string' },\n // Comment fields\n body: { type: 'string' },\n deal_id: { type: 'string' },\n // Timer fields\n time_entry_id: { type: 'string' },\n // Booking fields\n started_on: { type: 'string' },\n ended_on: { type: 'string' },\n event_id: { type: 'string' },\n },\n required: ['resource', 'action'],\n },\n },\n];\n\n/**\n * Additional tools only available in stdio mode (local execution)\n * These tools manage persistent configuration\n */\nexport const STDIO_ONLY_TOOLS: Tool[] = [\n {\n name: 'productive_configure',\n description: 'Configure Productive.io credentials',\n inputSchema: {\n type: 'object',\n properties: {\n organizationId: { type: 'string' },\n apiToken: { type: 'string' },\n userId: { type: 'string' },\n },\n required: ['organizationId', 'apiToken'],\n },\n },\n {\n name: 'productive_get_config',\n description: 'Get current configuration',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n];\n"],"names":[],"mappings":"AAOO,MAAM,QAAgB;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IACF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,UAAU;AAAA,UACR,MAAM;AAAA,UACN,MAAM;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QAEF,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,MAAM,CAAC,QAAQ,OAAO,UAAU,UAAU,MAAM,SAAS,MAAM;AAAA,QAAA;AAAA,QAEjE,IAAI,EAAE,MAAM,SAAA;AAAA,QACZ,QAAQ,EAAE,MAAM,SAAA;AAAA,QAChB,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,UAAU,EAAE,MAAM,SAAA;AAAA,QAClB,SAAS,EAAE,MAAM,UAAA;AAAA;AAAA,QAEjB,WAAW,EAAE,MAAM,SAAA;AAAA,QACnB,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,SAAS,EAAE,MAAM,SAAA;AAAA,QACjB,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,MAAM,EAAE,MAAM,SAAA;AAAA;AAAA,QAEd,OAAO,EAAE,MAAM,SAAA;AAAA,QACf,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,cAAc,EAAE,MAAM,SAAA;AAAA,QACtB,aAAa,EAAE,MAAM,SAAA;AAAA,QACrB,aAAa,EAAE,MAAM,SAAA;AAAA;AAAA,QAErB,MAAM,EAAE,MAAM,SAAA;AAAA;AAAA,QAEd,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,SAAS,EAAE,MAAM,SAAA;AAAA;AAAA,QAEjB,eAAe,EAAE,MAAM,SAAA;AAAA;AAAA,QAEvB,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,UAAU,EAAE,MAAM,SAAA;AAAA,QAClB,UAAU,EAAE,MAAM,SAAA;AAAA,MAAS;AAAA,MAE7B,UAAU,CAAC,YAAY,QAAQ;AAAA,IAAA;AAAA,EACjC;AAEJ;AAMO,MAAM,mBAA2B;AAAA,EACtC;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,gBAAgB,EAAE,MAAM,SAAA;AAAA,QACxB,UAAU,EAAE,MAAM,SAAA;AAAA,QAClB,QAAQ,EAAE,MAAM,SAAA;AAAA,MAAS;AAAA,MAE3B,UAAU,CAAC,kBAAkB,UAAU;AAAA,IAAA;AAAA,EACzC;AAAA,EAEF;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY,CAAA;AAAA,IAAC;AAAA,EACf;AAEJ;"}
1
+ {"version":3,"file":"tools.js","sources":["../src/tools.ts"],"sourcesContent":["import type { Tool } from '@modelcontextprotocol/sdk/types.js';\n\n/**\n * Single consolidated tool for Productive.io MCP server\n *\n * Optimized for minimal token overhead (~170 tokens vs ~1300 for individual tools)\n */\nexport const TOOLS: Tool[] = [\n {\n name: 'productive',\n description:\n 'Productive.io API. Resources: projects, time, tasks, services, people, companies, comments, timers, deals, bookings, reports. Actions: list, get, create, update (varies by resource), start/stop (timers), me (people), help (documentation). Use query for text search on list actions. Reports: use resource=reports, action=get with report_type. Filters: project_id, person_id, service_id, company_id, after/before (dates). Use include to fetch related data. Use compact=false for full details (default for get, true for list). Use action=help with a resource for detailed documentation.',\n inputSchema: {\n type: 'object',\n properties: {\n resource: {\n type: 'string',\n enum: [\n 'projects',\n 'time',\n 'tasks',\n 'services',\n 'people',\n 'companies',\n 'comments',\n 'timers',\n 'deals',\n 'bookings',\n 'reports',\n ],\n },\n action: {\n type: 'string',\n enum: ['list', 'get', 'create', 'update', 'me', 'start', 'stop', 'help'],\n description: 'Action to perform. Use \"help\" for detailed documentation on a resource.',\n },\n id: { type: 'string' },\n filter: { type: 'object' },\n page: { type: 'number' },\n per_page: { type: 'number' },\n compact: {\n type: 'boolean',\n description: 'Compact output (default: true for list, false for get)',\n },\n include: {\n type: 'array',\n items: { type: 'string' },\n description: 'Related resources to include (e.g., [\"project\", \"assignee\", \"comments\"])',\n },\n query: {\n type: 'string',\n description: 'Text search query for list actions (searches name/title fields)',\n },\n // Common fields\n person_id: { type: 'string' },\n service_id: { type: 'string' },\n task_id: { type: 'string' },\n company_id: { type: 'string' },\n time: { type: 'number' },\n date: { type: 'string' },\n note: { type: 'string' },\n // Task fields\n title: { type: 'string' },\n project_id: { type: 'string' },\n task_list_id: { type: 'string' },\n description: { type: 'string' },\n assignee_id: { type: 'string' },\n // Company fields\n name: { type: 'string' },\n // Comment fields\n body: { type: 'string' },\n deal_id: { type: 'string' },\n // Timer fields\n time_entry_id: { type: 'string' },\n // Booking fields\n started_on: { type: 'string' },\n ended_on: { type: 'string' },\n event_id: { type: 'string' },\n // Report fields\n report_type: {\n type: 'string',\n enum: [\n 'time_reports',\n 'project_reports',\n 'budget_reports',\n 'person_reports',\n 'invoice_reports',\n 'payment_reports',\n 'service_reports',\n 'task_reports',\n 'company_reports',\n 'deal_reports',\n 'timesheet_reports',\n ],\n },\n group: { type: 'string' },\n from: { type: 'string' },\n to: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['resource', 'action'],\n },\n },\n];\n\n/**\n * Additional tools only available in stdio mode (local execution)\n * These tools manage persistent configuration\n */\nexport const STDIO_ONLY_TOOLS: Tool[] = [\n {\n name: 'productive_configure',\n description: 'Configure Productive.io credentials',\n inputSchema: {\n type: 'object',\n properties: {\n organizationId: { type: 'string' },\n apiToken: { type: 'string' },\n userId: { type: 'string' },\n },\n required: ['organizationId', 'apiToken'],\n },\n },\n {\n name: 'productive_get_config',\n description: 'Get current configuration',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n];\n"],"names":[],"mappings":"AAOO,MAAM,QAAgB;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IACF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,UAAU;AAAA,UACR,MAAM;AAAA,UACN,MAAM;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QAEF,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,MAAM,CAAC,QAAQ,OAAO,UAAU,UAAU,MAAM,SAAS,QAAQ,MAAM;AAAA,UACvE,aAAa;AAAA,QAAA;AAAA,QAEf,IAAI,EAAE,MAAM,SAAA;AAAA,QACZ,QAAQ,EAAE,MAAM,SAAA;AAAA,QAChB,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,UAAU,EAAE,MAAM,SAAA;AAAA,QAClB,SAAS;AAAA,UACP,MAAM;AAAA,UACN,aAAa;AAAA,QAAA;AAAA,QAEf,SAAS;AAAA,UACP,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,SAAA;AAAA,UACf,aAAa;AAAA,QAAA;AAAA,QAEf,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,QAAA;AAAA;AAAA,QAGf,WAAW,EAAE,MAAM,SAAA;AAAA,QACnB,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,SAAS,EAAE,MAAM,SAAA;AAAA,QACjB,YAAY,EAAE,MAAM,SAAA;AAAA,QACpB,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,MAAM,EAAE,MAAM,SAAA;AAAA,QACd,MAAM,EAAE,MAAM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A,IACN,aAAa;AAAA,IACb,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY,CAAA;AAAA,IAAC;AAAA,EACf;AAEJ;"}
@@ -0,0 +1,5 @@
1
+ const VERSION = "0.7.0";
2
+ export {
3
+ VERSION as V
4
+ };
5
+ //# sourceMappingURL=version-B1rjMbl8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-BRw90xAB.js","sources":["../src/version.ts"],"sourcesContent":["/**\n * Package version - injected from package.json at build time\n */\ndeclare const __VERSION__: string;\nexport const VERSION = __VERSION__;\n"],"names":[],"mappings":"AAIO,MAAM,UAAU;"}
1
+ {"version":3,"file":"version-B1rjMbl8.js","sources":["../src/version.ts"],"sourcesContent":["/**\n * Package version - injected from package.json at build time\n */\ndeclare const __VERSION__: string;\nexport const VERSION = __VERSION__;\n"],"names":[],"mappings":"AAIO,MAAM,UAAU;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/productive-mcp",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "description": "MCP server for Productive.io API - Model Context Protocol integration for Claude Desktop",
5
5
  "keywords": [
6
6
  "ai",
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@modelcontextprotocol/sdk": "^1.0.4",
82
- "@studiometa/productive-cli": "0.6.4",
82
+ "@studiometa/productive-cli": "0.7.0",
83
83
  "h3": "^1.15.1"
84
84
  },
85
85
  "devDependencies": {