Skip to main content
Glama

wp_test_auth

Test WordPress site authentication and connectivity with detailed diagnostics to verify credentials, troubleshoot connection issues, and ensure proper setup.

Instructions

Tests the authentication and connectivity for a configured WordPress site with detailed connection diagnostics.

Usage Examples: • Test connection: wp_test_auth • Multi-site test: wp_test_auth --site="my-site" • Verify setup: Use this after configuring new credentials • Troubleshoot: Run when experiencing connection issues • Health check: Regular verification of WordPress connectivity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.

Implementation Reference

  • The handleTestAuth function implements the core logic of the wp_test_auth tool: pings the WordPress site, retrieves the current user, formats a success message with site, method, user, and roles details, or throws an error on failure.
    public async handleTestAuth(
      client: WordPressClient,
      params: Record<string, unknown>,
    ): Promise<Record<string, unknown>> {
      try {
        await client.ping();
        const user = await client.getCurrentUser();
        const siteConfig = client.config;
    
        const content =
          "✅ **Authentication successful!**\n\n" +
          `**Site:** ${siteConfig.baseUrl}\n` +
          `**Method:** ${siteConfig.auth.method}\n` +
          `**User:** ${user.name} (@${user.slug})\n` +
          `**Roles:** ${user.roles?.join(", ") || "N/A"}\n\n` +
          "Your WordPress connection is working properly.";
    
        return { content };
      } catch (_error) {
        throw new Error(`Authentication test failed: ${getErrorMessage(_error)}`);
      }
    }
  • The tool definition object in AuthTools.getTools() that registers wp_test_auth with its name, detailed description, empty parameters (site added dynamically), and binds the handler.
      name: "wp_test_auth",
      description:
        "Tests the authentication and connectivity for a configured WordPress site with detailed connection diagnostics.\n\n" +
        "**Usage Examples:**\n" +
        "• Test connection: `wp_test_auth`\n" +
        '• Multi-site test: `wp_test_auth --site="my-site"`\n' +
        "• Verify setup: Use this after configuring new credentials\n" +
        "• Troubleshoot: Run when experiencing connection issues\n" +
        "• Health check: Regular verification of WordPress connectivity",
      parameters: [], // The 'site' parameter is added dynamically by the server
      handler: this.handleTestAuth.bind(this),
    },
  • Tool schema definition including name, description, and parameters array (empty, as 'site' parameter is dynamically added by ToolRegistry).
      name: "wp_test_auth",
      description:
        "Tests the authentication and connectivity for a configured WordPress site with detailed connection diagnostics.\n\n" +
        "**Usage Examples:**\n" +
        "• Test connection: `wp_test_auth`\n" +
        '• Multi-site test: `wp_test_auth --site="my-site"`\n' +
        "• Verify setup: Use this after configuring new credentials\n" +
        "• Troubleshoot: Run when experiencing connection issues\n" +
        "• Health check: Regular verification of WordPress connectivity",
      parameters: [], // The 'site' parameter is added dynamically by the server
      handler: this.handleTestAuth.bind(this),
    },

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/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server