Skip to main content
Glama
sitebay
by sitebay

sitebay_wordpress_proxy

Proxy HTTP requests to WordPress REST API endpoints for SiteBay-hosted sites. Send GET, POST, PUT, or DELETE requests to interact with WordPress content programmatically.

Instructions

Proxy requests to a WordPress site's REST API.

Args: fqdn: The site domain path: WordPress API path (e.g., "/wp-json/wp/v2/posts") query_params_json: Optional JSON string for payload or query params method: HTTP method (get, post, put, delete)

Returns: WordPress API response

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fqdnYes
pathNo/wp-json/wp/v2/
query_params_jsonNo
methodNoget

Implementation Reference

  • Main handler function for the sitebay_wordpress_proxy tool. Decorated with @mcp.tool for automatic registration. Constructs proxy data and calls SiteBayClient.wordpress_proxy method.
    @mcp.tool
    async def sitebay_wordpress_proxy(
        ctx: Context,
        fqdn: str,
        path: str = "/wp-json/wp/v2/",
        query_params_json: str = "",
        method: str = "get",
    ) -> str:
        """
        Proxy requests to a WordPress site's REST API.
        
        Args:
            fqdn: The site domain
            path: WordPress API path (e.g., "/wp-json/wp/v2/posts")
            query_params_json: Optional JSON string for payload or query params
            method: HTTP method (get, post, put, delete)
        
        Returns:
            WordPress API response
        """
        try:
            await ctx.info(f"WordPress proxy request to {fqdn}{path or ''}")
            
            client = await initialize_client()
            proxy_data: dict[str, Any] = {"fqdn": fqdn, "method": method, "path": path}
            if query_params_json:
                proxy_data["query_params_json"] = query_params_json
                
            result = await client.wordpress_proxy(proxy_data)
            return f"✅ WordPress API Response:\n```json\n{result}\n```"
            
        except SiteBayError as e:
            await ctx.error(f"WordPress proxy error: {str(e)}")
            return f"❌ WordPress Proxy Error: {str(e)}"
        except Exception as e:
            await ctx.error(f"Unexpected proxy error: {str(e)}")
            return f"❌ Unexpected error: {str(e)}"
  • Supporting method in SiteBayClient that forwards the WordPress proxy request to the SiteBay API endpoint /wp-proxy.
    async def wordpress_proxy(self, proxy_data: Dict[str, Any]) -> Any:
        """Proxy request to WordPress API"""
        return await self.post("/wp-proxy", json_data=proxy_data)
  • The @mcp.tool decorator registers the sitebay_wordpress_proxy function as an MCP tool.
    @mcp.tool

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/sitebay/sitebay-mcp'

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