Skip to main content
Glama
gaupoit

WordPress MCP Server

by gaupoit

wp_get_pages

Retrieve pages from WordPress sites with options to filter by search terms and control result quantity for content management and navigation.

Instructions

Get pages from WordPress.

Args:
    per_page: Number of pages to return (1-100). Default is 10.
    search: Search term to filter pages by title/content.

Returns:
    List of pages with id, title, status, slug, and link.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
per_pageNo
searchNo

Implementation Reference

  • The MCP tool handler and registration for 'wp_get_pages'. This function defines the tool schema via type hints and docstring, and executes by delegating to WordPressClient.get_pages().
    @mcp.tool()
    def wp_get_pages(
        per_page: int = 10,
        search: str | None = None,
    ) -> list[dict]:
        """Get pages from WordPress.
    
        Args:
            per_page: Number of pages to return (1-100). Default is 10.
            search: Search term to filter pages by title/content.
    
        Returns:
            List of pages with id, title, status, slug, and link.
        """
        client = get_client()
        return client.get_pages(per_page=per_page, search=search)
  • Supporting method in WordPressClient that performs the actual API call to /wp/v2/pages, handles parameters, and formats the response data.
    def get_pages(
        self,
        per_page: int = 10,
        search: str | None = None,
    ) -> list[dict]:
        """Get pages from WordPress."""
        params = {"per_page": per_page}
    
        if search:
            params["search"] = search
    
        pages = self._get("pages", params)
    
        return [
            {
                "id": p["id"],
                "title": p["title"]["rendered"],
                "status": p["status"],
                "slug": p["slug"],
                "link": p["link"],
            }
            for p in pages
        ]

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

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