144 Commits

Author SHA1 Message Date
Ralph Khreish
c02483bc41 chore: run npm run format 2025-04-09 00:30:05 +02:00
Eyal Toledano
b7580e038d Recovers lost files and commits work from the past 5-6 days. Holy shit that was a close call. 2025-04-08 15:55:22 -04:00
Eyal Toledano
e6c062d061 Recovers lost files and commits work from the past 5-6 days. Holy shit that was a close call. 2025-04-08 15:55:22 -04:00
Ralph Khreish
141e8a8585 fix: remove master command 2025-04-08 15:55:22 -04:00
Eyal Toledano
bad16b200f chore: changeset + update rules. 2025-04-08 15:55:22 -04:00
Eyal Toledano
feddeafd6e feat: Adds initialize-project to the MCP tools to enable onboarding to Taskmaster directly from MCP only. 2025-04-08 15:54:36 -04:00
Eyal Toledano
cdd87ccc5e feat: adds remove-task command + MCP implementation. 2025-04-08 15:54:33 -04:00
Eyal Toledano
74b67830ac fix(mcp): optimize get_task response payload by removing allTasks data
- Add custom processTaskResponse function to get-task.js to filter response data
- Significantly reduce MCP response size by returning only the requested task
- Preserve allTasks in CLI/UI for dependency status formatting
- Update changeset with documentation of optimization

This change maintains backward compatibility while making MCP responses
more efficient, addressing potential context overflow issues in AI clients.
2025-04-08 15:54:06 -04:00
Eyal Toledano
a49a77d19f fix: Improve MCP server robustness and debugging
- Refactor  for more reliable project root detection, particularly when running within integrated environments like Cursor IDE. Includes deriving root from script path and avoiding fallback to '/'.
- Enhance error handling in :
    - Add detailed debug information (paths searched, CWD, etc.) to the error message when  is not found in the provided project root.
    - Improve clarity of error messages and potential solutions.
- Add verbose logging in  to trace session object content and the finally resolved project root path, aiding in debugging path-related issues.
- Add default values for  and  to the example  environment configuration.
2025-04-08 15:54:06 -04:00
Eyal Toledano
e04c16cec6 refactor(mcp-server): Prioritize session roots for project path discovery
This commit refactors how the MCP server determines the project root directory, prioritizing the path provided by the client session (e.g., Cursor) for increased reliability and simplification.

Previously, project root discovery relied on a complex chain of fallbacks (environment variables, CWD searching, package path checks) within `findTasksJsonPath`. This could be brittle and less accurate when running within an integrated environment like Cursor.

Key changes:

- **Prioritize Session Roots:** MCP tools (`add-task`, `add-dependency`, etc.) now first attempt to extract the project root URI directly from `session.roots[0].uri`.

- **New Utility `getProjectRootFromSession`:** Added a utility function in `mcp-server/src/tools/utils.js` to encapsulate the logic for extracting and decoding the root URI from the session object.

- **Refactor MCP Tools:** Updated tools (`add-task.js`, `add-dependency.js`) to use `getProjectRootFromSession`.

- **Simplify `findTasksJsonPath`:** Prioritized `args.projectRoot`, removed checks for `TASK_MASTER_PROJECT_ROOT` env var and package directory fallback. Retained CWD search and cache check for CLI compatibility.

- **Fix `reportProgress` Usage:** Corrected parameters in `add-dependency.js`.

This change makes project root determination more robust for the MCP server while preserving discovery mechanisms for the standalone CLI.
2025-04-08 15:54:06 -04:00
Eyal Toledano
d5ecca25db fix(mcp): make projectRoot optional in all MCP tools
- Update all tool definitions to use z.string().optional() for projectRoot
- Fix direct function implementations to use findTasksJsonPath(args, log) pattern
- Enables consistent project root detection without requiring explicit params
- Update changeset to document these improvements

This change ensures MCP tools work properly with the smart project root
detection system, removing the need for explicit projectRoot parameters in
client applications. Improves usability and reduces integration friction.
2025-04-08 15:54:06 -04:00
Eyal Toledano
65f56978b2 chore/doc: renames list-tasks to get-tasks and show-tasks to get-tasks in the mcp tools to follow api conventions and likely natural language used (get my tasks). also updates changeset. 2025-04-08 15:54:06 -04:00
Eyal Toledano
f9ef0c1887 feat(paths): Implement robust project root detection and path utilities
Overhauls the project root detection system with a hierarchical precedence mechanism that intelligently locates tasks.json and identifies project roots. This improves user experience by reducing the need for explicit path parameters and enhances cross-platform compatibility.

Key Improvements:
- Implement hierarchical precedence for project root detection:
  * Environment variable override (TASK_MASTER_PROJECT_ROOT)
  * Explicitly provided --project-root parameter
  * Cached project root from previous successful operations
  * Current directory with project markers
  * Parent directory traversal to find tasks.json
  * Package directory as fallback

- Create comprehensive PROJECT_MARKERS detection system with 20+ common indicators:
  * Task Master specific files (tasks.json, tasks/tasks.json)
  * Version control directories (.git, .svn)
  * Package manifests (package.json, pyproject.toml, Gemfile, go.mod, Cargo.toml)
  * IDE/editor configurations (.cursor, .vscode, .idea)
  * Dependency directories (node_modules, venv, .venv)
  * Configuration files (.env, tsconfig.json, webpack.config.js)
  * CI/CD files (.github/workflows, .gitlab-ci.yml, .circleci/config.yml)

- DRY refactoring of path utilities:
  * Centralize path-related functions in core/utils/path-utils.js
  * Export PROJECT_MARKERS as a single source of truth
  * Add caching via lastFoundProjectRoot for performance optimization

- Enhanced user experience:
  * Improve error messages with specific troubleshooting guidance
  * Add detailed logging to indicate project root detection source
  * Update tool parameter descriptions for better clarity
  * Add recursive parent directory searching for tasks.json

Testing:
- Verified in local dev environment
- Added unit tests for the progress bar visualization
- Updated "automatically detected" description in MCP tools

This commit addresses Task #38: Implement robust project root handling for file paths.
2025-04-08 15:53:47 -04:00
Eyal Toledano
0e16d27294 chore: removes the optional from projectRoot. 2025-04-08 15:51:55 -04:00
Eyal Toledano
6a6d06766b feat(mcp): Implement add-dependency MCP command for creating dependency relationships between tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
9f430ca48b chore: task mgmt 2025-04-08 15:51:55 -04:00
Eyal Toledano
fec9e12f49 feat(mcp): Implement complexity-report MCP command for displaying task complexity analysis reports 2025-04-08 15:51:55 -04:00
Eyal Toledano
d06e45bf12 Implement fix-dependencies MCP command for automatically fixing invalid dependencies 2025-04-08 15:51:55 -04:00
Eyal Toledano
535fb5be71 Implement validate-dependencies MCP command for checking dependency validity 2025-04-08 15:51:55 -04:00
Eyal Toledano
fba6131db7 Implement remove-dependency MCP command for removing dependencies from tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
00e01d1d93 Implement expand-all MCP command for expanding all pending tasks with subtasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
995e95263c Implement clear-subtasks MCP command for clearing subtasks from parent tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
0b7b395aa4 Implement analyze-complexity MCP command for analyzing task complexity 2025-04-08 15:51:55 -04:00
Eyal Toledano
1679075b6b Implement remove-subtask MCP command for removing subtasks from parent tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
1908c4a337 Implement add-subtask MCP command for adding subtasks to existing tasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
43022d7010 feat: implement add-task MCP command
- Create direct function wrapper in add-task.js with prompt and dependency handling

- Add MCP tool integration for creating new tasks via AI

- Update task-master-core.js to expose addTaskDirect function

- Update changeset to document the new command
2025-04-08 15:51:55 -04:00
Eyal Toledano
04c2dee593 chore: uncomments the addResource and addResourceTemplate calls in the index.js for MCP. TODO: Figure out the project roots so we can do this on other projects vs just our own. 2025-04-08 15:51:55 -04:00
Eyal Toledano
d0092a6e6f feat: implement expand-task MCP command
- Create direct function wrapper in expand-task.js with error handling

- Add MCP tool integration for breaking down tasks into subtasks

- Update task-master-core.js to expose expandTaskDirect function

- Update changeset to document the new command

- Parameter support for subtask generation options (num, research, prompt, force)
2025-04-08 15:51:55 -04:00
Eyal Toledano
729ae4d2d5 feat: implement next-task MCP command
- Create direct function wrapper in next-task.js with error handling and caching

- Add MCP tool integration for finding the next task to work on

- Update task-master-core.js to expose nextTaskDirect function

- Update changeset to document the new command
2025-04-08 15:51:55 -04:00
Eyal Toledano
05950ef318 feat: implement show-task MCP command
- Create direct function wrapper in show-task.js with error handling and caching

- Add MCP tool integration for displaying detailed task information

- Update task-master-core.js to expose showTaskDirect function

- Update changeset to document the new command

- Follow kebab-case/camelCase/snake_case naming conventions
2025-04-08 15:51:55 -04:00
Eyal Toledano
9582c0a91f docs: document MCP server naming conventions and implement set-status
- Update architecture.mdc with file/function naming standards for MCP server components

- Update mcp.mdc with detailed naming conventions section

- Update task 23 to include naming convention details

- Update changeset to capture documentation changes

- Rename MCP tool files to follow kebab-case convention

- Implement set-task-status MCP command
2025-04-08 15:51:55 -04:00
Eyal Toledano
6d01ae3d47 feat: implement set-status MCP command and update changeset 2025-04-08 15:51:55 -04:00
Eyal Toledano
d4f92858c2 feat(mcp): Implement generate MCP command for creating task files from tasks.json 2025-04-08 15:51:55 -04:00
Eyal Toledano
e02ee96aff feat(mcp): Implement update-subtask MCP command for appending information to subtasks 2025-04-08 15:51:55 -04:00
Eyal Toledano
38f9e4deaa feat(mcp): Implement update-task MCP command for updating single tasks by ID with proper direct function wrapper, MCP tool implementation, and registration 2025-04-08 15:51:55 -04:00
Eyal Toledano
71410629ba refactor(mcp): Modularize direct functions in MCP server
Split monolithic task-master-core.js into separate function files within
the mcp-server/src/core/direct-functions/ directory. This change:

- Creates individual files for each direct function implementation
- Moves findTasksJsonPath to a dedicated utils/path-utils.js file
- Converts task-master-core.js to be a simple import/export hub
- Improves maintainability and organization of the codebase
- Reduces potential merge conflicts when multiple developers contribute
- Follows standard module separation patterns

Each function is now in its own self-contained file with clear imports and
focused responsibility, while maintaining the same API endpoints.
2025-04-08 15:51:55 -04:00
Eyal Toledano
450549d875 Adds update direct function into MCP. 2025-04-08 15:51:55 -04:00
Eyal Toledano
bc9707f813 refactor(mcp): Remove unused executeMCPToolAction utility
The  function aimed to abstract the common flow within MCP tool  methods (logging, calling direct function, handling result).

However, the established pattern (e.g., in ) involves the  method directly calling the  function (which handles its own caching via ) and then passing the result to . This pattern is clear, functional, and leverages the core utilities effectively.

Removing the unused  simplifies , eliminates a redundant abstraction layer, and clarifies the standard implementation pattern for MCP tools.
2025-04-08 15:51:55 -04:00
Eyal Toledano
42585519d3 feat(cache): Implement caching for listTasks MCP endpoint
Implemented LRU caching for the  function to improve performance for repeated requests.

Key changes include:
- Added  dependency.
- Introduced a reusable  utility function in  leveraging a .
- Refactored  in  to use the caching utility with a key based on task path, filter, and subtask flag.
- Modified  to include the  boolean flag in the final JSON response structure, nesting the original data under a  key.
- Added  function and corresponding MCP tool () for monitoring cache performance.
- Improved error handling in  for cases where  is not found.

This addresses the previous issue of the empty task list likely caused by stale cache entries and provides clear visibility into whether a response is served from the cache.

Relates to #23.9
2025-03-30 02:25:24 -04:00
Eyal Toledano
cd4f4e66d7 feat(mcp): Refactor MCP tools for direct function calls & add docs
This commit introduces a major refactoring of the MCP server implementation to prioritize direct function calls over CLI execution, enhancing performance and reliability. It also includes substantial updates to documentation for consistency and interlinking.

**MCP Server & Core Logic Refactoring:**

1.  **Introduce Direct Function Wrappers ():**
    *   Created  to house direct wrappers for core Task Master functions (imported from ).
    *   Implemented  as the first wrapper, calling .
    *   Added  utility within  to centralize  file location logic, removing duplication.
    *   Established the  map for registering these wrappers.

2.  **Enhance MCP Utilities ():**
    *   Added : A primary utility function to streamline MCP tool  methods. It handles logging, argument processing (incl. project root normalization), calling the direct action function (e.g., ), processing results via , and formatting the final MCP response.
    *   Added : Standardizes processing of  objects returned by direct function wrappers.
    *   Added : Filters sensitive/large fields (like , ) from responses sent to the MCP client.
    *   Added , ,  to support the new workflow.
    *   Refactored  to use  internally, simplifying its usage (though it's now primarily a fallback).

3.  **Update MCP Tools (, ):**
    *   Refactored  to use  with , significantly simplifying the tool's  method.
    *   Updated  (initially) to use the improved  (Note: further refactoring to use a direct wrapper for  would follow the  pattern).

**Documentation Enhancements:**

4.  **Comprehensive Interlinking:** Added  links across rule files (, , , , , ) to connect related guidelines, improving navigation.

5.  **Standardize CLI Syntax ():** Removed legacy ℹ️ Initialized Perplexity client with OpenAI compatibility layer examples, reinforcing ℹ️ Initialized Perplexity client with OpenAI compatibility layer
  _____         _      __  __           _
 |_   _|_ _ ___| | __ |  \/  | __ _ ___| |_ ___ _ __
   | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__|
   | | (_| \__ \   <  | |  | | (_| \__ \ ||  __/ |
   |_|\__,_|___/_|\_\ |_|  |_|\__,_|___/\__\___|_|

by https://x.com/eyaltoledano
╭────────────────────────────────────────────╮
│                                            │
│   Version: 0.9.30   Project: Task Master   │
│                                            │
╰────────────────────────────────────────────╯

╭─────────────────────╮
│                     │
│   Task Master CLI   │
│                     │
╰─────────────────────╯

╭───────────────────╮
│  Task Generation  │
╰───────────────────╯
    parse-prd                 --input=<file.txt> [--tasks=10]          Generate tasks from a PRD document
    generate                                                           Create individual task files from tasks…

╭───────────────────╮
│  Task Management  │
╰───────────────────╯
    list                      [--status=<status>] [--with-subtas…      List all tasks with their status
    set-status                --id=<id> --status=<status>              Update task status (done, pending, etc.)
    update                    --from=<id> --prompt="<context>"         Update tasks based on new requirements
    add-task                  --prompt="<text>" [--dependencies=…      Add a new task using AI
    add-dependency            --id=<id> --depends-on=<id>              Add a dependency to a task
    remove-dependency         --id=<id> --depends-on=<id>              Remove a dependency from a task

╭──────────────────────────╮
│  Task Analysis & Detail  │
╰──────────────────────────╯
    analyze-complexity        [--research] [--threshold=5]             Analyze tasks and generate expansion re…
    complexity-report         [--file=<path>]                          Display the complexity analysis report
    expand                    --id=<id> [--num=5] [--research] […      Break down tasks into detailed subtasks
    expand --all              [--force] [--research]                   Expand all pending tasks with subtasks
    clear-subtasks            --id=<id>                                Remove subtasks from specified tasks

╭─────────────────────────────╮
│  Task Navigation & Viewing  │
╰─────────────────────────────╯
    next                                                               Show the next task to work on based on …
    show                      <id>                                     Display detailed information about a sp…

╭─────────────────────────╮
│  Dependency Management  │
╰─────────────────────────╯
    validate-dependenci…                                               Identify invalid dependencies without f…
    fix-dependencies                                                   Fix invalid dependencies automatically

╭─────────────────────────╮
│  Environment Variables  │
╰─────────────────────────╯
    ANTHROPIC_API_KEY              Your Anthropic API key                             Required
    MODEL                          Claude model to use                                Default: claude-3-7-sonn…
    MAX_TOKENS                     Maximum tokens for responses                       Default: 4000
    TEMPERATURE                    Temperature for model responses                    Default: 0.7
    PERPLEXITY_API_KEY             Perplexity API key for research                    Optional
    PERPLEXITY_MODEL               Perplexity model to use                            Default: sonar-pro
    DEBUG                          Enable debug logging                               Default: false
    LOG_LEVEL                      Console output level (debug,info,warn,error)       Default: info
    DEFAULT_SUBTASKS               Default number of subtasks to generate             Default: 3
    DEFAULT_PRIORITY               Default task priority                              Default: medium
    PROJECT_NAME                   Project name displayed in UI                       Default: Task Master

  _____         _      __  __           _
 |_   _|_ _ ___| | __ |  \/  | __ _ ___| |_ ___ _ __
   | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__|
   | | (_| \__ \   <  | |  | | (_| \__ \ ||  __/ |
   |_|\__,_|___/_|\_\ |_|  |_|\__,_|___/\__\___|_|

by https://x.com/eyaltoledano
╭────────────────────────────────────────────╮
│                                            │
│   Version: 0.9.30   Project: Task Master   │
│                                            │
╰────────────────────────────────────────────╯

╭─────────────────────╮
│                     │
│   Task Master CLI   │
│                     │
╰─────────────────────╯

╭───────────────────╮
│  Task Generation  │
╰───────────────────╯
    parse-prd                 --input=<file.txt> [--tasks=10]          Generate tasks from a PRD document
    generate                                                           Create individual task files from tasks…

╭───────────────────╮
│  Task Management  │
╰───────────────────╯
    list                      [--status=<status>] [--with-subtas…      List all tasks with their status
    set-status                --id=<id> --status=<status>              Update task status (done, pending, etc.)
    update                    --from=<id> --prompt="<context>"         Update tasks based on new requirements
    add-task                  --prompt="<text>" [--dependencies=…      Add a new task using AI
    add-dependency            --id=<id> --depends-on=<id>              Add a dependency to a task
    remove-dependency         --id=<id> --depends-on=<id>              Remove a dependency from a task

╭──────────────────────────╮
│  Task Analysis & Detail  │
╰──────────────────────────╯
    analyze-complexity        [--research] [--threshold=5]             Analyze tasks and generate expansion re…
    complexity-report         [--file=<path>]                          Display the complexity analysis report
    expand                    --id=<id> [--num=5] [--research] […      Break down tasks into detailed subtasks
    expand --all              [--force] [--research]                   Expand all pending tasks with subtasks
    clear-subtasks            --id=<id>                                Remove subtasks from specified tasks

╭─────────────────────────────╮
│  Task Navigation & Viewing  │
╰─────────────────────────────╯
    next                                                               Show the next task to work on based on …
    show                      <id>                                     Display detailed information about a sp…

╭─────────────────────────╮
│  Dependency Management  │
╰─────────────────────────╯
    validate-dependenci…                                               Identify invalid dependencies without f…
    fix-dependencies                                                   Fix invalid dependencies automatically

╭─────────────────────────╮
│  Environment Variables  │
╰─────────────────────────╯
    ANTHROPIC_API_KEY              Your Anthropic API key                             Required
    MODEL                          Claude model to use                                Default: claude-3-7-sonn…
    MAX_TOKENS                     Maximum tokens for responses                       Default: 4000
    TEMPERATURE                    Temperature for model responses                    Default: 0.7
    PERPLEXITY_API_KEY             Perplexity API key for research                    Optional
    PERPLEXITY_MODEL               Perplexity model to use                            Default: sonar-pro
    DEBUG                          Enable debug logging                               Default: false
    LOG_LEVEL                      Console output level (debug,info,warn,error)       Default: info
    DEFAULT_SUBTASKS               Default number of subtasks to generate             Default: 3
    DEFAULT_PRIORITY               Default task priority                              Default: medium
    PROJECT_NAME                   Project name displayed in UI                       Default: Task Master       as the primary CLI.

6.  **Add MCP Architecture & Workflow Sections:** Added detailed sections in  and  explaining MCP server structure and the workflow for adding new MCP tool integrations using the direct function pattern.

7.  **Clarify MCP Role:** Updated  and  to better explain the MCP server's role and its specific utilities.

Overall, this establishes a cleaner, more performant, and maintainable pattern for integrating Task Master functionality with the MCP server, supported by improved documentation.
2025-03-30 00:29:12 -04:00
Eyal Toledano
38cd889ccd chore: expands some tasks and adds 'inspector' commands to scripts in package json to easily get inspector up for our mcp server at http://localhost:8888/?proxyPort=9000 which should play nice for those of us who have shit running on 3000 2025-03-29 17:52:11 -04:00
Ralph Khreish
bc4e68118c fix(mcp): get everything working, cleanup, and test all tools 2025-03-25 19:04:47 +00:00
Ralph Khreish
a9392c8a0d feat(wip): set up mcp server and tools, but mcp on cursor not working despite working in inspector 2025-03-25 19:04:21 +00:00
Ralph Khreish
f49684a802 feat(wip): initial commits for sub-tasks 1,2,3 for task 23 2025-03-25 19:04:20 +00:00