Skip to main content
Glama
landicefu

MCP Client Configuration Server

by landicefu

add_server_configuration

Add or update server configurations for AI assistant clients like Cline, Roo Code, WindSurf, and Claude to manage MCP server settings across platforms.

Instructions

Add or update a server configuration in a client configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientYesClient name (cline, roo_code, windsurf, claude)
server_nameYesName of the server to add or update
json_configYesServer configuration in JSON format
allow_overrideNoWhether to allow overriding an existing server configuration with the same name (default: false)

Implementation Reference

  • The switch case that handles the 'add_server_configuration' tool execution. It validates inputs, reads or initializes the client config file, checks for existing servers, adds or updates the server configuration based on allow_override, writes the config back, and returns a success message.
    case 'add_server_configuration': { const client = validateClient(args.client); const serverName = args.server_name; const jsonConfig = args.json_config; const allowOverride = args.allow_override === true; // Default to false if not provided if (typeof serverName !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'server_name must be a string'); } if (typeof jsonConfig !== 'object' || jsonConfig === null) { throw new McpError(ErrorCode.InvalidParams, 'json_config must be a valid JSON object'); } 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')) { // Create a new configuration if it doesn't exist config = { mcpServers: {} }; } else { throw error; } } // Ensure mcpServers object exists if (!config.mcpServers) { config.mcpServers = {}; } // Check if server with the same name already exists const serverExists = config.mcpServers.hasOwnProperty(serverName); if (serverExists && !allowOverride) { throw new McpError( ErrorCode.InvalidParams, `Server '${serverName}' already exists in ${client} configuration. Set allow_override to true to update it.` ); } // Add or update the server configuration config.mcpServers[serverName] = jsonConfig; // Write the updated configuration await writeConfigFile(configPath, config); const action = serverExists ? 'updated' : 'added'; return { content: [ { type: 'text', text: `Server '${serverName}' configuration ${action} in ${client} configuration`, }, ], }; }
  • The inputSchema defining the parameters for the add_server_configuration tool: client, server_name, json_config (required), and optional allow_override.
    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'],
  • src/index.ts:187-213 (registration)
    The tool registration object in the ListTools response, declaring the name, description, and inputSchema for add_server_configuration.
    { 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'], }, },

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