(
name: string,
options: {
scope: string;
},
)
| 10 | import { loadSettings, SettingScope } from '../../config/settings.js'; |
| 11 | |
| 12 | async function removeMcpServer( |
| 13 | name: string, |
| 14 | options: { |
| 15 | scope: string; |
| 16 | }, |
| 17 | ) { |
| 18 | const { scope } = options; |
| 19 | const settingsScope = |
| 20 | scope === 'user' ? SettingScope.User : SettingScope.Workspace; |
| 21 | const settings = loadSettings(process.cwd()); |
| 22 | |
| 23 | const existingSettings = settings.forScope(settingsScope).settings; |
| 24 | const mcpServers = existingSettings.mcpServers || {}; |
| 25 | |
| 26 | if (!mcpServers[name]) { |
| 27 | console.log(`Server "${name}" not found in ${scope} settings.`); |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | delete mcpServers[name]; |
| 32 | |
| 33 | settings.setValue(settingsScope, 'mcpServers', mcpServers); |
| 34 | |
| 35 | console.log(`Server "${name}" removed from ${scope} settings.`); |
| 36 | } |
| 37 | |
| 38 | export const removeCommand: CommandModule = { |
| 39 | command: 'remove <name>', |
no test coverage detected