strapi_list_servers
Retrieve all configured Strapi CMS servers from the MCP server's settings for content management operations.
Instructions
List all available Strapi servers from the configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1417-1501 (handler)The handler logic for the 'strapi_list_servers' tool within the CallToolRequestSchema handler. It validates input, checks configuration, lists available Strapi servers with version details, or provides setup instructions if no servers are configured.if (name === "strapi_list_servers") { // Validate input using Zod const validatedArgs = validateToolInput("strapi_list_servers", args, requestId); if (Object.keys(config).length === 0) { const exampleConfig = { "myserver": { "api_url": "http://localhost:1337", "api_key": "your-jwt-token-from-strapi-admin", "version": "5.*" } }; result = { content: [ { type: "text", text: JSON.stringify({ error: "No servers configured", help: { message: "No server configuration found. Please create a configuration file.", config_path: CONFIG_PATH, example_config: exampleConfig, setup_steps: [ "Create the .mcp directory: mkdir -p ~/.mcp", "Create the config file: touch ~/.mcp/strapi-mcp-server.config.json", "Add your server configuration using the example above", "Get your JWT token from Strapi Admin Panel > Settings > API Tokens", "Make sure the file permissions are secure: chmod 600 ~/.mcp/strapi-mcp-server.config.json" ] } }, null, 2), }, ], }; } const servers = Object.keys(config).map(serverName => { const serverConfig = config[serverName]; const version = serverConfig.version || "v4"; // Default to v4 if not specified // Extract major version from different formats: "5.*", "4.1.5", "v4", "4.*" let majorVersion: keyof StrapiVersionDifferences; if (version.includes('*')) { // Handle "5.*" or "4.*" format majorVersion = version.split('.')[0] as keyof StrapiVersionDifferences; } else if (version.startsWith('v')) { // Handle "v4" or "v5" format majorVersion = version.substring(1) as keyof StrapiVersionDifferences; } else { // Handle "4.1.5" or plain "4" format majorVersion = version.split('.')[0] as keyof StrapiVersionDifferences; } return { name: serverName, api_url: serverConfig.api_url, version: serverConfig.version, version_details: STRAPI_VERSION_DIFFERENCES[majorVersion] }; }); result = { content: [ { type: "text", text: JSON.stringify({ servers, config_path: CONFIG_PATH, help: "To add more servers, edit the configuration file at the path shown above.", version_differences: STRAPI_VERSION_DIFFERENCES, user_action_required: { message: "Please specify which server you want to work with by providing the server name in your next command.", example: "For example: 'I want to work with the server \"myserver\"' or 'Use server \"myserver\" for the next operations'", available_servers: servers.map(s => s.name), warning: "Only use servers that are listed in available_servers. Do not attempt to access servers that are not properly configured." }, security: { note: "For security reasons, only servers listed in the configuration file can be accessed.", requirement: "Each server must be properly configured with valid credentials before use." } }, null, 2), }, ], }; } else if (name === "strapi_get_content_types") {
- src/index.ts:621-627 (schema)The ToolSchemas object that maps 'strapi_list_servers' to its Zod input schema (ListServersSchema, which is an empty object since no parameters are required).const ToolSchemas = { strapi_list_servers: ListServersSchema, strapi_get_content_types: GetContentTypesSchema, strapi_get_components: GetComponentsSchema, strapi_rest: RestSchema, strapi_upload_media: UploadMediaSchema } as const;
- src/index.ts:1245-1248 (registration)Registration of the 'strapi_list_servers' tool in the ListToolsRequestSchema handler, providing name, description, and input schema.name: "strapi_list_servers", description: "List all available Strapi servers from the configuration.", inputSchema: zodToJsonSchema(ToolSchemas.strapi_list_servers), },
- src/index.ts:462-463 (schema)Zod schema definition for 'strapi_list_servers' tool input validation. It expects no parameters.// Schema for strapi_list_servers tool (no parameters) const ListServersSchema = z.object({}).strict();