Skip to main content
Glama
landicefu

MCP Client Configuration Server

by landicefu

list_servers

Retrieve all configured server names for a specific MCP client to manage and synchronize configurations across AI assistant platforms.

Instructions

List all server names configured in a specific client

Input Schema

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

Implementation Reference

  • src/index.ts:155-168 (registration)
    Registration of the 'list_servers' tool in the ListTools response, including name, description, and input schema requiring a 'client' parameter.
    {
      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'],
      },
    },
  • Handler function for the 'list_servers' tool. Validates the client, reads the configuration file (returns empty array if not found), extracts server names from config.mcpServers using Object.keys, and returns them as a JSON string.
    case 'list_servers': {
      const client = validateClient(args.client);
      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')) {
          // Return empty array if configuration file doesn't exist
          return {
            content: [
              {
                type: 'text',
                text: '[]',
              },
            ],
          };
        } else {
          throw error;
        }
      }
      
      // Extract server names from the configuration
      let serverNames: string[] = [];
      if (config.mcpServers && typeof config.mcpServers === 'object') {
        serverNames = Object.keys(config.mcpServers);
      }
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(serverNames, null, 2),
          },
        ],
      };
    }

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