diff --git a/.changeset/two-bats-smoke.md b/.changeset/two-bats-smoke.md index dec4e144..44272dd0 100644 --- a/.changeset/two-bats-smoke.md +++ b/.changeset/two-bats-smoke.md @@ -7,3 +7,4 @@ - Implement update-subtask MCP command for appending information to specific subtasks - Implement generate MCP command for creating individual task files from tasks.json - Implement set-status MCP command for updating task status +- Document MCP server naming conventions in architecture.mdc and mcp.mdc files (file names use kebab-case, direct functions use camelCase with Direct suffix, tool registration functions use camelCase with Tool suffix, and MCP tool names use snake_case) diff --git a/.cursor/rules/architecture.mdc b/.cursor/rules/architecture.mdc index 68c71ea4..f0d7b121 100644 --- a/.cursor/rules/architecture.mdc +++ b/.cursor/rules/architecture.mdc @@ -119,6 +119,11 @@ alwaysApply: false - `mcp-server/src/core/direct-functions/`: Directory containing individual files for each direct function wrapper (`*Direct`). These files contain the primary logic, including path resolution, core function calls, and caching. - [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js): Acts as an import/export hub, collecting and exporting direct functions from the `direct-functions` directory and utility functions. - `mcp-server/src/tools/utils.js`: Provides utilities like `handleApiResult`, `processMCPResponseData`, and `getCachedOrExecute`. + - **Naming Conventions**: + - **Files** use **kebab-case**: `list-tasks.js`, `set-task-status.js`, `parse-prd.js` + - **Direct Functions** use **camelCase** with `Direct` suffix: `listTasksDirect`, `setTaskStatusDirect`, `parsePRDDirect` + - **Tool Registration Functions** use **camelCase** with `Tool` suffix: `registerListTasksTool`, `registerSetTaskStatusTool` + - **MCP Tool Names** use **snake_case**: `list_tasks`, `set_task_status`, `parse_prd_document` - **Data Flow and Module Dependencies**: diff --git a/.cursor/rules/mcp.mdc b/.cursor/rules/mcp.mdc index b07bd7ac..3f991daa 100644 --- a/.cursor/rules/mcp.mdc +++ b/.cursor/rules/mcp.mdc @@ -46,50 +46,38 @@ The MCP server acts as a bridge between external tools (like Cursor) and the cor Follow these steps to add MCP support for an existing Task Master command (see [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for more detail): 1. **Ensure Core Logic Exists**: Verify the core functionality is implemented and exported from the relevant module in `scripts/modules/`. -2. **Create Direct Wrapper (`task-master-core.js`)**: - - Create an `async function yourCommandDirect(args, log)` in [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js). - - Inside the wrapper: - - Import necessary core functions and utilities (`findTasksJsonPath`, `getCachedOrExecute` if caching). + +2. **Create Direct Function File in `mcp-server/src/core/direct-functions/`**: + - Create a new file (e.g., `your-command.js`) in the `direct-functions` directory using **kebab-case** for file naming. + - Import necessary core functions from Task Master modules (e.g., `../../../../scripts/modules/task-manager.js`). + - Import utilities: `findTasksJsonPath` from `../utils/path-utils.js` and `getCachedOrExecute` from `../../tools/utils.js` if needed. + - Implement `async function yourCommandDirect(args, log)` using **camelCase** with `Direct` suffix: - Parse `args` and determine necessary inputs (e.g., `tasksPath` via `findTasksJsonPath`). - **If Caching**: - Generate a unique `cacheKey` based on arguments defining the operation. - - Define an `async` function `coreActionFn` containing the actual call to the core logic, formatting its return as `{ success: true/false, data/error }`. + - Define an `async` function `coreActionFn` containing the call to the core logic. - Call `const result = await getCachedOrExecute({ cacheKey, actionFn: coreActionFn, log });`. - - `return result;` (which includes the `fromCache` flag). - **If Not Caching**: - Directly call the core logic function within a try/catch block. - - Format the return as `{ success: true/false, data/error, fromCache: false }`. - - Export the wrapper function and add it to the `directFunctions` map. -3. **Create MCP Tool (`mcp-server/src/tools/`)**: - - Create a new file (e.g., `yourCommand.js`). + - Format the return as `{ success: true/false, data/error, fromCache: boolean }`. + - Export the wrapper function. + +3. **Update `task-master-core.js` with Import/Export**: + - Import your direct function: `import { yourCommandDirect } from './direct-functions/your-command.js';` + - Re-export it in the exports section. + - Add it to the `directFunctions` map: `yourCommand: yourCommandDirect`. + +4. **Create MCP Tool (`mcp-server/src/tools/`)**: + - Create a new file (e.g., `your-command.js`) using **kebab-case**. - Import `z` for schema definition. - - Import `handleApiResult` from [`./utils.js`](mdc:mcp-server/src/tools/utils.js). + - Import `handleApiResult` from `./utils.js`. - Import the `yourCommandDirect` wrapper function from `../core/task-master-core.js`. - - Implement `registerYourCommandTool(server)`: - - Call `server.addTool`. - - Define `name`, `description`, and `parameters` using `zod` (include optional `projectRoot`, `file` if needed). - - Define the `async execute(args, log)` function: - ```javascript - async execute(args, log) { - try { - log.info(`Executing Your Command with args: ${JSON.stringify(args)}`); - // Call the direct function wrapper - const result = await yourCommandDirect(args, log); - - // Let handleApiResult format the final MCP response - return handleApiResult(result, log, 'Error during Your Command'); - // Optionally pass a custom processor to handleApiResult if default filtering isn't sufficient: - // return handleApiResult(result, log, 'Error...', customDataProcessor); - } catch (error) { - // Catch unexpected errors during the direct call itself - log.error(`Unexpected error in tool execute: ${error.message}`); - // Use createErrorResponse for unexpected errors - return createErrorResponse(`Tool execution failed: ${error.message}`); - } - } - ``` -4. **Register Tool**: Import and call `registerYourCommandTool` in [`mcp-server/src/tools/index.js`](mdc:mcp-server/src/tools/index.js). -5. **Update `mcp.json`**: Add the new tool definition to the `tools` array in `.cursor/mcp.json`. + - Implement `registerYourCommandTool(server)` using **camelCase** with `Tool` suffix. + - Define the tool `name` using **snake_case** (e.g., `your_command`). + +5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`. + +6. **Update `mcp.json`**: Add the new tool definition to the `tools` array in `.cursor/mcp.json`. ## Handling Responses @@ -185,3 +173,34 @@ Follow these steps to add MCP support for an existing Task Master command (see [ - Centralized error handling - Performance optimization through caching (for read operations) - Standardized response formatting + +## MCP Naming Conventions + +- **Files and Directories**: + - ✅ DO: Use **kebab-case** for all file names: `list-tasks.js`, `set-task-status.js` + - ✅ DO: Use consistent directory structure: `mcp-server/src/tools/` for tool definitions, `mcp-server/src/core/direct-functions/` for direct function implementations + +- **JavaScript Functions**: + - ✅ DO: Use **camelCase** with `Direct` suffix for direct function implementations: `listTasksDirect`, `setTaskStatusDirect` + - ✅ DO: Use **camelCase** with `Tool` suffix for tool registration functions: `registerListTasksTool`, `registerSetTaskStatusTool` + - ✅ DO: Use consistent action function naming inside direct functions: `coreActionFn` or similar descriptive name + +- **MCP Tool Names**: + - ✅ DO: Use **snake_case** for tool names exposed to MCP clients: `list_tasks`, `set_task_status`, `parse_prd_document` + - ✅ DO: Include the core action in the tool name without redundant words: Use `list_tasks` instead of `list_all_tasks` + +- **Examples**: + - File: `list-tasks.js` + - Direct Function: `listTasksDirect` + - Tool Registration: `registerListTasksTool` + - MCP Tool Name: `list_tasks` + +- **Mapping**: + - The `directFunctions` map in `task-master-core.js` maps the core function name (in camelCase) to its direct implementation: + ```javascript + export const directFunctions = { + list: listTasksDirect, + setStatus: setTaskStatusDirect, + // Add more functions as implemented + }; + ``` diff --git a/mcp-server/src/tools/addTask.js b/mcp-server/src/tools/addTask.js deleted file mode 100644 index 0b12d9fc..00000000 --- a/mcp-server/src/tools/addTask.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * tools/addTask.js - * Tool to add a new task using AI - */ - -import { z } from "zod"; -import { - executeTaskMasterCommand, - createContentResponse, - createErrorResponse, -} from "./utils.js"; - -/** - * Register the addTask tool with the MCP server - * @param {FastMCP} server - FastMCP server instance - */ -export function registerAddTaskTool(server) { - server.addTool({ - name: "addTask", - description: "Add a new task using AI", - parameters: z.object({ - prompt: z.string().describe("Description of the task to add"), - dependencies: z - .string() - .optional() - .describe("Comma-separated list of task IDs this task depends on"), - priority: z - .string() - .optional() - .describe("Task priority (high, medium, low)"), - file: z.string().optional().describe("Path to the tasks file"), - projectRoot: z - .string() - .describe( - "Root directory of the project (default: current working directory)" - ), - }), - execute: async (args, { log }) => { - try { - log.info(`Adding new task: ${args.prompt}`); - - const cmdArgs = [`--prompt="${args.prompt}"`]; - if (args.dependencies) - cmdArgs.push(`--dependencies=${args.dependencies}`); - if (args.priority) cmdArgs.push(`--priority=${args.priority}`); - if (args.file) cmdArgs.push(`--file=${args.file}`); - - const result = executeTaskMasterCommand( - "add-task", - log, - cmdArgs, - projectRoot - ); - - if (!result.success) { - throw new Error(result.error); - } - - return createContentResponse(result.stdout); - } catch (error) { - log.error(`Error adding task: ${error.message}`); - return createErrorResponse(`Error adding task: ${error.message}`); - } - }, - }); -} diff --git a/mcp-server/src/tools/expandTask.js b/mcp-server/src/tools/expandTask.js deleted file mode 100644 index ae0b4550..00000000 --- a/mcp-server/src/tools/expandTask.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * tools/expandTask.js - * Tool to break down a task into detailed subtasks - */ - -import { z } from "zod"; -import { - executeTaskMasterCommand, - createContentResponse, - createErrorResponse, -} from "./utils.js"; - -/** - * Register the expandTask tool with the MCP server - * @param {Object} server - FastMCP server instance - */ -export function registerExpandTaskTool(server) { - server.addTool({ - name: "expandTask", - description: "Break down a task into detailed subtasks", - parameters: z.object({ - id: z.string().describe("Task ID to expand"), - num: z.number().optional().describe("Number of subtasks to generate"), - research: z - .boolean() - .optional() - .describe( - "Enable Perplexity AI for research-backed subtask generation" - ), - prompt: z - .string() - .optional() - .describe("Additional context to guide subtask generation"), - force: z - .boolean() - .optional() - .describe( - "Force regeneration of subtasks for tasks that already have them" - ), - file: z.string().optional().describe("Path to the tasks file"), - projectRoot: z - .string() - .describe( - "Root directory of the project (default: current working directory)" - ), - }), - execute: async (args, { log }) => { - try { - log.info(`Expanding task ${args.id}`); - - const cmdArgs = [`--id=${args.id}`]; - if (args.num) cmdArgs.push(`--num=${args.num}`); - if (args.research) cmdArgs.push("--research"); - if (args.prompt) cmdArgs.push(`--prompt="${args.prompt}"`); - if (args.force) cmdArgs.push("--force"); - if (args.file) cmdArgs.push(`--file=${args.file}`); - - const projectRoot = args.projectRoot; - - const result = executeTaskMasterCommand( - "expand", - log, - cmdArgs, - projectRoot - ); - - if (!result.success) { - throw new Error(result.error); - } - - return createContentResponse(result.stdout); - } catch (error) { - log.error(`Error expanding task: ${error.message}`); - return createErrorResponse(`Error expanding task: ${error.message}`); - } - }, - }); -} diff --git a/mcp-server/src/tools/index.js b/mcp-server/src/tools/index.js index 2b0122f6..faaafcf5 100644 --- a/mcp-server/src/tools/index.js +++ b/mcp-server/src/tools/index.js @@ -4,13 +4,9 @@ */ import logger from "../logger.js"; -import { registerListTasksTool } from "./listTasks.js"; -import { registerShowTaskTool } from "./showTask.js"; -import { registerSetTaskStatusTool } from "./setTaskStatus.js"; -import { registerExpandTaskTool } from "./expandTask.js"; -import { registerNextTaskTool } from "./nextTask.js"; -import { registerAddTaskTool } from "./addTask.js"; -import { registerParsePRDTool } from "./parsePRD.js"; +import { registerListTasksTool } from "./list-tasks.js"; +import { registerSetTaskStatusTool } from "./set-task-status.js"; +import { registerParsePRDTool } from "./parse-prd.js"; import { registerUpdateTool } from "./update.js"; import { registerUpdateTaskTool } from "./update-task.js"; import { registerUpdateSubtaskTool } from "./update-subtask.js"; @@ -22,11 +18,7 @@ import { registerGenerateTool } from "./generate.js"; */ export function registerTaskMasterTools(server) { registerListTasksTool(server); - registerShowTaskTool(server); registerSetTaskStatusTool(server); - registerExpandTaskTool(server); - registerNextTaskTool(server); - registerAddTaskTool(server); registerParsePRDTool(server); registerUpdateTool(server); registerUpdateTaskTool(server); diff --git a/mcp-server/src/tools/listTasks.js b/mcp-server/src/tools/list-tasks.js similarity index 98% rename from mcp-server/src/tools/listTasks.js rename to mcp-server/src/tools/list-tasks.js index 35446ba2..f7bc17ed 100644 --- a/mcp-server/src/tools/listTasks.js +++ b/mcp-server/src/tools/list-tasks.js @@ -16,7 +16,7 @@ import { listTasksDirect } from "../core/task-master-core.js"; */ export function registerListTasksTool(server) { server.addTool({ - name: "listTasks", + name: "list-tasks", description: "List all tasks from Task Master", parameters: z.object({ status: z.string().optional().describe("Filter tasks by status"), diff --git a/mcp-server/src/tools/nextTask.js b/mcp-server/src/tools/nextTask.js deleted file mode 100644 index 729c5fec..00000000 --- a/mcp-server/src/tools/nextTask.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * tools/nextTask.js - * Tool to show the next task to work on based on dependencies and status - */ - -import { z } from "zod"; -import { - executeTaskMasterCommand, - createContentResponse, - createErrorResponse, -} from "./utils.js"; - -/** - * Register the nextTask tool with the MCP server - * @param {Object} server - FastMCP server instance - */ -export function registerNextTaskTool(server) { - server.addTool({ - name: "nextTask", - description: - "Show the next task to work on based on dependencies and status", - parameters: z.object({ - file: z.string().optional().describe("Path to the tasks file"), - projectRoot: z - .string() - .describe( - "Root directory of the project (default: current working directory)" - ), - }), - execute: async (args, { log }) => { - try { - log.info(`Finding next task to work on`); - - const cmdArgs = []; - if (args.file) cmdArgs.push(`--file=${args.file}`); - - const projectRoot = args.projectRoot; - - const result = executeTaskMasterCommand( - "next", - log, - cmdArgs, - projectRoot - ); - - if (!result.success) { - throw new Error(result.error); - } - - return createContentResponse(result.stdout); - } catch (error) { - log.error(`Error finding next task: ${error.message}`); - return createErrorResponse(`Error finding next task: ${error.message}`); - } - }, - }); -} diff --git a/mcp-server/src/tools/parsePRD.js b/mcp-server/src/tools/parse-prd.js similarity index 98% rename from mcp-server/src/tools/parsePRD.js rename to mcp-server/src/tools/parse-prd.js index c9718bba..12987f3b 100644 --- a/mcp-server/src/tools/parsePRD.js +++ b/mcp-server/src/tools/parse-prd.js @@ -16,7 +16,7 @@ import { parsePRDDirect } from "../core/task-master-core.js"; */ export function registerParsePRDTool(server) { server.addTool({ - name: "parsePRD", + name: "parse_prd_document", description: "Parse PRD document and generate tasks", parameters: z.object({ input: z.string().describe("Path to the PRD document file"), diff --git a/mcp-server/src/tools/setTaskStatus.js b/mcp-server/src/tools/set-task-status.js similarity index 98% rename from mcp-server/src/tools/setTaskStatus.js rename to mcp-server/src/tools/set-task-status.js index 459bf424..6f1fd272 100644 --- a/mcp-server/src/tools/setTaskStatus.js +++ b/mcp-server/src/tools/set-task-status.js @@ -16,7 +16,7 @@ import { setTaskStatusDirect } from "../core/task-master-core.js"; */ export function registerSetTaskStatusTool(server) { server.addTool({ - name: "setTaskStatus", + name: "set_task_status", description: "Set the status of a task", parameters: z.object({ id: z diff --git a/mcp-server/src/tools/showTask.js b/mcp-server/src/tools/showTask.js deleted file mode 100644 index 33e4da79..00000000 --- a/mcp-server/src/tools/showTask.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * tools/showTask.js - * Tool to show detailed information about a specific task - */ - -import { z } from "zod"; -import { - executeTaskMasterCommand, - createErrorResponse, - handleApiResult -} from "./utils.js"; - -/** - * Register the showTask tool with the MCP server - * @param {Object} server - FastMCP server instance - */ -export function registerShowTaskTool(server) { - server.addTool({ - name: "showTask", - description: "Show detailed information about a specific task", - parameters: z.object({ - id: z.string().describe("Task ID to show"), - file: z.string().optional().describe("Path to the tasks file"), - projectRoot: z - .string() - .optional() - .describe( - "Root directory of the project (default: current working directory)" - ), - }), - execute: async (args, { log }) => { - try { - log.info(`Showing task details for ID: ${args.id}`); - - // Prepare arguments for CLI command - const cmdArgs = [`--id=${args.id}`]; - if (args.file) cmdArgs.push(`--file=${args.file}`); - - // Execute the command - function now handles project root internally - const result = executeTaskMasterCommand( - "show", - log, - cmdArgs, - args.projectRoot // Pass raw project root, function will normalize it - ); - - // Process CLI result into API result format for handleApiResult - if (result.success) { - try { - // Try to parse response as JSON - const data = JSON.parse(result.stdout); - // Return equivalent of a successful API call with data - return handleApiResult({ success: true, data }, log, 'Error showing task'); - } catch (e) { - // If parsing fails, still return success but with raw string data - return handleApiResult( - { success: true, data: result.stdout }, - log, - 'Error showing task', - // Skip data processing for string data - null - ); - } - } else { - // Return equivalent of a failed API call - return handleApiResult( - { success: false, error: { message: result.error } }, - log, - 'Error showing task' - ); - } - } catch (error) { - log.error(`Error showing task: ${error.message}`); - return createErrorResponse(error.message); - } - }, - }); -} diff --git a/tasks/task_023.txt b/tasks/task_023.txt index f27b822d..c519fec4 100644 --- a/tasks/task_023.txt +++ b/tasks/task_023.txt @@ -17,6 +17,7 @@ This task involves completing the Model Context Protocol (MCP) server implementa 8. Identify and address missing components or functionalities to meet FastMCP best practices, such as robust error handling, monitoring endpoints, and concurrency support. 9. Update documentation to include examples of using the MCP server with FastMCP, detailed setup instructions, and client integration guides. 10. Organize direct function implementations in a modular structure within the mcp-server/src/core/direct-functions/ directory for improved maintainability and organization. +11. Follow consistent naming conventions: file names use kebab-case (like-this.js), direct functions use camelCase with Direct suffix (functionNameDirect), tool registration functions use camelCase with Tool suffix (registerToolNameTool), and MCP tool names exposed to clients use snake_case (tool_name). The implementation must ensure compatibility with existing MCP clients and follow RESTful API design principles, while supporting concurrent requests and maintaining robust error handling. @@ -529,7 +530,7 @@ Following MCP implementation standards: - Implement registerShowTaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'show_task' 5. Add to .cursor/mcp.json with appropriate schema @@ -562,7 +563,7 @@ Following MCP implementation standards: - Implement registerNextTaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'next_task' 5. Add to .cursor/mcp.json with appropriate schema @@ -595,7 +596,7 @@ Following MCP implementation standards: - Implement registerExpandTaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'expand_task' 5. Add to .cursor/mcp.json with appropriate schema @@ -628,7 +629,7 @@ Following MCP implementation standards: - Implement registerAddTaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'add_task' 5. Add to .cursor/mcp.json with appropriate schema @@ -661,7 +662,7 @@ Following MCP implementation standards: - Implement registerAddSubtaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'add_subtask' 5. Add to .cursor/mcp.json with appropriate schema @@ -694,7 +695,7 @@ Following MCP implementation standards: - Implement registerRemoveSubtaskTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'remove_subtask' 5. Add to .cursor/mcp.json with appropriate schema @@ -727,7 +728,7 @@ Following MCP implementation standards: - Implement registerAnalyzeTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'analyze' 5. Add to .cursor/mcp.json with appropriate schema @@ -760,7 +761,7 @@ Following MCP implementation standards: - Implement registerClearSubtasksTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'clear_subtasks' 5. Add to .cursor/mcp.json with appropriate schema @@ -793,7 +794,7 @@ Following MCP implementation standards: - Implement registerExpandAllTool(server) with server.addTool - Use executeMCPToolAction in execute method -4. Register in tools/index.js +4. Register in tools/index.js with tool name 'expand_all' 5. Add to .cursor/mcp.json with appropriate schema @@ -827,3 +828,17 @@ Following MCP implementation standards: 7. Ensure all MCP tools reference the functions through task-master-core.js 8. Verify backward compatibility with existing code +## 33. Implement Naming Convention Standards [pending] +### Dependencies: None +### Description: Update all MCP server components to follow the standardized naming conventions for files, functions, and tools. +### Details: +1. Audit all existing MCP server files and update file names to use kebab-case (like-this.js) +2. Refactor direct function names to use camelCase with Direct suffix (functionNameDirect) +3. Update tool registration functions to use camelCase with Tool suffix (registerToolNameTool) +4. Ensure all MCP tool names exposed to clients use snake_case (tool_name) +5. Create a naming convention documentation file for future reference +6. Update imports/exports in all files to reflect the new naming conventions +7. Verify that all tools are properly registered with the correct naming pattern +8. Update tests to reflect the new naming conventions +9. Create a linting rule to enforce naming conventions in future development + diff --git a/tasks/tasks.json b/tasks/tasks.json index d5c5d2b0..8c0735a5 100644 --- a/tasks/tasks.json +++ b/tasks/tasks.json @@ -1344,7 +1344,7 @@ 22 ], "priority": "medium", - "details": "This task involves completing the Model Context Protocol (MCP) server implementation for Task Master using FastMCP. Key updates include:\n\n1. Transition from CLI-based execution (currently using `child_process.spawnSync`) to direct Task Master function imports for improved performance and reliability.\n2. Implement caching mechanisms for frequently accessed contexts to enhance performance, leveraging FastMCP's efficient transport mechanisms (e.g., stdio).\n3. Refactor context management to align with best practices for handling large context windows, metadata, and tagging.\n4. Refactor tool registration in `tools/index.js` to include clear descriptions and parameter definitions, leveraging FastMCP's decorator-based patterns for better integration.\n5. Enhance transport type handling to ensure proper stdio communication and compatibility with FastMCP.\n6. Ensure the MCP server can be instantiated and run correctly when installed globally via `npx` or `npm i -g`.\n7. Integrate the ModelContextProtocol SDK directly to streamline resource and tool registration, ensuring compatibility with FastMCP's transport mechanisms.\n8. Identify and address missing components or functionalities to meet FastMCP best practices, such as robust error handling, monitoring endpoints, and concurrency support.\n9. Update documentation to include examples of using the MCP server with FastMCP, detailed setup instructions, and client integration guides.\n10. Organize direct function implementations in a modular structure within the mcp-server/src/core/direct-functions/ directory for improved maintainability and organization.\n\nThe implementation must ensure compatibility with existing MCP clients and follow RESTful API design principles, while supporting concurrent requests and maintaining robust error handling.", + "details": "This task involves completing the Model Context Protocol (MCP) server implementation for Task Master using FastMCP. Key updates include:\n\n1. Transition from CLI-based execution (currently using `child_process.spawnSync`) to direct Task Master function imports for improved performance and reliability.\n2. Implement caching mechanisms for frequently accessed contexts to enhance performance, leveraging FastMCP's efficient transport mechanisms (e.g., stdio).\n3. Refactor context management to align with best practices for handling large context windows, metadata, and tagging.\n4. Refactor tool registration in `tools/index.js` to include clear descriptions and parameter definitions, leveraging FastMCP's decorator-based patterns for better integration.\n5. Enhance transport type handling to ensure proper stdio communication and compatibility with FastMCP.\n6. Ensure the MCP server can be instantiated and run correctly when installed globally via `npx` or `npm i -g`.\n7. Integrate the ModelContextProtocol SDK directly to streamline resource and tool registration, ensuring compatibility with FastMCP's transport mechanisms.\n8. Identify and address missing components or functionalities to meet FastMCP best practices, such as robust error handling, monitoring endpoints, and concurrency support.\n9. Update documentation to include examples of using the MCP server with FastMCP, detailed setup instructions, and client integration guides.\n10. Organize direct function implementations in a modular structure within the mcp-server/src/core/direct-functions/ directory for improved maintainability and organization.\n11. Follow consistent naming conventions: file names use kebab-case (like-this.js), direct functions use camelCase with Direct suffix (functionNameDirect), tool registration functions use camelCase with Tool suffix (registerToolNameTool), and MCP tool names exposed to clients use snake_case (tool_name).\n\nThe implementation must ensure compatibility with existing MCP clients and follow RESTful API design principles, while supporting concurrent requests and maintaining robust error handling.", "testStrategy": "Testing for the MCP server implementation will follow a comprehensive approach based on our established testing guidelines:\n\n## Test Organization\n\n1. **Unit Tests** (`tests/unit/mcp-server/`):\n - Test individual MCP server components in isolation\n - Mock all external dependencies including FastMCP SDK\n - Test each tool implementation separately\n - Test each direct function implementation in the direct-functions directory\n - Verify direct function imports work correctly\n - Test context management and caching mechanisms\n - Example files: `context-manager.test.js`, `tool-registration.test.js`, `direct-functions/list-tasks.test.js`\n\n2. **Integration Tests** (`tests/integration/mcp-server/`):\n - Test interactions between MCP server components\n - Verify proper tool registration with FastMCP\n - Test context flow between components\n - Validate error handling across module boundaries\n - Test the integration between direct functions and their corresponding MCP tools\n - Example files: `server-tool-integration.test.js`, `context-flow.test.js`\n\n3. **End-to-End Tests** (`tests/e2e/mcp-server/`):\n - Test complete MCP server workflows\n - Verify server instantiation via different methods (direct, npx, global install)\n - Test actual stdio communication with mock clients\n - Example files: `server-startup.e2e.test.js`, `client-communication.e2e.test.js`\n\n4. **Test Fixtures** (`tests/fixtures/mcp-server/`):\n - Sample context data\n - Mock tool definitions\n - Sample MCP requests and responses\n\n## Testing Approach\n\n### Module Mocking Strategy\n```javascript\n// Mock the FastMCP SDK\njest.mock('@model-context-protocol/sdk', () => ({\n MCPServer: jest.fn().mockImplementation(() => ({\n registerTool: jest.fn(),\n registerResource: jest.fn(),\n start: jest.fn().mockResolvedValue(undefined),\n stop: jest.fn().mockResolvedValue(undefined)\n })),\n MCPError: jest.fn().mockImplementation(function(message, code) {\n this.message = message;\n this.code = code;\n })\n}));\n\n// Import modules after mocks\nimport { MCPServer, MCPError } from '@model-context-protocol/sdk';\nimport { initMCPServer } from '../../scripts/mcp-server.js';\n```\n\n### Direct Function Testing\n- Test each direct function in isolation\n- Verify proper error handling and return formats\n- Test with various input parameters and edge cases\n- Verify integration with the task-master-core.js export hub\n\n### Context Management Testing\n- Test context creation, retrieval, and manipulation\n- Verify caching mechanisms work correctly\n- Test context windowing and metadata handling\n- Validate context persistence across server restarts\n\n### Direct Function Import Testing\n- Verify Task Master functions are imported correctly\n- Test performance improvements compared to CLI execution\n- Validate error handling with direct imports\n\n### Tool Registration Testing\n- Verify tools are registered with proper descriptions and parameters\n- Test decorator-based registration patterns\n- Validate tool execution with different input types\n\n### Error Handling Testing\n- Test all error paths with appropriate MCPError types\n- Verify error propagation to clients\n- Test recovery from various error conditions\n\n### Performance Testing\n- Benchmark response times with and without caching\n- Test memory usage under load\n- Verify concurrent request handling\n\n## Test Quality Guidelines\n\n- Follow TDD approach when possible\n- Maintain test independence and isolation\n- Use descriptive test names explaining expected behavior\n- Aim for 80%+ code coverage, with critical paths at 100%\n- Follow the mock-first-then-import pattern for all Jest mocks\n- Avoid testing implementation details that might change\n- Ensure tests don't depend on execution order\n\n## Specific Test Cases\n\n1. **Server Initialization**\n - Test server creation with various configuration options\n - Verify proper tool and resource registration\n - Test server startup and shutdown procedures\n\n2. **Context Operations**\n - Test context creation, retrieval, update, and deletion\n - Verify context windowing and truncation\n - Test context metadata and tagging\n\n3. **Tool Execution**\n - Test each tool with various input parameters\n - Verify proper error handling for invalid inputs\n - Test tool execution performance\n\n4. **MCP.json Integration**\n - Test creation and updating of .cursor/mcp.json\n - Verify proper server registration in mcp.json\n - Test handling of existing mcp.json files\n\n5. **Transport Handling**\n - Test stdio communication\n - Verify proper message formatting\n - Test error handling in transport layer\n\n6. **Direct Function Structure**\n - Test the modular organization of direct functions\n - Verify proper import/export through task-master-core.js\n - Test utility functions in the utils directory\n\nAll tests will be automated and integrated into the CI/CD pipeline to ensure consistent quality.", "subtasks": [ { @@ -1545,7 +1545,7 @@ "id": 22, "title": "Implement show-task MCP command", "description": "Create direct function wrapper and MCP tool for showing task details.", - "details": "Following MCP implementation standards:\n\n1. Create showTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import showTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create show-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import showTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerShowTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for showTaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create showTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import showTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create show-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import showTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerShowTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'show_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for showTaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1554,7 +1554,7 @@ "id": 23, "title": "Implement next-task MCP command", "description": "Create direct function wrapper and MCP tool for finding the next task to work on.", - "details": "Following MCP implementation standards:\n\n1. Create nextTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import nextTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments (no specific args needed except projectRoot/file)\n - Handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create next-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import nextTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerNextTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for nextTaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create nextTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import nextTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments (no specific args needed except projectRoot/file)\n - Handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create next-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import nextTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerNextTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'next_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for nextTaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1563,7 +1563,7 @@ "id": 24, "title": "Implement expand-task MCP command", "description": "Create direct function wrapper and MCP tool for expanding a task into subtasks.", - "details": "Following MCP implementation standards:\n\n1. Create expandTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import expandTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId, prompt, num, force, research\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create expand-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import expandTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerExpandTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for expandTaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create expandTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import expandTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId, prompt, num, force, research\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create expand-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import expandTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerExpandTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'expand_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for expandTaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1572,7 +1572,7 @@ "id": 25, "title": "Implement add-task MCP command", "description": "Create direct function wrapper and MCP tool for adding new tasks.", - "details": "Following MCP implementation standards:\n\n1. Create addTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import addTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: prompt, priority, dependencies\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create add-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import addTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAddTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for addTaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create addTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import addTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: prompt, priority, dependencies\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create add-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import addTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAddTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'add_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for addTaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1581,7 +1581,7 @@ "id": 26, "title": "Implement add-subtask MCP command", "description": "Create direct function wrapper and MCP tool for adding subtasks to existing tasks.", - "details": "Following MCP implementation standards:\n\n1. Create addSubtaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import addSubtask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: parentTaskId, title, description, details\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create add-subtask.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import addSubtaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAddSubtaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for addSubtaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create addSubtaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import addSubtask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: parentTaskId, title, description, details\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create add-subtask.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import addSubtaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAddSubtaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'add_subtask'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for addSubtaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1590,7 +1590,7 @@ "id": 27, "title": "Implement remove-subtask MCP command", "description": "Create direct function wrapper and MCP tool for removing subtasks from tasks.", - "details": "Following MCP implementation standards:\n\n1. Create removeSubtaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import removeSubtask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: parentTaskId, subtaskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create remove-subtask.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import removeSubtaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerRemoveSubtaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for removeSubtaskDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create removeSubtaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import removeSubtask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: parentTaskId, subtaskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create remove-subtask.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import removeSubtaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerRemoveSubtaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'remove_subtask'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for removeSubtaskDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1599,7 +1599,7 @@ "id": 28, "title": "Implement analyze MCP command", "description": "Create direct function wrapper and MCP tool for analyzing task complexity.", - "details": "Following MCP implementation standards:\n\n1. Create analyzeTaskComplexityDirect.js in mcp-server/src/core/direct-functions/:\n - Import analyzeTaskComplexity from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create analyze.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import analyzeTaskComplexityDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAnalyzeTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for analyzeTaskComplexityDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create analyzeTaskComplexityDirect.js in mcp-server/src/core/direct-functions/:\n - Import analyzeTaskComplexity from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create analyze.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import analyzeTaskComplexityDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerAnalyzeTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'analyze'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for analyzeTaskComplexityDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1608,7 +1608,7 @@ "id": 29, "title": "Implement clear-subtasks MCP command", "description": "Create direct function wrapper and MCP tool for clearing subtasks from a parent task.", - "details": "Following MCP implementation standards:\n\n1. Create clearSubtasksDirect.js in mcp-server/src/core/direct-functions/:\n - Import clearSubtasks from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create clear-subtasks.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import clearSubtasksDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerClearSubtasksTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for clearSubtasksDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create clearSubtasksDirect.js in mcp-server/src/core/direct-functions/:\n - Import clearSubtasks from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create clear-subtasks.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import clearSubtasksDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerClearSubtasksTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'clear_subtasks'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for clearSubtasksDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1617,7 +1617,7 @@ "id": 30, "title": "Implement expand-all MCP command", "description": "Create direct function wrapper and MCP tool for expanding all tasks into subtasks.", - "details": "Following MCP implementation standards:\n\n1. Create expandAllTasksDirect.js in mcp-server/src/core/direct-functions/:\n - Import expandAllTasks from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: prompt, num, force, research\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create expand-all.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import expandAllTasksDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerExpandAllTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for expandAllTasksDirect.js\n - Integration test for MCP tool", + "details": "Following MCP implementation standards:\n\n1. Create expandAllTasksDirect.js in mcp-server/src/core/direct-functions/:\n - Import expandAllTasks from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: prompt, num, force, research\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create expand-all.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import expandAllTasksDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerExpandAllTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'expand_all'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for expandAllTasksDirect.js\n - Integration test for MCP tool", "status": "pending", "dependencies": [], "parentTaskId": 23 @@ -1641,6 +1641,15 @@ "23.31" ], "parentTaskId": 23 + }, + { + "id": 33, + "title": "Implement Naming Convention Standards", + "description": "Update all MCP server components to follow the standardized naming conventions for files, functions, and tools.", + "details": "1. Audit all existing MCP server files and update file names to use kebab-case (like-this.js)\n2. Refactor direct function names to use camelCase with Direct suffix (functionNameDirect)\n3. Update tool registration functions to use camelCase with Tool suffix (registerToolNameTool)\n4. Ensure all MCP tool names exposed to clients use snake_case (tool_name)\n5. Create a naming convention documentation file for future reference\n6. Update imports/exports in all files to reflect the new naming conventions\n7. Verify that all tools are properly registered with the correct naming pattern\n8. Update tests to reflect the new naming conventions\n9. Create a linting rule to enforce naming conventions in future development", + "status": "pending", + "dependencies": [], + "parentTaskId": 23 } ] },