Don't add task-master-mcp to mcp.json if it already exists (#169)
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
- Updated README, added tutorial/examples guide, supported client list documentation.
|
- 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.
|
- 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
|
- Add additional binary alias: `task-master-mcp-server` pointing to the same MCP server script
|
||||||
|
|
||||||
- **Significant improvements to model configuration:**
|
- **Significant improvements to model configuration:**
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ To enable enhanced task management capabilities directly within Cursor using the
|
|||||||
4. Configure with the following details:
|
4. Configure with the following details:
|
||||||
- Name: "Task Master"
|
- Name: "Task Master"
|
||||||
- Type: "Command"
|
- Type: "Command"
|
||||||
- Command: "npx -y --package task-master-ai task-master-mcp"
|
- Command: "npx -y task-master-mcp"
|
||||||
5. Save the settings
|
5. Save the settings
|
||||||
|
|
||||||
Once configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.
|
Once configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ MCP (Model Control Protocol) provides the easiest way to get started with Task M
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"taskmaster-ai": {
|
"taskmaster-ai": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--package", "task-master-ai", "task-master-mcp"],
|
"args": ["-y", "task-master-mcp"],
|
||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
|
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
|
||||||
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
|
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ MCP (Model Control Protocol) provides the easiest way to get started with Task M
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"taskmaster-ai": {
|
"taskmaster-ai": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "--package", "task-master-ai", "task-master-mcp"],
|
"args": ["-y", "task-master-mcp"],
|
||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
|
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
|
||||||
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_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:
|
4. Configure with the following details:
|
||||||
- Name: "Task Master"
|
- Name: "Task Master"
|
||||||
- Type: "Command"
|
- Type: "Command"
|
||||||
- Command: "npx -y --package task-master-ai task-master-mcp"
|
- Command: "npx -y task-master-mcp"
|
||||||
5. Save the settings
|
5. Save the settings
|
||||||
|
|
||||||
Once configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.
|
Once configured, you can interact with Task Master's task management commands directly through Cursor's interface, providing a more integrated experience.
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ function setupMCPConfiguration(targetDir, projectName) {
|
|||||||
const newMCPServer = {
|
const newMCPServer = {
|
||||||
'task-master-ai': {
|
'task-master-ai': {
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['-y', '--package', 'task-master-ai', 'task-master-mcp'],
|
args: ['-y', 'task-master-mcp'],
|
||||||
env: {
|
env: {
|
||||||
ANTHROPIC_API_KEY: '%ANTHROPIC_API_KEY%',
|
ANTHROPIC_API_KEY: '%ANTHROPIC_API_KEY%',
|
||||||
PERPLEXITY_API_KEY: '%PERPLEXITY_API_KEY%',
|
PERPLEXITY_API_KEY: '%PERPLEXITY_API_KEY%',
|
||||||
@@ -925,7 +925,10 @@ function setupMCPConfiguration(targetDir, projectName) {
|
|||||||
|
|
||||||
// Check if mcp.json already exists
|
// Check if mcp.json already exists
|
||||||
if (fs.existsSync(mcpJsonPath)) {
|
if (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 {
|
try {
|
||||||
// Read existing config
|
// Read existing config
|
||||||
const mcpConfig = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf8'));
|
const mcpConfig = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf8'));
|
||||||
@@ -935,6 +938,23 @@ function setupMCPConfiguration(targetDir, projectName) {
|
|||||||
mcpConfig.mcpServers = {};
|
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 exist
|
// Add the task-master-ai server if it doesn't exist
|
||||||
if (!mcpConfig.mcpServers['task-master-ai']) {
|
if (!mcpConfig.mcpServers['task-master-ai']) {
|
||||||
mcpConfig.mcpServers['task-master-ai'] = newMCPServer['task-master-ai'];
|
mcpConfig.mcpServers['task-master-ai'] = newMCPServer['task-master-ai'];
|
||||||
|
|||||||
Reference in New Issue
Block a user