Skip to main content
Glama
mrwyndham

PocketBase MCP Server

create_user

Create new user accounts in PocketBase databases by providing email, password, and user details for authentication setup.

Instructions

Create a new user account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesUser email
passwordYesUser password
passwordConfirmYesPassword confirmation
nameNoUser name
collectionNoCollection name (default: users)users

Implementation Reference

  • The handler function that executes the create_user tool. It creates a new user in the specified PocketBase collection using the pb.collection().create() method with the provided arguments.
    private async createUser(args: any) {
      try {
        const collection = args.collection || 'users';
        const result = await this.pb.collection(collection).create({
          email: args.email,
          password: args.password,
          passwordConfirm: args.passwordConfirm,
          name: args.name,
        });
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to create user: ${pocketbaseErrorMessage(error)}`
        );
      }
    }
  • Input schema definition for the create_user tool, specifying properties and required fields.
    inputSchema: {
      type: 'object',
      properties: {
        email: {
          type: 'string',
          description: 'User email',
        },
        password: {
          type: 'string',
          description: 'User password',
        },
        passwordConfirm: {
          type: 'string',
          description: 'Password confirmation',
        },
        name: {
          type: 'string',
          description: 'User name',
        },
        collection: {
          type: 'string',
          description: 'Collection name (default: users)',
          default: 'users'
        }
      },
      required: ['email', 'password', 'passwordConfirm'],
    },
  • src/index.ts:546-576 (registration)
    Tool registration in the ListTools response, including name, description, and reference to inputSchema.
    {
      name: 'create_user',
      description: 'Create a new user account',
      inputSchema: {
        type: 'object',
        properties: {
          email: {
            type: 'string',
            description: 'User email',
          },
          password: {
            type: 'string',
            description: 'User password',
          },
          passwordConfirm: {
            type: 'string',
            description: 'Password confirmation',
          },
          name: {
            type: 'string',
            description: 'User name',
          },
          collection: {
            type: 'string',
            description: 'Collection name (default: users)',
            default: 'users'
          }
        },
        required: ['email', 'password', 'passwordConfirm'],
      },
    },
  • src/index.ts:685-686 (registration)
    Dispatch/registration case in the CallToolRequest handler that routes to the createUser method.
    case 'create_user':
      return await this.createUser(request.params.arguments);

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/mrwyndham/pocketbase-mcp'

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