An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.
JavaScript aicursorcursor-aicursorailovablelovable-devroocodetask-managertaskstasks-listwindsurfwindsurf-ai
Don't add task-master-mcp to mcp.json if it already exists (#169)
Joe Danziger30e6d47577e0
diff --git a/.changeset/two-bats-smoke.md b/.changeset/two-bats-smoke.mdindex b242fbff..61930d0e 100644--- a/.changeset/two-bats-smoke.md+++ b/.changeset/two-bats-smoke.md@@ -33,7 +33,7 @@- Updated README, added tutorial/examples guide, supported client list documentation.- Adjusts the MCP server invokation in the mcp.json we ship with `task-master init`. Fully functional now.-- Rename the npx -y command. It's now `npx -y task-master-ai task-master-mcp`+- Rename the npx -y command. It's now `npx -y task-master-mcp`- Add additional binary alias: `task-master-mcp-server` pointing to the same MCP server script- **Significant improvements to model configuration:**diff --git a/README-task-master.md b/README-task-master.mdindex 61da5036..862e3744 100644--- a/README-task-master.md+++ b/README-task-master.md@@ -146,7 +146,7 @@ To enable enhanced task management capabilities directly within Cursor using the4. Configure with the following details:- Name: "Task Master"- Type: "Command"- - Command: "npx -y --package task-master-ai task-master-mcp"+ - Command: "npx -y task-master-mcp"5. Save the settingsOnce configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.diff --git a/README.md b/README.mdindex ed867782..6610109c 100644--- a/README.md+++ b/README.md@@ -27,7 +27,7 @@ MCP (Model Control Protocol) provides the easiest way to get started with Task M"mcpServers": {"taskmaster-ai": {"command": "npx",- "args": ["-y", "--package", "task-master-ai", "task-master-mcp"],+ "args": ["-y", "task-master-mcp"],"env": {"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE","PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",diff --git a/docs/tutorial.md b/docs/tutorial.mdindex 66c7b0a2..1dec41ba 100644--- a/docs/tutorial.md+++ b/docs/tutorial.md@@ -17,7 +17,7 @@ MCP (Model Control Protocol) provides the easiest way to get started with Task M"mcpServers": {"taskmaster-ai": {"command": "npx",- "args": ["-y", "--package", "task-master-ai", "task-master-mcp"],+ "args": ["-y", "task-master-mcp"],"env": {"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE","PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",@@ -132,7 +132,7 @@ You can also set up the MCP server in Cursor settings:4. Configure with the following details:- Name: "Task Master"- Type: "Command"- - Command: "npx -y --package task-master-ai task-master-mcp"+ - Command: "npx -y task-master-mcp"5. Save the settingsOnce configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.diff --git a/scripts/init.js b/scripts/init.jsindex c609874b..4bbd65ee 100755--- a/scripts/init.js+++ b/scripts/init.js@@ -909,7 +909,7 @@ function setupMCPConfiguration(targetDir, projectName) {const newMCPServer = {'task-master-ai': {command: 'npx',- args: ['-y', '--package', 'task-master-ai', 'task-master-mcp'],+ args: ['-y', 'task-master-mcp'],env: {ANTHROPIC_API_KEY: '%ANTHROPIC_API_KEY%',PERPLEXITY_API_KEY: '%PERPLEXITY_API_KEY%',@@ -925,7 +925,10 @@ function setupMCPConfiguration(targetDir, projectName) {// Check if mcp.json already existsif (fs.existsSync(mcpJsonPath)) {- log('info', 'MCP configuration file already exists, updating...');+ log(+ 'info',+ 'MCP configuration file already exists, checking for existing task-master-mcp...'+ );try {// Read existing configconst mcpConfig = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf8'));@@ -935,6 +938,23 @@ function setupMCPConfiguration(targetDir, projectName) {mcpConfig.mcpServers = {};}+ // Check if any existing server configuration already has task-master-mcp in its args+ const hasMCPString = Object.values(mcpConfig.mcpServers).some(+ (server) =>+ server.args &&+ server.args.some(+ (arg) => typeof arg === 'string' && arg.includes('task-master-mcp')+ )+ );++ if (hasMCPString) {+ log(+ 'info',+ 'Found existing task-master-mcp configuration in mcp.json, leaving untouched'+ );+ return; // Exit early, don't modify the existing configuration+ }+// Add the task-master-ai server if it doesn't existif (!mcpConfig.mcpServers['task-master-ai']) {mcpConfig.mcpServers['task-master-ai'] = newMCPServer['task-master-ai'];