Create New User


Creates a new WordPress user account with the given username and email. Role defaults to "subscriber". If password is omitted, a random one is generated and, unless send_notification is false, the new user is emailed a "set your password" link. You may only grant a role whose capabilities you already hold.

Property Value
Ability slug mosmcp/create-user
Wire tool name mosmcp__create-user
Category Users & Roles (mosmcp-users)
Plan Free

 

Required access

Requirement Value
Capability create_users
Minimum default role Administrator
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
user_login string Yes — The new account's username (required).
user_email string Yes — The new account's email address (required).
first_name string — Optional first name.
last_name string — Optional last name.
role string subscriber Role slug to assign. Defaults to "subscriber". You may only grant a role whose capabilities you already hold.
password string — Optional explicit password. If omitted, a secure random password is generated.
send_notification boolean true Whether to email the new user their account/password-setup details. Defaults to true.

 

Output schema

Field Type Required
id integer
username string
email string
display_name string
first_name string
last_name string
nickname string
roles string[]
registered string
website_url string
biography string
locale string

 

Example

Sample prompt
Create a new author account for jane@example.com with the username 'janedoe'.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 175,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__create-user",
    "arguments": {
      "input": {
        "user_login": "janedoe",
        "user_email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Doe",
        "role": "author"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 175,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 57,
      "username": "janedoe",
      "email": "jane@example.com",
      "display_name": "janedoe",
      "first_name": "Jane",
      "last_name": "Doe",
      "nickname": "janedoe",
      "roles": [
        "author"
      ],
      "registered": "2026-09-29 08:15:42",
      "website_url": "",
      "biography": "",
      "locale": "en_US"
    }
  }
}

 

Edge cases / errors

  • user_login already taken → mosmcp_login_exists; user_email already in use → mosmcp_email_exists. Invalid username or email → mosmcp_invalid_login / mosmcp_invalid_email.
  • role not registered → mosmcp_invalid_role; a role carrying any capability the caller doesn't hold → mosmcp_cannot_grant_role (privilege-escalation guard).
  • password omitted → a random 20-character password is generated; the user is emailed a set-your-password link unless send_notification is false.
  • Not idempotent: repeating the call fails with mosmcp_login_exists rather than creating a duplicate.

 


<< Previous Next >>
Count Users by Role Delete User

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.