Skip to main content
Glama
landicefu

MCP Client Configuration Server

by landicefu

get_configuration

Retrieve complete configuration settings for a specific AI assistant client to manage and synchronize MCP server setups.

Instructions

Get the entire configuration for a specific client

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientYesClient name (cline, roo_code, windsurf, claude)

Implementation Reference

  • Main handler for 'get_configuration' tool: validates client input, computes config path, reads and parses config file, returns pretty-printed JSON.
    case 'get_configuration': {
      const client = validateClient(args.client);
      const configPath = getConfigPath(client);
      const config = await readConfigFile(configPath);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(config, null, 2),
          },
        ],
      };
    }
  • src/index.ts:141-154 (registration)
    Tool registration in ListToolsRequestSchema response, defining name, description, and input schema.
    {
      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'],
      },
    },
  • Helper function that reads the configuration file at the given path and parses it as JSON, throwing MCP errors on failure. Used directly in the handler.
    const readConfigFile = async (configPath: string): Promise<any> => {
      try {
        const data = await fs.readFile(configPath, 'utf8');
        return JSON.parse(data);
      } catch (error: unknown) {
        if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
          throw new McpError(ErrorCode.InternalError, `Configuration file not found: ${configPath}`);
        }
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(ErrorCode.InternalError, `Error reading configuration file: ${errorMessage}`);
      }
    };
  • Helper function to determine the exact file path for a client's MCP configuration based on OS platform and client type. Called by the handler.
    const getConfigPath = (client: ClientType): string => {
      const platform = os.platform();
      const homeDir = os.homedir();
      
      if (platform === 'win32') {
        // Windows paths
        switch (client) {
          case 'cline':
            return path.join(homeDir, 'AppData', 'Roaming', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json');
          case 'roo_code':
            return path.join(homeDir, 'AppData', 'Roaming', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json');
          case 'windsurf':
            return path.join(homeDir, 'AppData', 'Roaming', 'WindSurf', 'mcp_settings.json');
          case 'claude':
            return path.join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
          default:
            throw new McpError(ErrorCode.InvalidParams, `Unsupported client: ${client}`);
        }
      } else if (platform === 'darwin') {
        // macOS paths
        switch (client) {
          case 'cline':
            return path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json');
          case 'roo_code':
            return path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', 'rooveterinaryinc.roo-cline', 'settings', 'cline_mcp_settings.json');
          case 'windsurf':
            return path.join(homeDir, '.codeium', 'windsurf', 'mcp_config.json');
          case 'claude':
            return path.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
          default:
            throw new McpError(ErrorCode.InvalidParams, `Unsupported client: ${client}`);
        }
      } else {
        throw new McpError(ErrorCode.InternalError, `Unsupported platform: ${platform}`);
      }
  • Helper function to validate and type-check the client parameter. Used at the start of the handler.
    const validateClient = (client: unknown): ClientType => {
      if (typeof client !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Client must be a string');
      }
      
      const validClients: ClientType[] = ['cline', 'roo_code', 'windsurf', 'claude'];
      if (!validClients.includes(client as ClientType)) {
        throw new McpError(ErrorCode.InvalidParams, `Invalid client: ${client}. Must be one of: ${validClients.join(', ')}`);
      }
      
      return client as ClientType;
    };

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