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
| Name | Required | Description | Default |
|---|---|---|---|
| client | Yes | Client 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'], }, },
- src/index.ts:268-305 (handler)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), }, ], }; }