remove_server_configuration
Delete a specific server configuration from a client's configuration file. Input client name and server name to unlink the server setup, ensuring accurate synchronization across AI assistant systems.
Instructions
Remove a server configuration from a client configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client | Yes | Client name (cline, roo_code, windsurf, claude) | |
| server_name | Yes | Name of the server to remove |
Implementation Reference
- src/index.ts:402-460 (handler)Handler for the 'remove_server_configuration' tool. Validates client and server_name, reads the configuration file, removes the specified server configuration if it exists, writes the updated configuration back to the file, and returns the removed configuration as JSON.case 'remove_server_configuration': { const client = validateClient(args.client); const serverName = args.server_name; if (typeof serverName !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'server_name must be a string'); } const configPath = getConfigPath(client); let config; try { config = await readConfigFile(configPath); } catch (error) { if (error instanceof McpError && error.code === ErrorCode.InternalError && error.message.includes('not found')) { // If the configuration file doesn't exist, there's nothing to remove return { content: [ { type: 'text', text: `Server '${serverName}' not found in ${client} configuration (configuration file does not exist)`, }, ], }; } else { throw error; } } // Check if the server exists if (!config.mcpServers || !config.mcpServers[serverName]) { return { content: [ { type: 'text', text: `Server '${serverName}' not found in ${client} configuration`, }, ], }; } // Store the removed configuration const removedConfig = config.mcpServers[serverName]; // Remove the server configuration delete config.mcpServers[serverName]; // Write the updated configuration await writeConfigFile(configPath, config); return { content: [ { type: 'text', text: JSON.stringify(removedConfig, null, 2), }, ], }; }
- src/index.ts:214-231 (schema)Schema definition for the 'remove_server_configuration' tool, including name, description, and input schema requiring 'client' (string) and 'server_name' (string). This is part of the tool registration in the ListTools response.{ name: 'remove_server_configuration', description: 'Remove a server configuration from a client configuration', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, server_name: { type: 'string', description: 'Name of the server to remove', }, }, required: ['client', 'server_name'], }, },
- src/index.ts:126-233 (registration)Tool registration in the ListToolsRequestSchema handler, where all tools including 'remove_server_configuration' are defined and returned.tools: [ { name: 'get_configuration_path', description: 'Get the path to the configuration file for a specific client', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, }, required: ['client'], }, }, { name: 'get_configuration', description: 'Get the entire configuration for a specific client', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, }, required: ['client'], }, }, { name: 'list_servers', description: 'List all server names configured in a specific client', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, }, required: ['client'], }, }, { name: 'get_server_configuration', description: 'Get the configuration for a specific server from a client configuration', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, server_name: { type: 'string', description: 'Name of the server to retrieve', }, }, required: ['client', 'server_name'], }, }, { name: 'add_server_configuration', description: 'Add or update a server configuration in a client configuration', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, server_name: { type: 'string', description: 'Name of the server to add or update', }, json_config: { type: 'object', description: 'Server configuration in JSON format', }, allow_override: { type: 'boolean', description: 'Whether to allow overriding an existing server configuration with the same name (default: false)', default: false, }, }, required: ['client', 'server_name', 'json_config'], }, }, { name: 'remove_server_configuration', description: 'Remove a server configuration from a client configuration', inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, server_name: { type: 'string', description: 'Name of the server to remove', }, }, required: ['client', 'server_name'], }, }, ], }));