Skip to main content
Glama
mrwyndham

PocketBase MCP Server

backup_database

Create a backup of your PocketBase database to protect data and enable recovery. Specify a backup name to organize and identify your database snapshots.

Instructions

Create a backup of the PocketBase database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNobackup name

Implementation Reference

  • The handler function that executes the backup_database tool. It authenticates as admin using environment variables and calls PocketBase's backups.create with the provided name (default empty) and empty options, returning the result as text content.
    private async backupDatabase(args: any) { try { // Authenticate with PocketBase await this.pb.collection("_superusers").authWithPassword(process.env.POCKETBASE_ADMIN_EMAIL ?? '', process.env.POCKETBASE_ADMIN_PASSWORD ?? ''); // Create a new backup const backupResult = await this.pb.backups.create(args.name ?? '', {}); return { content: [ { type: 'text', text: JSON.stringify(backupResult, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to backup database: ${pocketbaseErrorMessage(error)}` ); } }
  • Input schema definition for the backup_database tool, specifying an object with an optional 'name' property of type string.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'backup name', }, }, },
  • src/index.ts:595-607 (registration)
    Registration of the backup_database tool in the tools list provided to the MCP server for ListTools requests.
    { name: 'backup_database', description: 'Create a backup of the PocketBase database', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'backup name', }, }, }, },
  • src/index.ts:689-690 (registration)
    Dispatch case in the CallTool request handler that routes calls to the backupDatabase method.
    case 'backup_database': return await this.backupDatabase(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