pocketbase-mcp-bridge

v1.0.0
pocketbase-mcp-bridge Checked 2 days ago Published 4 months ago

Complete Model Context Protocol (MCP) server for PocketBase — collections, records, auth, files, logs, settings, backups, crons and more.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

health_check Health check

Check the PocketBase API health status. Does not require authentication. Returns the server code, message and health data.

auth_info Authentication info

Return information about the current MCP authentication: PocketBase URL, the auth collection used, whether the token is valid, and the identity (id/email) of the authenticated superuser or user. The raw token is never exposed.

list_collections List collections

List collections (database tables / schemas) with pagination, filtering and sorting. Includes system collections such as _superusers, _authOrigins, etc. Filter example: 'type = "auth"'. Sort example: '-created'.

ParameterTypeDescription
fieldsstringComma-separated list of fields to return.
filterstringPocketBase filter expression, e.g. 'type = "base"'.
pageintegerPage number (default 1).
perPageintegerItems per page (default 100).
sortstringSort expression, e.g. '-created,name'.

get_collection Get collection

Fetch a single collection by its id or name, including its full field schema, rules and indexes.

ParameterTypeDescription
idOrName *stringCollection id or name.
fieldsstringComma-separated list of fields to return.

get_collection_scaffolds Get collection scaffolds

Return default collection templates (scaffolds) for each collection type (base, auth, view). Useful as a starting point before calling create_collection — copy a scaffold, adjust the name and fields, then create it.

create_collection Create collection

Create a new collection. Provide `name` and `type` ('base', 'auth' or 'view'). Use `data` for the rest of the collection payload: `fields` (array of field definitions), API rules (listRule, viewRule, createRule, updateRule, deleteRule — string or null), `indexes` (array of CREATE INDEX statements), `viewQuery` (for view collections), and auth options for auth collections. Tip: call get_collection_scaffolds first to see the expected shape. Example field: { "name": "title", "type": "text", "required": true }. IMPORTANT (PocketBase 0.23+): 'created'/'updated' timestamps are NOT added automatica…

ParameterTypeDescription
name *stringCollection name.
dataobjectRest of the collection payload (fields, rules, indexes, viewQuery, auth options...).
typestringCollection type (default 'base').

update_collection Update collection

Update an existing collection by id or name. Provide the fields to change in `data`. To modify the schema, pass the full `fields` array (existing field ids must be preserved to keep data). You can also update rules, indexes and options.

ParameterTypeDescription
data *objectPartial collection payload with the properties to update.
idOrName *stringCollection id or name.

delete_collection Delete collection

Permanently delete a collection and ALL of its records. This cannot be undone.

ParameterTypeDescription
idOrName *stringCollection id or name to delete.

import_collections Import collections

Bulk import collections from an array of collection definitions (as exported from the PocketBase admin UI). When `deleteMissing` is true, collections not present in the import list are deleted — use with caution. This is the recommended way to apply a full schema in one call.

ParameterTypeDescription
collections *arrayArray of collection definition objects.
deleteMissingbooleanIf true, delete collections not present in the list (default false).

truncate_collection Truncate collection

Delete ALL records of a collection while keeping the collection/schema itself. Cannot be undone.

ParameterTypeDescription
idOrName *stringCollection id or name to truncate.

list_records List records

List records of a collection with pagination, filtering, sorting and relation expansion. Filter supports operators like =, !=, >, <, ~ (contains), and functions. Example filter: 'status = "active" && created > "2024-01-01"'. Use `expand` to inline related records (e.g. 'author,comments_via_post'). Set `skipTotal` to true for faster queries when you don't need the total count.

ParameterTypeDescription
collection *stringCollection id or name.
expandstringComma-separated relations to expand.
fieldsstringComma-separated fields to return (supports :excerpt modifiers).
filterstringPocketBase filter expression.
pageintegerPage number (default 1).
perPageintegerItems per page (default 30).
skipTotalbooleanSkip counting total items for performance.
sortstringSort expression, e.g. '-created,title'.

get_full_record_list Get full record list

Fetch ALL records matching a filter, auto-paginating in batches. Use for exports or small/medium collections. Prefer list_records with pagination for large datasets to avoid huge responses.

ParameterTypeDescription
collection *stringCollection id or name.
batchintegerRecords per underlying request (default 200).
expandstringComma-separated relations to expand.
fieldsstringComma-separated fields to return.
filterstringPocketBase filter expression.
sortstringSort expression.

get_record Get record

Fetch a single record by id, optionally expanding relations and selecting specific fields.

ParameterTypeDescription
collection *stringCollection id or name.
id *stringRecord id.
expandstringComma-separated relations to expand.
fieldsstringComma-separated fields to return.

get_first_record Get first matching record

Return the first record matching a filter expression (throws if none found). Convenient for lookups like 'email = "a@b.com"'.

ParameterTypeDescription
collection *stringCollection id or name.
filter *stringPocketBase filter expression to match.
expandstringComma-separated relations to expand.
fieldsstringComma-separated fields to return.

create_record Create record

Create a new record in a collection. Pass field values in `data`. For auth collections, include 'password' and 'passwordConfirm' (and usually 'email'). To upload files, list them in `files` (each maps a field name to a local file path). Relation fields accept a record id or an array of ids.

ParameterTypeDescription
collection *stringCollection id or name.
dataobjectField values for the new record.
expandstringComma-separated relations to expand in the response.
fieldsstringComma-separated fields to return.
filesarrayOptional list of local files to upload into file fields.

update_record Update record

Update an existing record by id. Only the fields present in `data` are changed. To append to a multi-relation/file/select field use the '+' modifier as a key (e.g. { "tags+": "id" }); to remove use 'field-'. Upload files via `files`.

ParameterTypeDescription
collection *stringCollection id or name.
id *stringRecord id to update.
dataobjectField values to update.
expandstringComma-separated relations to expand in the response.
fieldsstringComma-separated fields to return.
filesarrayOptional list of local files to upload into file fields.

delete_record Delete record

Permanently delete a single record by id. Cannot be undone.

ParameterTypeDescription
collection *stringCollection id or name.
id *stringRecord id to delete.

batch Batch operations (transactional)

Execute multiple record operations in a single transactional request. All operations succeed or all are rolled back. Each operation has an `action` ('create' | 'update' | 'delete' | 'upsert'), a target `collection`, and depending on the action a `data` object and/or record `id`. For 'upsert', include the record 'id' inside `data` (creates if missing, updates if present). Note: the Batch API must be enabled in PocketBase settings (Settings > Batch API).

ParameterTypeDescription
operations *arrayList of operations to run atomically.

auth_with_password Authenticate a user (password)

Authenticate an end user against an auth collection with their identity (email/username) and password. Returns the auth token and the user record. Does not affect the MCP's own superuser session. Useful to obtain a token to act on behalf of a user or to verify credentials.

ParameterTypeDescription
identity *stringEmail or username.
password *stringUser password.
collectionstringAuth collection (default 'users').
expandstringComma-separated relations to expand on the record.

list_auth_methods List auth methods

List the available authentication methods for an auth collection: whether password/OTP auth is enabled and the configured OAuth2 providers (Google, GitHub, etc.).

ParameterTypeDescription
collectionstringAuth collection (default 'users').

impersonate Impersonate a user

Generate an auth token for an existing user without their password (superuser only). Returns a non-refreshable token valid for the given duration, useful to make API calls on behalf of a user.

ParameterTypeDescription
recordId *stringId of the user record to impersonate.
collectionstringAuth collection (default 'users').
durationintegerToken lifetime in seconds (default: collection auth token duration).

request_verification Request email verification

Send a verification email to a user of an auth collection (requires SMTP configured).

ParameterTypeDescription
email *stringUser email address.
collectionstringAuth collection (default 'users').

confirm_verification Confirm email verification

Confirm a user's email verification using the token from the verification email.

ParameterTypeDescription
token *stringVerification token.
collectionstringAuth collection (default 'users').

request_password_reset Request password reset

Send a password reset email to a user (requires SMTP configured).

ParameterTypeDescription
email *stringUser email address.
collectionstringAuth collection (default 'users').

confirm_password_reset Confirm password reset

Set a new password using the reset token from the password reset email.

ParameterTypeDescription
password *stringNew password.
passwordConfirm *stringNew password confirmation (must match).
token *stringPassword reset token.
collectionstringAuth collection (default 'users').

request_otp Request OTP (one-time password)

Send a one-time password email to a user and return the otpId needed to complete auth_with_otp (requires SMTP and OTP auth enabled on the collection).

ParameterTypeDescription
email *stringUser email address.
collectionstringAuth collection (default 'users').

auth_with_otp Authenticate with OTP

Complete OTP authentication using the otpId (from request_otp) and the code the user received.

ParameterTypeDescription
code *stringThe one-time code received by the user.
otpId *stringThe otpId returned by request_otp.
collectionstringAuth collection (default 'users').

confirm_email_change Confirm email change

Confirm a user's email change using the token from the confirmation email and the user's password.

ParameterTypeDescription
password *stringThe user's current password.
token *stringEmail change token.
collectionstringAuth collection (default 'users').

list_external_auths List external auth providers

List the OAuth2 providers linked to a specific user record (superuser only).

ParameterTypeDescription
recordId *stringUser record id.
collectionstringAuth collection (default 'users').

list_superusers List superusers

List superuser (admin) accounts from the built-in _superusers collection.

ParameterTypeDescription
filterstringFilter expression, e.g. 'email ~ "@example.com"'.
pageintegerPage number (default 1).
perPageintegerItems per page (default 100).
sortstringSort expression, e.g. '-created'.

create_superuser Create superuser

Create a new superuser (admin) account. Provide email and password. The new superuser has full administrative access to the instance.

ParameterTypeDescription
email *stringSuperuser email.
password *stringSuperuser password (min 8 chars).
passwordConfirmstringPassword confirmation (defaults to password).

update_superuser Update superuser

Update a superuser account (e.g. change email or reset the password). To change the password, include both 'password' and 'passwordConfirm' in `data`.

ParameterTypeDescription
data *objectFields to update (email, password, passwordConfirm, ...).
id *stringSuperuser record id.

delete_superuser Delete superuser

Delete a superuser (admin) account by id. At least one superuser must always remain.

ParameterTypeDescription
id *stringSuperuser record id to delete.

get_file_url Get file URL

Build the public URL for a file stored in a record's file field. For image files you may request a thumbnail via `thumb` (e.g. '100x100', '100x100t', '0x100'). For protected files (collection with a non-public file field), set `protected` to true to embed a short-lived access token.

ParameterTypeDescription
collection *stringCollection id or name.
filename *stringStored file name (the value of the file field).
recordId *stringRecord id.
downloadbooleanForce a download (Content-Disposition attachment).
protectedbooleanEmbed a file access token for protected files.
thumbstringThumbnail size, e.g. '100x100', '0x100', '100x100t'.

get_file_token Get file access token

Generate a short-lived file access token used to access protected files by appending it as a `?token=...` query parameter to a file URL.

download_file Download file

Download a record file to a local path on the machine running this MCP server. Handles protected files automatically by requesting an access token.

ParameterTypeDescription
collection *stringCollection id or name.
destPath *stringLocal filesystem path to write the downloaded file to.
filename *stringStored file name.
recordId *stringRecord id.
protectedbooleanSet true for protected files (embeds a token).
thumbstringOptional thumbnail size for images.

list_logs List logs

List application request/activity logs with pagination, filtering and sorting (superuser only). Filter example: 'level >= 4 && data.status >= 400'. Sort defaults to newest first.

ParameterTypeDescription
filterstringFilter expression over log fields (level, message, data.*).
pageintegerPage number (default 1).
perPageintegerItems per page (default 50).
sortstringSort expression (default '-created').

get_log Get log

Fetch a single log entry by its id (superuser only).

ParameterTypeDescription
id *stringLog entry id.

get_logs_stats Get logs statistics

Return hourly aggregated log statistics, optionally filtered. Useful to chart request volume or error rates. Filter example: 'level = 0'.

ParameterTypeDescription
filterstringFilter expression to scope the statistics.

get_settings Get settings

Fetch all instance settings (app name/url, SMTP, S3 storage, S3 backups, batch API, rate limits, trusted proxy, OAuth2 secrets are redacted). Superuser only.

update_settings Update settings

Bulk update instance settings. Provide only the sections you want to change in `data`. Examples: { "meta": { "appName": "My App", "appURL": "https://example.com" } }, { "smtp": { "enabled": true, "host": "smtp.example.com", "port": 587, "username": "...", "password": "..." } }, { "batch": { "enabled": true, "maxRequests": 50 } }. Superuser only.

ParameterTypeDescription
data *objectPartial settings object with the sections to update.

test_s3 Test S3 connection

Perform an S3 filesystem connection test for either 'storage' or 'backups'. Superuser only.

ParameterTypeDescription
filesystemstringWhich S3 filesystem to test (default 'storage').

test_email Send a test email

Send a test email to verify SMTP configuration. Choose a template: 'verification', 'password-reset' or 'email-change'. Superuser only. Requires SMTP to be configured.

ParameterTypeDescription
toEmail *stringRecipient email address.
collectionstringAuth collection to use for the template (default 'users').
templatestringEmail template to test (default 'verification').

generate_apple_client_secret Generate Apple client secret

Generate a new Apple OAuth2 client secret (JWT) from your Apple developer credentials. Superuser only.

ParameterTypeDescription
clientId *stringApple Services ID (client id).
duration *integerSecret validity duration in seconds (max ~15777000).
keyId *stringApple private key id.
privateKey *stringApple private key contents (PEM).
teamId *stringApple Developer Team ID.

list_backups List backups

List all available backup files (key, size, modified date). Superuser only.

create_backup Create backup

Create a new backup (zip snapshot of the database and storage). If `basename` is omitted, PocketBase auto-generates a timestamped name. Returns the backup name. Superuser only.

ParameterTypeDescription
basenamestringOptional backup file name, e.g. 'pb_backup_2024.zip' (auto-generated if omitted).

upload_backup Upload backup

Upload an existing local backup zip file into the instance's backups. Superuser only.

ParameterTypeDescription
path *stringLocal filesystem path to the backup .zip file to upload.

delete_backup Delete backup

Delete a single backup file by its key/name. Cannot be undone. Superuser only.

ParameterTypeDescription
key *stringBackup file key/name (as returned by list_backups).

restore_backup Restore backup

Restore the instance from an existing backup file. THIS OVERWRITES ALL CURRENT DATA and restarts the application. Use with extreme caution. Superuser only.

ParameterTypeDescription
key *stringBackup file key/name to restore from.

get_backup_download_url Get backup download URL

Build a download URL for a backup file using a fresh superuser file token. Superuser only.

ParameterTypeDescription
key *stringBackup file key/name.

download_backup Download backup

Download a backup file to a local path on the machine running this MCP server. Superuser only.

ParameterTypeDescription
destPath *stringLocal filesystem path to write the .zip to.
key *stringBackup file key/name to download.

list_crons List cron jobs

List all registered cron jobs with their id and cron expression (e.g. the automatic backups job, log/token cleanup, plus any custom jobs registered via hooks). Superuser only.

run_cron Run cron job

Manually trigger a registered cron job by its id (as returned by list_crons). Superuser only.

ParameterTypeDescription
jobId *stringThe cron job id to run.

send_raw_request Send raw API request

Escape hatch: send an arbitrary authenticated HTTP request to any PocketBase API endpoint. Use this for endpoints not covered by a dedicated tool, custom routes added via hooks, or new API features. The Authorization header (superuser token) is attached automatically. `path` is relative to the server root and must start with '/api/...' (e.g. '/api/collections'). Returns the parsed JSON response.

ParameterTypeDescription
path *stringRequest path, e.g. '/api/health' or '/api/collections/posts/records'.
bodyobjectJSON request body for POST/PATCH/PUT.
headersobjectExtra request headers.
methodstringHTTP method (default GET).
queryobjectQuery parameters as a key/value object.