list_servers
Retrieve a list of MCP servers with customizable filters such as search terms, integration slugs, and pagination options for precise server data management.
Instructions
List MCP servers with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count_per_page | No | Number of results per page (maximum: 5000) | |
| integrations | No | Filter by integration slugs | |
| offset | No | Number of results to skip for pagination | |
| query | No | Search term to filter servers |
Implementation Reference
- src/index.ts:139-184 (handler)Handler logic for 'list_servers' tool: validates input arguments using isListServersArgs, performs an API GET request to '/servers' with provided parameters, and returns the formatted JSON response or an error.case "list_servers": { if (!isListServersArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, "Invalid arguments for list_servers" ); } try { const response = await this.axiosInstance.get<ListServersResponse>( "/servers", { params: { query: request.params.arguments.query, "integrations[]": request.params.arguments.integrations, count_per_page: request.params.arguments.count_per_page, offset: request.params.arguments.offset, }, } ); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [ { type: "text", text: `API Error: ${ error.response?.data?.error?.message ?? error.message }`, }, ], isError: true, }; } throw error; } }
- src/index.ts:97-125 (registration)Tool registration for 'list_servers' in the ListToolsRequestHandler response, defining name, description, and input schema.{ name: "list_servers", description: "List MCP servers with optional filtering", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term to filter servers", }, integrations: { type: "array", items: { type: "string", }, description: "Filter by integration slugs", }, count_per_page: { type: "number", description: "Number of results per page (maximum: 5000)", maximum: 5000, }, offset: { type: "number", description: "Number of results to skip for pagination", }, }, }, },
- src/index.ts:14-19 (schema)TypeScript interface defining the input arguments for the list_servers tool.interface ListServersArgs { query?: string; integrations?: string[]; count_per_page?: number; offset?: number; }
- src/index.ts:21-41 (schema)TypeScript interface defining the expected API response structure for list_servers.interface ListServersResponse { servers: Array<{ name: string; url: string; external_url?: string; short_description?: string; source_code_url?: string; github_stars?: number; package_registry?: string; package_name?: string; package_download_count?: number; EXPERIMENTAL_ai_generated_description?: string; integrations: Array<{ name: string; slug: string; url: string; }>; }>; next?: string; total_count: number; }
- src/index.ts:51-61 (helper)Validator function to check if provided arguments match ListServersArgs interface, used in the handler.const isListServersArgs = (args: any): args is ListServersArgs => { if (typeof args !== "object" || args === null) return false; if ("query" in args && typeof args.query !== "string") return false; if ("integrations" in args && !Array.isArray(args.integrations)) return false; if ("count_per_page" in args && typeof args.count_per_page !== "number") return false; if ("offset" in args && typeof args.offset !== "number") return false; return true; };