list_servers
Retrieve and display all server names configured for a specific client, aiding in efficient management and synchronization of MCP server configurations across AI assistant clients.
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:268-305 (handler)The handler for the 'list_servers' tool. Validates the client, reads the configuration file, extracts server names from config.mcpServers, and returns them as JSON.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), }, ], }; }
- src/index.ts:155-168 (registration)Registration of the 'list_servers' tool in the ListToolsRequestSchema response, including name, description, and input schema.{ 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:158-167 (schema)Input schema definition for the 'list_servers' tool, requiring a 'client' string parameter.inputSchema: { type: 'object', properties: { client: { type: 'string', description: 'Client name (cline, roo_code, windsurf, claude)', }, }, required: ['client'], },