PocketBase MCP Server

$git clone https://github.com/Step-by-Step-technology/pocketbase-mcp.git && cd pocketbase-mcp && npm install && npm run build
README.md

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

  1. Create an MCP configuration file (~/.cline_desktop_config.json or 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"
      }
    }
  }
}
  1. Restart your MCP client (Cline Desktop, Cursor, etc.)

  2. 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 rules
pocketbase-delete-collectionGenerates a migration to delete a collection
pocketbase-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 collection
pocketbase-revert-migrationGenerates a migration to revert a previous migration
pocketbase-execute-any-migrationExecutes any type of migration (creation, modification, deletion) - now supports relation fields
pocketbase-execute-migrationExecutes a creation migration (original tool preserved)
pocketbase-list-migrationsLists all available migrations
pocketbase-view-migrationDisplays the content of a migration
pocketbase-list-collectionsLists all PocketBase collections
pocketbase-view-collectionDisplays collection details
pocketbase-fetch-recordFetches a specific record from a PocketBase collection
pocketbase-list-recordsLists all records from a collection with pagination
pocketbase-create-recordCreates a new record in a PocketBase collection
pocketbase-update-recordUpdates an existing record in a PocketBase collection
pocketbase-get-collection-schemaGets the schema (fields and types) of a collection
pocketbase-upload-fileUploads a file to a PocketBase collection
pocketbase-download-fileDownloads a file from a PocketBase collection

Environment 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 directory

Configuration

claude_desktop_config.json
{
  "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"
      }
    }
  }
}

Try it

Create a new PocketBase collection called 'posts' with fields for title, content, and a relation to 'users'.
List all the records in my 'products' collection and show me the schema.
Generate a migration to add a 'published_at' date field to the 'articles' collection.
Upload this image file to the 'avatar' field of the user record with ID '12345'.
Show me the content of the most recent migration file.

Frequently Asked Questions

What are the key features of PocketBase MCP Server?

Comprehensive migration management including creation, modification, and deletion of collections.. Full CRUD support for records including pagination and file uploads/downloads.. Support for complex field types including relation fields in migrations.. Schema inspection tools to view collection details and field types..

What can I use PocketBase MCP Server for?

Developers wanting to manage PocketBase schemas through natural language prompts in AI IDEs.. Automating database migrations as part of a development workflow using MCP-compatible clients.. Quickly inspecting and modifying PocketBase data without leaving the terminal or chat interface..

How do I install PocketBase MCP Server?

Install PocketBase MCP Server by running: git clone https://github.com/Step-by-Step-technology/pocketbase-mcp.git && cd pocketbase-mcp && npm install && npm run build

What MCP clients work with PocketBase MCP Server?

PocketBase MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use PocketBase MCP Server with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free