Manage PocketBase database schemas and migrations via REST API.
🚀 PocketBase MCP Server
A complete MCP (Model Context Protocol) server for managing PocketBase migrations via REST API. Generates and executes migrations to create, modify, and delete PocketBase collections.
📥 Installation from GitHub
Clone and install
# Clone the repository
git clone https://github.com/Step-by-Step-technology/pocketbase-mcp.git
cd pocketbase-mcp
# Install dependencies
npm install
# Compile TypeScript
npm run build
Quick setup
- Create an MCP configuration file (
~/.cline_desktop_config.jsonor equivalent):
{
"mcpServers": {
"pocketbase-mcp": {
"command": "node",
"args": ["/absolute/path/to/pocketbase-mcp/dist/index.js"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_TOKEN": "your_pocketbase_admin_token",
"POCKETBASE_MIGRATIONS_DIR": "/absolute/path/to/pb_migrations"
}
}
}
}
Restart your MCP client (Cline Desktop, Cursor, etc.)
Test the installation:
# Start the server in development mode npm run dev
📦 Global installation (optional)
# Install globally (if you want to use it as CLI)
npm install -g .
# Then run
pocketbase-mcp
GitHub Repository: https://github.com/Step-by-Step-technology/pocketbase-mcp
✨ Features
✅ Available Tools (20 complete tools)
🏗️ Migration Tools (13 tools)
| Tool | Description | Status |
|---|---|---|
pocketbase-create-collection-migration |
Generates a migration to create a new collection (supports relation fields) | ✅ Works perfectly |
pocketbase-update-collection |
Generates a migration to modify collection rules | ✅ New |
pocketbase-delete-collection |
Generates a migration to delete a collection | ✅ New |
pocketbase-update-collection-fields |
Generates a migration to modify collection fields (supports relation fields) | ✅ New |
pocketbase-add-field-migration |
Generates a migration to add a single field to a collection (supports relation fields) | ✅ NEW |
pocketbase-remove-field-migration |
Generates a migration to remove a single field from a collection | ✅ NEW |
pocketbase-revert-migration |
Generates a migration to revert a previous migration | ✅ NEW |
pocketbase-execute-any-migration |
Executes any type of migration (creation, modification, deletion) - now supports relation fields | ✅ Improved |
pocketbase-execute-migration |
Executes a creation migration (original tool preserved) | ✅ Works perfectly |
pocketbase-list-migrations |
Lists all available migrations | ✅ Existing |
pocketbase-view-migration |
Displays the content of a migration | ✅ Existing |
pocketbase-list-collections |
Lists all PocketBase collections | ✅ Existing |
pocketbase-view-collection |
Displays collection details | ✅ Existing |
📊 CRUD Tools (7 tools)
| Tool | Description | Status |
|---|---|---|
pocketbase-fetch-record |
Fetches a specific record from a PocketBase collection | ✅ NEW |
pocketbase-list-records |
Lists all records from a collection with pagination | ✅ NEW |
pocketbase-create-record |
Creates a new record in a PocketBase collection | ✅ NEW |
pocketbase-update-record |
Updates an existing record in a PocketBase collection | ✅ NEW |
pocketbase-get-collection-schema |
Gets the schema (fields and types) of a collection | ✅ NEW |
pocketbase-upload-file |
Uploads a file to a PocketBase collection | ✅ NEW |
pocketbase-download-file |
Downloads a file from a PocketBase collection | ✅ NEW |
Total: 20 complete MCP tools - Migration + CRUD + File management
🚀 Installation (Alternative)
If you have already cloned the project locally or are working on an existing version:
Prerequisites
- Node.js 18+
- PocketBase running
- PocketBase admin token
Local installation
# Move to the pocketbase-mcp folder
cd pocketbase-mcp
# Install dependencies
npm install
# Compile TypeScript
npm run build
Note: For a complete installation from GitHub, refer to the 📥 Installation from GitHub section above.
Configuration
Environment variables are configured in the MCP configuration file (cline_mcp_settings.json):
{
"mcpServers": {
"pocketbase-mcp": {
"command": "node",
"args": ["/absolute/path/pocketbase-mcp/dist/index.js"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_TOKEN": "your_pocketbase_admin_token",
"POCKETBASE_MIGRATIONS_DIR": "/absolute/path/pb_migrations"
}
}
}
}
Required variables:
POCKETBASE_URL: URL of your PocketBase instance (e.g.,http://127.0.0.1:8090)POCKETBASE_TOKEN: PocketBase admin token (obtained via admin interface)POCKETBASE_MIGRATIONS_DIR: Absolute path to the migrations directory
📦 Project Structure
pocketbase
Tools (20)
pocketbase-create-collection-migrationGenerates a migration to create a new collection (supports relation fields)pocketbase-update-collectionGenerates a migration to modify collection rulespocketbase-delete-collectionGenerates a migration to delete a collectionpocketbase-update-collection-fieldsGenerates a migration to modify collection fields (supports relation fields)pocketbase-add-field-migrationGenerates a migration to add a single field to a collection (supports relation fields)pocketbase-remove-field-migrationGenerates a migration to remove a single field from a collectionpocketbase-revert-migrationGenerates a migration to revert a previous migrationpocketbase-execute-any-migrationExecutes any type of migration (creation, modification, deletion) - now supports relation fieldspocketbase-execute-migrationExecutes a creation migration (original tool preserved)pocketbase-list-migrationsLists all available migrationspocketbase-view-migrationDisplays the content of a migrationpocketbase-list-collectionsLists all PocketBase collectionspocketbase-view-collectionDisplays collection detailspocketbase-fetch-recordFetches a specific record from a PocketBase collectionpocketbase-list-recordsLists all records from a collection with paginationpocketbase-create-recordCreates a new record in a PocketBase collectionpocketbase-update-recordUpdates an existing record in a PocketBase collectionpocketbase-get-collection-schemaGets the schema (fields and types) of a collectionpocketbase-upload-fileUploads a file to a PocketBase collectionpocketbase-download-fileDownloads a file from a PocketBase collectionEnvironment Variables
POCKETBASE_URLrequiredURL of your PocketBase instance (e.g., http://127.0.0.1:8090)POCKETBASE_TOKENrequiredPocketBase admin token (obtained via admin interface)POCKETBASE_MIGRATIONS_DIRrequiredAbsolute path to the migrations directoryConfiguration
{
"mcpServers": {
"pocketbase-mcp": {
"command": "node",
"args": ["/absolute/path/to/pocketbase-mcp/dist/index.js"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_TOKEN": "your_pocketbase_admin_token",
"POCKETBASE_MIGRATIONS_DIR": "/absolute/path/to/pb_migrations"
}
}
}
}