You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: enhance MCP server update process and documentation
- Update the `getServerContent` function to display code with line numbers for easier reference. - Revise the update process for existing MCP servers: - Prefer focused changes using `updateServer` with `updateType="section"` or `updateType="add"`. - Provide detailed instructions for using line numbers when making updates. - Clarify the requirements for updating the Claude Desktop config with new environment variables. - Improve error messages and documentation for tools like `updateMcpServer`, including more specific parameters. - Add new resources for handling Jira epics, including creation and retrieval functionalities. - Introduce additional tools for managing issues, such as creating, updating, and adding comments to issues. - Ensure all server interactions are well-documented and user-friendly by providing clear messages on successful operations and error states.
@@ -81,13 +81,20 @@ When a user asks for a new MCP server:
81
81
### SCENARIO 2: UPDATING AN EXISTING MCP SERVER
82
82
When a user wants to update an existing server or if there is already a server with same functionality:
83
83
1. Use listServers to show available servers
84
-
2. Retrieve the current code with getServerContent
84
+
2. Retrieve the current code with getServerContent, which will display the code with line numbers
85
85
3. Analyze the existing structure before making changes
86
-
4. Preserve existing functionality while adding new features
87
-
5. Follow the same code standards as the original
88
-
6. Install any new dependencies needed
89
-
7. Update the Claude Desktop config if new environment variables are needed
90
-
8. Clearly explain what changes you made
86
+
4. For updates, prefer focused, targeted changes over complete rewrites:
87
+
- Use updateServer with updateType="section" to modify specific parts
88
+
- Use updateServer with updateType="add" to insert new functionality
89
+
- Only use updateServer with updateType="full" when extensive changes are needed
90
+
5. When using updateServer with "section" or "add" types:
91
+
- ALWAYS refer to the exact line numbers shown in getServerContent output
92
+
- Double-check that your start/end lines match the correct sections of code
93
+
- Validate that insertAfterLine is the exact line where you want to insert code
94
+
6. Follow the same code standards as the original
95
+
7. Install any new dependencies needed
96
+
8. Explain how to update the Claude Desktop config if new environment variables are needed
97
+
9. Clearly explain what changes you made
91
98
92
99
## CODE IMPLEMENTATION REQUIREMENTS
93
100
- All servers must use the TypeScript SDK
@@ -101,7 +108,7 @@ When a user wants to update an existing server or if there is already a server w
101
108
## HANDLING API KEYS AND AUTHENTICATION
102
109
- If an API requires authentication, explain this requirement to the user
103
110
- API keys should ALWAYS be handled using environment variables configured in the Claude Desktop config
104
-
- When registering a server that requires API keys, update the Claude config to include placeholders for these keys
111
+
- When registering a server that requires API keys, clearly explain what environment variables need to be set in the Claude config
105
112
- In your code, access API keys using process.env.KEY_NAME
106
113
- Add clear validation for environment variables and helpful error messages if they're missing
107
114
- Clearly tell users which environment variables they need to set in the Claude Desktop config
@@ -111,17 +118,17 @@ When a user wants to update an existing server or if there is already a server w
111
118
112
119
## TOOLS TO USE
113
120
- listServers: To show available servers
114
-
- getServerContent: To retrieve existing server code
121
+
- getServerContent: To retrieve existing server code with line numbers
115
122
- getTemplate: To see example MCP server structure
116
123
- createMcpServer: To save a new server and register with Claude
117
-
- updateServer: To modify an existing server
124
+
- updateMcpServer: To update an existing server (full rewrite, section update, or add code)
118
125
- analyzeServerDependencies: To identify required packages
119
126
- installServerDependencies: To install npm packages
120
127
- getClaudeConfig: To get the current Claude Desktop configuration
121
128
- updateClaudeConfig: To update the Claude Desktop configuration with any environment variables needed
122
129
123
130
After creating or updating a server, provide a brief summary of what the server does and how to use it. Remind users to:
124
-
1. Edit their Claude Desktop config to add actual API keys (replacing any placeholders)
131
+
1. Update their Claude Desktop config to add actual API keys if needed
125
132
2. Install any required npm dependencies
126
133
3. Restart Claude Desktop after updating the server and config to apply changes
127
134
@@ -242,7 +249,7 @@ server.tool(
242
249
content: [
243
250
{
244
251
type: "text",
245
-
text: `Error: Server "${serverName}" already exists at ${filePath}. Use 'updateServer' to update it, or set 'overwriteExisting' to true to replace it.`,
252
+
text: `Error: Server "${serverName}" already exists at ${filePath}. Use 'updateMcpServer' to update it, or set 'overwriteExisting' to true to replace it.`,
246
253
},
247
254
],
248
255
isError: true,
@@ -381,33 +388,41 @@ Available tools:
381
388
- Returns an example MCP server template to help guide development
382
389
383
390
3. createMcpServer
384
-
- Creates a new JavaScript MCP server or updates an existing one
391
+
- Creates a new JavaScript MCP server and registers it with Claude Desktop
385
392
- Parameters:
386
393
- serverName: Name of your server (used for the filename)
387
394
- serverCode: The complete JavaScript code for your server
388
395
- registerWithClaude: Whether to register with Claude Desktop (default: true)
389
396
390
397
4. updateMcpServer
391
-
- Updates an existing JavaScript MCP server directly
398
+
- Updates an existing MCP server with flexible options
392
399
- Parameters:
393
400
- serverName: Name of the server to update
394
-
- serverCode: The updated JavaScript code for your server
401
+
- updateType: "full" (replace entire file), "section" (replace specific lines), or "add" (add new code)
402
+
- startLine: First line to replace (required for "section" updates)
403
+
- endLine: Last line to replace (required for "section" updates)
404
+
- insertAfterLine: Line after which to insert code (required for "add" updates)
405
+
- code: The new code to add or replace
406
+
- description: Optional description of the changes
395
407
396
408
5. listServers
397
409
- Lists all servers created with this tool
398
410
399
411
6. getClaudeConfig
400
412
- Retrieves the current Claude Desktop configuration
413
+
- Use this to check the current config before making changes
401
414
402
415
7. updateClaudeConfig
403
-
- Updates the Claude Desktop configuration file
416
+
- Updates the Claude Desktop configuration file, including environment variables
404
417
- Parameters:
405
418
- configData: Complete JSON configuration
419
+
- Use this to add API keys and other environment variables your server needs
406
420
407
421
8. getServerContent
408
-
- Retrieves the current content of a server file
422
+
- Retrieves the current content of a server file with line numbers
409
423
- Parameters:
410
424
- serverName: Name of the server to get content for
425
+
- Output includes line numbers for precise reference when updating
411
426
412
427
9. analyzeServerDependencies
413
428
- Analyzes a server file to detect npm dependencies
@@ -420,20 +435,36 @@ Available tools:
420
435
- dependencies: Array of package names to install
421
436
422
437
11. getHelp
423
-
- Shows this help message
438
+
- Shows this help message
424
439
425
440
Workflow for creating a new server:
426
441
1. Ask to create a custom server for your needs
427
442
2. Use createMcpServer to save the server and register it with Claude Desktop
428
443
3. Use analyzeServerDependencies to detect required packages
429
444
4. Use installServerDependencies to install the required packages
445
+
5. If needed, update the Claude Desktop config to add any required API keys
430
446
431
447
Workflow for updating servers:
432
448
1. Use listServers to find the exact name of the server you want to update
433
-
2. Use getServerContent with the exact server name to retrieve its current code
434
-
3. Make your modifications to the code
435
-
4. Use updateMcpServer with the server name and modified code to save changes
449
+
2. Use getServerContent with the exact server name to retrieve its current code with line numbers
450
+
3. Review the code and note the EXACT line numbers from the output for the section you want to modify
451
+
4. Choose the right update approach:
452
+
- For targeted changes: Use updateServer with updateType="section", providing the exact start and end lines
453
+
- For adding new functionality: Use updateServer with updateType="add", specifying the exact line after which to insert
454
+
- For complete rewrites: Use updateServer with updateType="full" (line numbers not needed)
436
455
5. If you added new dependencies, use analyzeServerDependencies and installServerDependencies
456
+
6. If you added new environment variables, update the Claude Desktop config
457
+
458
+
IMPORTANT: When using "section" or "add" update types, always use the exact line numbers from the getServerContent output to ensure precise updates.
459
+
460
+
Environment Variables in the Claude Desktop Config:
461
+
- Environment variables are stored in the "env" object for each server
462
+
- They're accessible in your server code via process.env.KEY
text: `Error: Server "${nameWithoutExtension}" does not exist. Please use 'listServers' first to see available servers, then use 'createServer' to create a new server if needed.`,
512
+
text: `Error: Server "${nameWithoutExtension}" does not exist. Please use 'listServers' first to see available servers.`,
469
513
},
470
514
],
471
515
isError: true,
472
516
};
473
517
}
474
518
475
-
awaitfs.writeFile(filePath,serverCode);
519
+
// For full update, just replace the entire file
520
+
if(updateType==="full"){
521
+
awaitfs.writeFile(filePath,code);
522
+
523
+
constupdateDetails=description
524
+
? `\nUpdate details: ${description}`
525
+
: "";
526
+
527
+
return{
528
+
content: [
529
+
{
530
+
type: "text",
531
+
text: `Successfully updated entire MCP server "${nameWithoutExtension}".${updateDetails}`,
532
+
},
533
+
],
534
+
};
535
+
}
536
+
537
+
// For section or add updates, read the current file
0 commit comments