The PocketBase MCP Server provides a comprehensive set of tools for interacting with PocketBase databases through the Model Context Protocol (MCP), enabling sophisticated database operations, schema management, and data manipulation.
Collection Management: Create and manage collections with custom schemas, handle schema migrations with data preservation, and manage indexes
Record Operations: Perform CRUD operations, execute advanced queries with filtering/sorting/aggregation, and import data in various modes
User Management: Authenticate users via password, OAuth2, or OTP methods, manage accounts, handle sessions, and perform admin impersonation
Database Operations: Create backups, import/export data in JSON/CSV formats
Real-time Capabilities: Subscribe to collection or record changes and handle real-time events
Error Handling & Type Safety: Comprehensive error handling with TypeScript type safety
Allows comprehensive interaction with PocketBase databases including collection management, record operations, user management, and database operations such as backup/restore and data migration
Provides TypeScript definitions for all operations, ensuring type safety when using the tools
Advanced PocketBase MCP Server
A 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).
Changelog
v2.1.0 (April 3, 2025)
Added
Added
batch_update_records
tool for updating multiple records at once.Added
batch_delete_records
tool for deleting multiple records at once.Added
subscribe_to_collection
tool for real-time event subscriptions (requireseventsource
polyfill).
Fixed
Corrected schema for
authenticate_user
to allow admin authentication via environment variables without explicit email/password.Added
eventsource
dependency and polyfill to enable real-time subscriptions in Node.js.
v2.0.0 (April 2, 2025)
Added
Enhanced admin authentication support with environment variables
Added support for admin impersonation via the
impersonate_user
toolImproved error handling for authentication operations
Added comprehensive TypeScript type definitions for better development experience
Added support for Cline integration
Fixed
Fixed TypeScript errors in the PocketBase client implementation
Improved schema field handling with proper type annotations
Fixed issues with optional schema field properties
Changed
Updated the authentication flow to support multiple authentication methods
Improved documentation with more detailed examples
Enhanced environment variable configuration options
Features
Collection Management
Create and manage collections with custom schemas
Migrate collection schemas with data preservation
Advanced index management (create, delete, list)
Schema validation and type safety
Retrieve collection schemas and metadata
Record Operations
CRUD operations for records
Advanced querying with filtering, sorting, and aggregation
Batch import/export capabilities
Relationship expansion support
Pagination and cursor-based navigation
User Management
User authentication and token management
User account creation and management
Password management
Role-based access control
Session handling
Database Operations
Database backup and restore
Multiple export formats (JSON/CSV)
Data migration tools
Index optimization
Batch operations
Available Tools
Collection Management
create_collection
: Create a new collection with custom schemaget_collection_schema
: Get schema details for a collectionmigrate_collection
: Migrate collection schema with data preservationmanage_indexes
: Create, delete, or list collection indexes
Record Operations
create_record
: Create a new record in a collectionlist_records
: List records with optional filters and paginationupdate_record
: Update an existing recorddelete_record
: Delete a recordquery_collection
: Advanced query with filtering, sorting, and aggregationbatch_update_records
: Update multiple records in a single callbatch_delete_records
: Delete multiple records in a single callsubscribe_to_collection
: Subscribe to real-time changes in a collection (requireseventsource
package in Node.js environment)import_data
: Import data into a collection with create/update/upsert modes
User Management
authenticate_user
: Authenticate a user and get auth tokencreate_user
: Create a new user accountlist_auth_methods
: List all available authentication methodsauthenticate_with_oauth2
: Authenticate a user with OAuth2authenticate_with_otp
: Authenticate a user with one-time passwordauth_refresh
: Refresh authentication tokenrequest_verification
: Request email verificationconfirm_verification
: Confirm email verification with tokenrequest_password_reset
: Request password resetconfirm_password_reset
: Confirm password reset with tokenrequest_email_change
: Request email changeconfirm_email_change
: Confirm email change with tokenimpersonate_user
: Impersonate another user (admin only)
Database Operations
backup_database
: Create a backup of the PocketBase database with format optionsimport_data
: Import data with various modes (create/update/upsert)
Configuration
The server requires the following environment variables:
POCKETBASE_URL
: URL of your PocketBase instance (e.g., "http://127.0.0.1:8090")
Optional environment variables:
POCKETBASE_ADMIN_EMAIL
: Admin email for certain operationsPOCKETBASE_ADMIN_PASSWORD
: Admin passwordPOCKETBASE_DATA_DIR
: Custom data directory path
Usage Examples
Collection Management
Advanced Querying
Data Import/Export
Schema Migration
Batch & Real-time Operations
Authentication Methods
Error Handling
All tools include comprehensive error handling with detailed error messages. Errors are properly typed and include:
Invalid request errors
Authentication errors
Database operation errors
Schema validation errors
Network errors
Type Safety
The server includes TypeScript definitions for all operations, ensuring type safety when using the tools. Each tool's input schema is strictly typed and validated.
Best Practices
Always use proper error handling with try/catch blocks
Validate data before performing operations
Use appropriate indexes for better query performance
Regularly backup your database
Use migrations for schema changes
Follow security best practices for user management
Monitor and optimize database performance
Development
Clone the repository
Install dependencies:
npm install
Copy
.env.example
to.env
and configureBuild:
npm run build
Start your PocketBase instance
The MCP server will automatically connect to your PocketBase instance
Installing via Smithery
To install PocketBase Server for Claude Desktop automatically via Smithery:
Contributing
Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
A 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).
Related MCP Servers
- -securityAlicense-qualityA comprehensive server that enables advanced database operations with PocketBase, providing tools for collection management, record operations, user management, and database administration through the Model Context Protocol.Last updated -6MIT License
- AsecurityAlicenseAqualityProvides sophisticated tools for interacting with PocketBase databases, enabling advanced database operations, schema management, and data manipulation through the Model Context Protocol (MCP).Last updated -24676MIT License
- AsecurityAlicenseAqualityA comprehensive server that enables sophisticated interactions with PocketBase databases through Model Context Protocol, offering collection management, record operations, user management, and advanced database operations.Last updated -14654MIT License
- AsecurityAlicenseAqualityMCP server that allows interaction with PocketBase databases, enabling record operations (fetch, list, create, update), file management, and schema migrations through natural language.Last updated -2020MIT License