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
| Name | Required | Description | Default |
|---|---|---|---|
| fqdn | Yes | ||
| path | No | /wp-json/wp/v2/ | |
| query_params_json | No | ||
| method | No | get |
Implementation Reference
- src/sitebay_mcp/server.py:377-414 (handler)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)}"
- src/sitebay_mcp/client.py:323-325 (helper)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)
- src/sitebay_mcp/server.py:377-377 (registration)The @mcp.tool decorator registers the sitebay_wordpress_proxy function as an MCP tool.@mcp.tool