PocketBase MCP Server
The PocketBase MCP Server enables AI assistants to comprehensively manage PocketBase backends through 23 tools covering database operations, authentication, file handling, and developer utilities.
Collection Management: Create, delete, update, list, and migrate collections with full schema configuration including fields, indexes, and access control rules. Truncate collections to preserve structure while removing data.
Record Operations: Perform CRUD operations with advanced filtering, sorting, pagination, field expansion, and data analysis capabilities. Execute complex queries with aggregation support.
Authentication & User Management: Authenticate as admin or user with email/password, create accounts with email verification, check auth status, manage auth collections, and configure auto-refresh tokens.
File Operations: Upload files from content or URLs, download files from record fields, and manage file field types in collections.
Access Control: Configure API rules for collections (list, view, create, update, delete) with rule-based permissions for fine-grained access control.
Data Management: Create backups in JSON/CSV formats, import data with create/update/upsert modes, perform batch operations, and transform data during migrations.
Index Management: Create, delete, and list database indexes for performance optimization.
Developer Tools: Generate TypeScript interfaces from PocketBase collections and vice versa, with support for relation types and configurable timestamps.
Server Utilities: Check server health, access field schema documentation, and reference API rules syntax.
Provides integration with PocketBase databases, offering tools for collection management, record operations, schema generation, authentication, and data analysis. Enables bidirectional conversion between TypeScript interfaces and PocketBase schemas.
Supports bidirectional conversion between TypeScript interfaces and PocketBase schemas, allowing users to generate TypeScript interfaces from PocketBase collections and create collections from TypeScript definitions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PocketBase MCP Server list all collections in my database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dynamic-pocketbase-mcp
Dynamic Model Context Protocol (MCP) server for PocketBase. Connect your AI client once, then manage collections and records in any PocketBase project using runtime tools.
Why this server is different
Many PocketBase MCP servers are static: they hardcode collection-specific behavior or require custom tool definitions per schema.
dynamic-pocketbase-mcp is dynamic:
Uses collection-agnostic tools (
list_collections,list_records,create_record, etc.)Works across existing and newly created collections without regenerating server code
Exposes live PocketBase collections as MCP resources
Related MCP server: PocketBase MCP Server
Features
20 MCP tools for health, auth, collections, rules, and records
Collection lifecycle operations (create, update, delete, inspect)
Record CRUD with filters, sorting, pagination, and field selection
Superuser auth from environment variables with automatic token refresh, or session auth via tools (
auth_admin,auth_user,get_auth_status,logout)Transactional multi-record writes with
batch_recordsBuilt-in references for field schema, schema patch examples, and rules syntax
Installation
npm install dynamic-pocketbase-mcp
# or
bun install dynamic-pocketbase-mcpConfigure in an AI client
Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"dynamic-pocketbase": {
"command": "npx",
"args": ["-y", "dynamic-pocketbase-mcp"]
}
}
}If POCKETBASE_URL is not set, the server defaults to http://localhost:8090.
To keep superuser credentials out of the chat, pass them as environment variables instead of using auth_admin:
{
"mcpServers": {
"dynamic-pocketbase": {
"command": "npx",
"args": ["-y", "dynamic-pocketbase-mcp"],
"env": {
"POCKETBASE_URL": "https://pb.example.com",
"POCKETBASE_ADMIN_EMAIL": "admin@example.com",
"POCKETBASE_ADMIN_PASSWORD": "your-password"
}
}
}
}Direct usage
# Use default URL (http://localhost:8090)
npx -y dynamic-pocketbase-mcp
# Use custom PocketBase URL
POCKETBASE_URL=https://pb.example.com \
bunx dynamic-pocketbase-mcpSimple tutorial: chat with AI using this MCP
After you configure your MCP client, open a chat and try prompts like this:
"Set PocketBase URL to
https://pb.example.com.""Check my PocketBase server health."
"List all PocketBase collections."
"Authenticate as admin with email
<your-email>and password<your-password>.""Create a collection named
noteswith a requiredtitletext field.""Create a record in
noteswith titleFirst note.""Show all records in
notes, newest first.""Log out from PocketBase auth session."
If those steps succeed, your AI can now manage schema and data through this MCP server.
Authentication
Environment (recommended for superusers). Set POCKETBASE_ADMIN_EMAIL and POCKETBASE_ADMIN_PASSWORD. The server logs in on the first request and logs in again shortly before the token expires. You can also set POCKETBASE_TOKEN (for example a long-lived superuser API token). It is used as is, and if credentials are also set, they take over when it expires. Superusers with MFA/OTP enabled cannot use password login.
Automatic login stops as soon as you call auth_admin, auth_user, logout, or set_base_url. This means the credentials are never sent to a different server URL. get_auth_status reports autoAuth: true while it is active.
Tools. auth_admin or auth_user, then get_auth_status, then logout.
Available tools
Health and references
health- Check PocketBase server health statusset_base_url- Update PocketBase URL for current MCP session and clear auth tokenget_field_schema_reference- Get field types documentation plus create/update schema examplesget_rules_reference- Get API rules syntax reference
Authentication
auth_admin- Authenticate as admin/superuserauth_user- Authenticate as auth collection user (email/username)get_auth_status- Check current authentication statuslogout- Clear authentication session
Collections
list_collections- List all collectionsview_collection- View collection by name or IDcreate_collection- Create new collection (auto-addscreatedandupdatedautodate fields for base/auth collections unless provided)update_collection- Update collection schema/settings (partial object updates allowed; usefieldUpdates/removeFieldsfor MCP-side schema merging,newNameinsidefieldUpdatesto rename a field without losing data, orfieldsfor direct full-array replacement; seeget_field_schema_referenceexamples)delete_collection- Delete collectionupdate_collection_rules- Update access control rules
Records
list_records- List/search records with filtering, sorting, pagination (skipTotalfor faster queries on large collections)view_record- View single record by IDcreate_record- Create new recordupdate_record- Update existing recorddelete_record- Delete recordbatch_records- Create/update/upsert/delete multiple records in one transaction (requires Batch API enabled in PocketBase settings)
Development
# Install dependencies
bun install
# Run in development mode
bun run dev
# Type check
bun run typecheck
# Run tests (builds dist first)
bun run test
# Run live integration test against a real PocketBase instance.
# This uses @fadlee/pocketbase-bin to provision PocketBase automatically.
bun run test:live
# Run all checks (typecheck + tests)
bun run check
# Interactive release helper (bump, check, publish, push tag)
bun run release
# Build for production
bun run buildEnvironment variables
Variable | Required | Description |
| No | PocketBase server URL (default: |
| No | Superuser email for automatic login (set together with password) |
| No | Superuser password for automatic login |
| No | Pre-issued auth token sent with every request |
Additional live-test environment variables:
Variable | Required | Description |
| No | Admin email for live test bootstrap (default: |
| No | Admin password for live test bootstrap (default: |
License
MIT
Available Tools
22 toolsanalyze_collection_dataC
Analyze data patterns and provide insights about a collection
Inputs: collection (required), options.
authenticate_userC
Authenticate a user and get auth token
Inputs: email (required), password (required), autoRefreshThreshold, collection.
backup_databaseC
Create a backup of the PocketBase database
Inputs: format.
create_collectionC
Create a new collection in PocketBase
Inputs: fields (required), name (required), createRule, deleteRule, +7 more.
create_recordC
Create a new record in a collection
Inputs: collection (required), data (required), expand, fields.
create_userC
Create a new user account
Inputs: email (required), password (required), passwordConfirm (required), additionalData, +3 more.
delete_collectionB
Delete a collection from PocketBase
Inputs: collection (required).
delete_recordC
Delete a record
Inputs: collection (required), id (required).
download_fileC
Download a file from a record in PocketBase
Inputs: collection (required), fileField (required), recordId (required).
generate_pb_schemaB
Generate a PocketBase schema based on TypeScript interfaces or database diagram
Inputs: sourceCode (required), options.
generate_typescript_interfacesB
Generate TypeScript interfaces from PocketBase collections
Inputs: collections, options.
get_collection_schemaC
Get schema details for a collection
Inputs: collection (required).
import_dataC
Import data into a collection
Inputs: collection (required), data (required), mode.
list_collectionsC
List all collections with optional sorting
Inputs: sort.
list_recordsC
List records from a collection with optional filters
Inputs: collection (required), expand, fields, filter, +4 more.
manage_indexesC
Manage collection indexes
Inputs: action (required), collection (required), index.
migrate_collectionC
Add, remove, or modify fields from a collection
Inputs: collection (required), fields (required), createRule, dataTransforms, +5 more.
query_collectionC
Advanced query with filtering, sorting, and aggregation
Inputs: collection (required), aggregate, expand, filter, +1 more.
truncate_collectionB
Delete all records associated with the specified collection
Inputs: collection (required).
update_recordC
Update an existing record
Inputs: collection (required), data (required), id (required), expand, +1 more.
upload_fileB
Upload a file to a record in PocketBase
Inputs: collection (required), fileContent (required), fileField (required), fileName (required), +1 more.
upload_file_from_urlC
Upload a file from URL to a record in PocketBase
Inputs: collection (required), fileField (required), recordId (required), url (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Most tools have distinct purposes targeting specific resources and actions, but some potential confusion exists: 'list_records' and 'query_collection' both retrieve records, though 'query_collection' offers advanced features; 'upload_file' and 'upload_file_from_url' are closely related but differentiated by source. Overall, descriptions help clarify boundaries, but minor overlaps could cause occasional misselection.
Tool names follow a highly consistent verb_noun pattern throughout, such as 'create_collection', 'delete_record', and 'list_records'. All tools use snake_case with clear, descriptive verbs aligned with their actions, making the set predictable and easy to navigate without any deviations in style.
With 22 tools, the count is slightly high for a typical MCP server scope, but it is reasonable given the comprehensive coverage of PocketBase operations. It includes CRUD, schema management, data handling, and utilities, which justifies the number, though it might feel heavy compared to more focused servers.
The tool set provides complete coverage for PocketBase operations, including full CRUD for collections and records, user authentication, schema management, data import/export, file handling, and utilities like backup and analysis. There are no obvious gaps, ensuring agents can handle all core workflows without dead ends.
Maintenance
Related MCP Connectors
Hosted MCP server for AI-driven data ops. Create apps, manage schemas, and CRUD structured data.
MCP server for interacting with the Supabase platform
Agent-native backend: Postgres, auth, storage, functions, hosting and deploy, over MCP
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Related MCP Servers
- AlicenseDqualityNot gradedmaintenanceA comprehensive MCP server that provides sophisticated tools for interacting with PocketBase databases. This server enables advanced database operations, schema management, and data manipulation through the Model Context Protocol (MCP).14164 npm70MIT
- AlicenseAqualityCmaintenanceMCP server that allows interaction with PocketBase databases, enabling record operations (fetch, list, create, update), file management, and schema migrations through natural language.2243MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants and MCP clients to interact with PocketBase databases for authentication, data management, and administrative operations.65MIT
- AlicenseNot gradedqualityAmaintenanceEnables creating and managing collections, performing record CRUD operations with pagination and expansions, handling user authentication, and backing up PocketBase databases through MCP tools.18 npmISC