Skip to main content
Glama
Leonelberio

WordPress MCP Server

by Leonelberio

create_post

Generate and publish WordPress posts by specifying title, content, and status. Automate post creation through REST API integration with JSON-RPC 2.0 protocol.

Instructions

Create a new WordPress post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesPost content
passwordNoWordPress password (overrides WORDPRESS_PASSWORD env var)
siteUrlNoWordPress site URL (overrides WORDPRESS_SITE_URL env var)
statusNoPost status (draft, publish, etc.)draft
titleYesPost title
usernameNoWordPress username (overrides WORDPRESS_USERNAME env var)

Implementation Reference

  • The handler logic for the 'create_post' tool. It validates that title and content are provided, then uses axios to POST to the WordPress /posts endpoint with the provided title, content, and optional status (default 'draft'), returning the created post data.
    case 'create_post':
      if (!params.title || !params.content) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Title and content are required for creating a post'
        );
      }
      const createResponse = await client.post('/posts', {
        title: params.title,
        content: params.content,
        status: params.status || 'draft',
      });
      return createResponse.data;
  • Input schema for the 'create_post' tool, defining properties for siteUrl, username, password, title, content, status with required fields title and content.
    inputSchema: {
      type: 'object',
      properties: {
        siteUrl: {
          type: 'string',
          description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)',
        },
        username: {
          type: 'string',
          description: 'WordPress username (overrides WORDPRESS_USERNAME env var)',
        },
        password: {
          type: 'string',
          description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)',
        },
        title: {
          type: 'string',
          description: 'Post title',
        },
        content: {
          type: 'string',
          description: 'Post content',
        },
        status: {
          type: 'string',
          description: 'Post status (draft, publish, etc.)',
          default: 'draft',
        },
      },
      required: ['title', 'content'],
    },
  • src/index.ts:60-94 (registration)
    Registration of the 'create_post' tool in the ListToolsRequestSchema handler response, including name, description, and full input schema.
    {
      name: 'create_post',
      description: 'Create a new WordPress post',
      inputSchema: {
        type: 'object',
        properties: {
          siteUrl: {
            type: 'string',
            description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)',
          },
          username: {
            type: 'string',
            description: 'WordPress username (overrides WORDPRESS_USERNAME env var)',
          },
          password: {
            type: 'string',
            description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)',
          },
          title: {
            type: 'string',
            description: 'Post title',
          },
          content: {
            type: 'string',
            description: 'Post content',
          },
          status: {
            type: 'string',
            description: 'Post status (draft, publish, etc.)',
            default: 'draft',
          },
        },
        required: ['title', 'content'],
      },
    },
Install Server

Other Tools

Related Tools

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/Leonelberio/the-wordpress-mcp-server'

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