WordPress MCP Server API Reference

April 5, 2025 ยท View on GitHub

This document provides detailed documentation for all the tools available in the WordPress MCP Server.

Table of Contents

Site Management Tools

add_site

Add a new WordPress site to the server.

Parameters:

  • name (string, required): Name of the site
  • url (string, required): URL of the WordPress site
  • username (string, required): WordPress username
  • applicationPassword (string, required): WordPress application password
  • validate (boolean, optional): Whether to validate the site credentials (default: true)

Example:

{
  "name": "My WordPress Site",
  "url": "https://example.com",
  "username": "admin",
  "applicationPassword": "XXXX XXXX XXXX XXXX XXXX XXXX"
}

Response:

{
  "status": "success",
  "message": "Site added successfully",
  "site": {
    "id": "site-1",
    "name": "My WordPress Site",
    "url": "https://example.com",
    "username": "admin"
  }
}

list_sites

List all WordPress sites.

Parameters:

  • includeCredentials (boolean, optional): Whether to include credentials in the response (default: false)

Example:

{
  "includeCredentials": false
}

Response:

{
  "status": "success",
  "sites": [
    {
      "id": "site-1",
      "name": "My WordPress Site",
      "url": "https://example.com",
      "username": "admin"
    }
  ]
}

get_site

Get a WordPress site by ID or name.

Parameters:

  • id (string, optional): Site ID
  • name (string, optional): Site name
  • includeCredentials (boolean, optional): Whether to include credentials in the response (default: false)

Example:

{
  "id": "site-1"
}

Response:

{
  "status": "success",
  "site": {
    "id": "site-1",
    "name": "My WordPress Site",
    "url": "https://example.com",
    "username": "admin"
  }
}

update_site

Update a WordPress site.

Parameters:

  • id (string, required): Site ID
  • name (string, optional): Site name
  • url (string, optional): Site URL
  • username (string, optional): WordPress username
  • applicationPassword (string, optional): WordPress application password
  • validate (boolean, optional): Whether to validate the site credentials (default: true)

Example:

{
  "id": "site-1",
  "name": "Updated Site Name"
}

Response:

{
  "status": "success",
  "message": "Site updated successfully",
  "site": {
    "id": "site-1",
    "name": "Updated Site Name",
    "url": "https://example.com",
    "username": "admin"
  }
}

remove_site

Remove a WordPress site.

Parameters:

  • id (string, required): Site ID

Example:

{
  "id": "site-1"
}

Response:

{
  "status": "success",
  "message": "Site removed successfully"
}

select_site

Select a WordPress site as the active site.

Parameters:

  • id (string, required): Site ID

Example:

{
  "id": "site-1"
}

Response:

{
  "status": "success",
  "message": "Site selected successfully",
  "site": {
    "id": "site-1",
    "name": "My WordPress Site",
    "url": "https://example.com",
    "username": "admin"
  }
}

get_active_site

Get the active WordPress site.

Parameters:

  • includeCredentials (boolean, optional): Whether to include credentials in the response (default: false)

Example:

{
  "includeCredentials": false
}

Response:

{
  "status": "success",
  "site": {
    "id": "site-1",
    "name": "My WordPress Site",
    "url": "https://example.com",
    "username": "admin"
  }
}

test_site_connectivity

Test connectivity to a WordPress site.

Parameters:

  • id (string, required): Site ID

Example:

{
  "id": "site-1"
}

Response:

{
  "status": "success",
  "message": "Site is reachable",
  "site": {
    "id": "site-1",
    "name": "My WordPress Site",
    "url": "https://example.com",
    "username": "admin"
  }
}

get_site_info

Get information about a WordPress site.

Parameters:

  • id (string, required): Site ID

Example:

{
  "id": "site-1"
}

Response:

{
  "status": "success",
  "site_info": {
    "name": "My WordPress Site",
    "description": "Just another WordPress site",
    "url": "https://example.com",
    "home": "https://example.com",
    "gmt_offset": "0",
    "timezone_string": "UTC",
    "language": "en-US",
    "wordpress_version": "6.2.2",
    "permalink_structure": "/%postname%/",
    "is_multisite": false
  }
}

Content Management Tools

Post Tools

list_posts

List posts with filtering and pagination.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • per_page (integer, optional): Number of posts per page (default: 10)
  • page (integer, optional): Page number (default: 1)
  • status (string, optional): Post status (default: "publish")
  • search (string, optional): Search term
  • author (integer, optional): Author ID
  • categories (array, optional): Category IDs
  • tags (array, optional): Tag IDs
  • order (string, optional): Order ("asc" or "desc", default: "desc")
  • orderby (string, optional): Order by field (default: "date")

Example:

{
  "per_page": 5,
  "page": 1,
  "status": "publish",
  "orderby": "title",
  "order": "asc"
}

Response:

{
  "status": "success",
  "count": 5,
  "total": 25,
  "pages": 5,
  "posts": [
    {
      "id": 1,
      "title": {
        "rendered": "Hello World"
      },
      "content": {
        "rendered": "<p>Welcome to WordPress!</p>"
      },
      "excerpt": {
        "rendered": "<p>Welcome to WordPress!</p>"
      },
      "status": "publish",
      "date": "2023-01-01T12:00:00",
      "modified": "2023-01-01T12:00:00",
      "author": 1,
      "featured_media": 0,
      "comment_status": "open",
      "ping_status": "open",
      "sticky": false,
      "format": "standard",
      "categories": [1],
      "tags": []
    },
    // ... more posts
  ]
}

get_post

Get a post by ID.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • post_id (integer, required): Post ID

Example:

{
  "post_id": 1
}

Response:

{
  "status": "success",
  "post": {
    "id": 1,
    "title": {
      "rendered": "Hello World"
    },
    "content": {
      "rendered": "<p>Welcome to WordPress!</p>"
    },
    "excerpt": {
      "rendered": "<p>Welcome to WordPress!</p>"
    },
    "status": "publish",
    "date": "2023-01-01T12:00:00",
    "modified": "2023-01-01T12:00:00",
    "author": 1,
    "featured_media": 0,
    "comment_status": "open",
    "ping_status": "open",
    "sticky": false,
    "format": "standard",
    "categories": [1],
    "tags": []
  }
}

create_post

Create a new post.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • title (string, required): Post title
  • content (string, optional): Post content
  • excerpt (string, optional): Post excerpt
  • status (string, optional): Post status (default: "draft")
  • author (integer, optional): Author ID
  • featured_media (integer, optional): Featured media ID
  • comment_status (string, optional): Comment status ("open" or "closed")
  • ping_status (string, optional): Ping status ("open" or "closed")
  • format (string, optional): Post format
  • sticky (boolean, optional): Whether the post is sticky
  • categories (array, optional): Category IDs
  • tags (array, optional): Tag IDs

Example:

{
  "title": "My New Post",
  "content": "This is the content of my new post.",
  "excerpt": "This is the excerpt of my new post.",
  "status": "publish",
  "categories": [1, 2],
  "tags": [3, 4]
}

Response:

{
  "status": "success",
  "message": "Post created successfully",
  "post": {
    "id": 2,
    "title": {
      "rendered": "My New Post"
    },
    "content": {
      "rendered": "<p>This is the content of my new post.</p>"
    },
    "excerpt": {
      "rendered": "<p>This is the excerpt of my new post.</p>"
    },
    "status": "publish",
    "date": "2023-01-02T12:00:00",
    "modified": "2023-01-02T12:00:00",
    "author": 1,
    "featured_media": 0,
    "comment_status": "open",
    "ping_status": "open",
    "sticky": false,
    "format": "standard",
    "categories": [1, 2],
    "tags": [3, 4]
  }
}

update_post

Update an existing post.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • post_id (integer, required): Post ID
  • title (string, optional): Post title
  • content (string, optional): Post content
  • excerpt (string, optional): Post excerpt
  • status (string, optional): Post status
  • author (integer, optional): Author ID
  • featured_media (integer, optional): Featured media ID
  • comment_status (string, optional): Comment status ("open" or "closed")
  • ping_status (string, optional): Ping status ("open" or "closed")
  • format (string, optional): Post format
  • sticky (boolean, optional): Whether the post is sticky
  • categories (array, optional): Category IDs
  • tags (array, optional): Tag IDs

Example:

{
  "post_id": 2,
  "title": "Updated Post Title",
  "content": "This is the updated content."
}

Response:

{
  "status": "success",
  "message": "Post updated successfully",
  "post": {
    "id": 2,
    "title": {
      "rendered": "Updated Post Title"
    },
    "content": {
      "rendered": "<p>This is the updated content.</p>"
    },
    "excerpt": {
      "rendered": "<p>This is the excerpt of my new post.</p>"
    },
    "status": "publish",
    "date": "2023-01-02T12:00:00",
    "modified": "2023-01-02T13:00:00",
    "author": 1,
    "featured_media": 0,
    "comment_status": "open",
    "ping_status": "open",
    "sticky": false,
    "format": "standard",
    "categories": [1, 2],
    "tags": [3, 4]
  }
}

delete_post

Delete a post.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • post_id (integer, required): Post ID
  • force (boolean, optional): Whether to bypass trash and force deletion (default: false)

Example:

{
  "post_id": 2,
  "force": true
}

Response:

{
  "status": "success",
  "message": "Post deleted successfully",
  "post": {
    "id": 2,
    "title": {
      "rendered": "Updated Post Title"
    },
    "status": "trash"
  }
}

Page Tools

list_pages

List pages with filtering and pagination.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • per_page (integer, optional): Number of pages per page (default: 10)
  • page (integer, optional): Page number (default: 1)
  • status (string, optional): Page status (default: "publish")
  • search (string, optional): Search term
  • author (integer, optional): Author ID
  • parent (integer, optional): Parent page ID
  • order (string, optional): Order ("asc" or "desc", default: "desc")
  • orderby (string, optional): Order by field (default: "date")

Example:

{
  "per_page": 5,
  "page": 1,
  "status": "publish",
  "orderby": "title",
  "order": "asc"
}

Response:

{
  "status": "success",
  "count": 3,
  "total": 3,
  "pages": 1,
  "pages_data": [
    {
      "id": 2,
      "title": {
        "rendered": "About"
      },
      "content": {
        "rendered": "<p>This is the about page.</p>"
      },
      "excerpt": {
        "rendered": "<p>This is the about page.</p>"
      },
      "status": "publish",
      "date": "2023-01-01T12:00:00",
      "modified": "2023-01-01T12:00:00",
      "author": 1,
      "featured_media": 0,
      "parent": 0,
      "menu_order": 0,
      "comment_status": "closed",
      "ping_status": "closed",
      "template": ""
    },
    // ... more pages
  ]
}

get_page

Get a page by ID.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • page_id (integer, required): Page ID

Example:

{
  "page_id": 2
}

Response:

{
  "status": "success",
  "page": {
    "id": 2,
    "title": {
      "rendered": "About"
    },
    "content": {
      "rendered": "<p>This is the about page.</p>"
    },
    "excerpt": {
      "rendered": "<p>This is the about page.</p>"
    },
    "status": "publish",
    "date": "2023-01-01T12:00:00",
    "modified": "2023-01-01T12:00:00",
    "author": 1,
    "featured_media": 0,
    "parent": 0,
    "menu_order": 0,
    "comment_status": "closed",
    "ping_status": "closed",
    "template": ""
  }
}

create_page

Create a new page.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • title (string, required): Page title
  • content (string, optional): Page content
  • excerpt (string, optional): Page excerpt
  • status (string, optional): Page status (default: "draft")
  • author (integer, optional): Author ID
  • featured_media (integer, optional): Featured media ID
  • parent (integer, optional): Parent page ID
  • menu_order (integer, optional): Menu order
  • comment_status (string, optional): Comment status ("open" or "closed")
  • ping_status (string, optional): Ping status ("open" or "closed")
  • template (string, optional): Page template

Example:

{
  "title": "Contact",
  "content": "This is the contact page.",
  "status": "publish",
  "parent": 0
}

Response:

{
  "status": "success",
  "message": "Page created successfully",
  "page": {
    "id": 3,
    "title": {
      "rendered": "Contact"
    },
    "content": {
      "rendered": "<p>This is the contact page.</p>"
    },
    "excerpt": {
      "rendered": "<p>This is the contact page.</p>"
    },
    "status": "publish",
    "date": "2023-01-03T12:00:00",
    "modified": "2023-01-03T12:00:00",
    "author": 1,
    "featured_media": 0,
    "parent": 0,
    "menu_order": 0,
    "comment_status": "closed",
    "ping_status": "closed",
    "template": ""
  }
}

update_page

Update an existing page.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • page_id (integer, required): Page ID
  • title (string, optional): Page title
  • content (string, optional): Page content
  • excerpt (string, optional): Page excerpt
  • status (string, optional): Page status
  • author (integer, optional): Author ID
  • featured_media (integer, optional): Featured media ID
  • parent (integer, optional): Parent page ID
  • menu_order (integer, optional): Menu order
  • comment_status (string, optional): Comment status ("open" or "closed")
  • ping_status (string, optional): Ping status ("open" or "closed")
  • template (string, optional): Page template

Example:

{
  "page_id": 3,
  "title": "Updated Contact Page",
  "content": "This is the updated contact page."
}

Response:

{
  "status": "success",
  "message": "Page updated successfully",
  "page": {
    "id": 3,
    "title": {
      "rendered": "Updated Contact Page"
    },
    "content": {
      "rendered": "<p>This is the updated contact page.</p>"
    },
    "excerpt": {
      "rendered": "<p>This is the contact page.</p>"
    },
    "status": "publish",
    "date": "2023-01-03T12:00:00",
    "modified": "2023-01-03T13:00:00",
    "author": 1,
    "featured_media": 0,
    "parent": 0,
    "menu_order": 0,
    "comment_status": "closed",
    "ping_status": "closed",
    "template": ""
  }
}

delete_page

Delete a page.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • page_id (integer, required): Page ID
  • force (boolean, optional): Whether to bypass trash and force deletion (default: false)

Example:

{
  "page_id": 3,
  "force": true
}

Response:

{
  "status": "success",
  "message": "Page deleted successfully",
  "page": {
    "id": 3,
    "title": {
      "rendered": "Updated Contact Page"
    },
    "status": "trash"
  }
}

Media Tools

list_media

List media items with filtering and pagination.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • per_page (integer, optional): Number of media items per page (default: 10)
  • page (integer, optional): Page number (default: 1)
  • search (string, optional): Search term
  • author (integer, optional): Author ID
  • media_type (string, optional): Media type (e.g., "image", "video", "audio")
  • mime_type (string, optional): MIME type (e.g., "image/jpeg", "video/mp4")
  • order (string, optional): Order ("asc" or "desc", default: "desc")
  • orderby (string, optional): Order by field (default: "date")

Example:

{
  "per_page": 5,
  "page": 1,
  "media_type": "image",
  "orderby": "title",
  "order": "asc"
}

Response:

{
  "status": "success",
  "count": 3,
  "total": 3,
  "pages": 1,
  "media": [
    {
      "id": 10,
      "date": "2023-01-01T12:00:00",
      "date_gmt": "2023-01-01T12:00:00",
      "guid": {
        "rendered": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
      },
      "modified": "2023-01-01T12:00:00",
      "modified_gmt": "2023-01-01T12:00:00",
      "slug": "image1",
      "status": "inherit",
      "type": "attachment",
      "link": "https://example.com/image1/",
      "title": {
        "rendered": "Image 1"
      },
      "author": 1,
      "comment_status": "open",
      "ping_status": "closed",
      "template": "",
      "meta": [],
      "description": {
        "rendered": "<p>This is image 1.</p>"
      },
      "caption": {
        "rendered": "<p>Caption for image 1.</p>"
      },
      "alt_text": "Alt text for image 1",
      "media_type": "image",
      "mime_type": "image/jpeg",
      "media_details": {
        "width": 1920,
        "height": 1080,
        "file": "2023/01/image1.jpg",
        "sizes": {
          "thumbnail": {
            "file": "image1-150x150.jpg",
            "width": 150,
            "height": 150,
            "mime_type": "image/jpeg",
            "source_url": "https://example.com/wp-content/uploads/2023/01/image1-150x150.jpg"
          },
          "medium": {
            "file": "image1-300x169.jpg",
            "width": 300,
            "height": 169,
            "mime_type": "image/jpeg",
            "source_url": "https://example.com/wp-content/uploads/2023/01/image1-300x169.jpg"
          },
          "large": {
            "file": "image1-1024x576.jpg",
            "width": 1024,
            "height": 576,
            "mime_type": "image/jpeg",
            "source_url": "https://example.com/wp-content/uploads/2023/01/image1-1024x576.jpg"
          },
          "full": {
            "file": "image1.jpg",
            "width": 1920,
            "height": 1080,
            "mime_type": "image/jpeg",
            "source_url": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
          }
        }
      },
      "source_url": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
    },
    // ... more media items
  ]
}

get_media

Get a media item by ID.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • media_id (integer, required): Media ID

Example:

{
  "media_id": 10
}

Response:

{
  "status": "success",
  "media": {
    "id": 10,
    "date": "2023-01-01T12:00:00",
    "date_gmt": "2023-01-01T12:00:00",
    "guid": {
      "rendered": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
    },
    "modified": "2023-01-01T12:00:00",
    "modified_gmt": "2023-01-01T12:00:00",
    "slug": "image1",
    "status": "inherit",
    "type": "attachment",
    "link": "https://example.com/image1/",
    "title": {
      "rendered": "Image 1"
    },
    "author": 1,
    "comment_status": "open",
    "ping_status": "closed",
    "template": "",
    "meta": [],
    "description": {
      "rendered": "<p>This is image 1.</p>"
    },
    "caption": {
      "rendered": "<p>Caption for image 1.</p>"
    },
    "alt_text": "Alt text for image 1",
    "media_type": "image",
    "mime_type": "image/jpeg",
    "media_details": {
      "width": 1920,
      "height": 1080,
      "file": "2023/01/image1.jpg",
      "sizes": {
        "thumbnail": {
          "file": "image1-150x150.jpg",
          "width": 150,
          "height": 150,
          "mime_type": "image/jpeg",
          "source_url": "https://example.com/wp-content/uploads/2023/01/image1-150x150.jpg"
        },
        "medium": {
          "file": "image1-300x169.jpg",
          "width": 300,
          "height": 169,
          "mime_type": "image/jpeg",
          "source_url": "https://example.com/wp-content/uploads/2023/01/image1-300x169.jpg"
        },
        "large": {
          "file": "image1-1024x576.jpg",
          "width": 1024,
          "height": 576,
          "mime_type": "image/jpeg",
          "source_url": "https://example.com/wp-content/uploads/2023/01/image1-1024x576.jpg"
        },
        "full": {
          "file": "image1.jpg",
          "width": 1920,
          "height": 1080,
          "mime_type": "image/jpeg",
          "source_url": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
        }
      }
    },
    "source_url": "https://example.com/wp-content/uploads/2023/01/image1.jpg"
  }
}

upload_media

Upload a media file.

Parameters:

  • site_id (string, optional): Site ID (defaults to active site)
  • file_path (string, required): Path to the file to upload
  • title (string, optional): Media title
  • alt_text (string, optional): Alt text
  • caption (string, optional): Caption
  • description (string, optional): Description

Example:

{
  "file_path": "/path/to/image.jpg",
  "title": "My Image",
  "alt_text": "A beautiful image"
}

Response:

{
  "status": "success",
  "message": "Media uploaded successfully",
  "media": {
    "id": 11,
    "date": "2023-01-04T12:00:00",
    "date_gmt": "2023-01-04T12:00:00",
    "guid": {
      "rendered": "https://example.com/wp-content/uploads/2023/01/image.jpg"
    },
    "modified": "2023-01-04T12:00:00",
    "modified_gmt": "2023-01-04T12:00:00",
    "slug": "image",
    "status": "inherit",
    "type": "attachment",
    "link": "https://example.com/image/",
    "title": {
      "rendered": "My Image"
    },
    "author": 1,
    "comment_status": "open",
    "ping_status": "closed",
    "template": "",
    "meta": [],
    "description": {
      "rendered": ""
    },
    "caption": {
      "rendered": ""
    },
    "alt_text": "A beautiful image",
    "media_type": "image",
    "mime_type": "image/jpeg",
    "media_details": {
      "width": 1920,
      "height": 1080,
      "file": "2023/01/image.jpg",
      "sizes": {
        "thumbnail": {
          "file": "image-150x150.jpg",
          "width": 150,
          "height": 150,
          "mime_type": "image/jpeg",
          "source_url": "https://example.com/wp-content/uploads/2023/01/image-150x150.jpg"
        },
        "medium": {
          "file": "image-300x169.jpg",
          "width": 300,
          "height": 169,
          "mime_type": "image/jpeg",
          "source_url": "https://