Skip to content

Support all block-editor post types, not just posts #60

@pento

Description

@pento

Problem

The MCP server currently only supports post_type = 'post'. The WordPress REST API endpoint GET /wp/v2/posts/{id} returns a 404 for pages and custom post types — each post type has its own controller and endpoint (e.g., /wp/v2/pages/ for pages).

This means wp_open_post fails for pages, WooCommerce products, or any custom post type that uses the block editor.

Affected areas

MCP server (src/wordpress/api-client.ts)

  • getPost(), updatePost(), listPosts() all hardcode /wp/v2/posts
  • Need to resolve the correct REST base for a given post type (e.g., /wp/v2/pages for page)

WordPress plugin

  • getEntityRecord('postType', 'post', id) in ConnectionStatus hardcodes the post type when looking up titles for "Editing: ..." display
  • Command post_id doesn't include the post type, so the plugin can't resolve the correct entity

MCP tools

  • wp_open_post / wp_list_posts / wp_create_post should accept a post type parameter (defaulting to post)
  • wp_read_post output should indicate the post type

Sync protocol

  • The Yjs room format is already post-type-aware: postType/{type}:{id} — this should work as-is

Approach

  1. During connect(), fetch available post types from GET /wp/v2/types to build a map of post_type → rest_base
  2. Add an optional postType parameter to wp_open_post, wp_list_posts, wp_create_post (default: post)
  3. Use the resolved rest_base for all REST API calls on the opened post
  4. Include post_type in the command REST response so the plugin can resolve entity records correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions