Skip to main content
Glama
landicefu

MCP Client Configuration Server

by landicefu

remove_server_configuration

Remove an MCP server configuration from a client's settings to manage AI assistant integrations.

Instructions

Remove a server configuration from a client configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientYesClient name (cline, roo_code, windsurf, claude)
server_nameYesName of the server to remove

Implementation Reference

  • Handler implementation for the 'remove_server_configuration' tool. It validates the client and server_name, reads the configuration file, removes the specified server from mcpServers if it exists, persists the updated config, 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),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and inputSchema for parameters 'client' (string) and 'server_name' (string), both required.
    {
      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)
    Registration of the 'remove_server_configuration' tool in the ListTools response within the setupToolHandlers method.
      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'],
          },
        },
      ],
    }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/landicefu/mcp-client-configuration-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server