Skip to main content
Glama
PocketBase Dev MCP

PocketBase Dev MCP

by Fanom2813

PocketBase Dev MCP

An MCP (Model Context Protocol) server that generates PocketBase management scripts for development projects. Run multiple isolated PocketBase instances from a single binary—each project gets its own data directory, port, and auto-generated start/stop/status scripts.

Key Features:

  • 🚀 Single binary, multiple isolated instances

  • 📁 Per-project data directories and ports

  • 🛠️ Auto-generated shell scripts (start/stop/status)

  • 🔒 No background processes—scripts run in foreground with visible logs

  • ⚡ Built with Bun, distributed as single file

Overview

  • Single Binary, Multiple Instances: Uses one PocketBase binary to run multiple isolated instances

  • Per-Project Isolation: Each project gets its own data directory and port

  • Script Generation: Generates start/stop/status scripts for each project

  • User-Managed: Users save scripts to their projects and run them directly

Related MCP server: PocketBase Cloud MCP Server

Prerequisites

  1. Bun - Install from bun.sh

  2. PocketBase binary - Download from pocketbase.io and place in your PATH, project directory, or configure via .env

Quick Start (Clone & Run)

# Clone the repository
git clone https://github.com/YOUR_USERNAME/pocketbase-dev-mcp.git
cd pocketbase-dev-mcp

# Install dependencies
bun install

# (Optional) Configure defaults
cp .env.example .env
# Edit .env to set your PocketBase binary path, admin credentials, etc.

# Build
bun run build

# Add to Claude Desktop config (see Configuration section below)

Installation

  1. Download index.js from the latest release

  2. Download PocketBase binary from pocketbase.io

  3. Place both files in the same directory (e.g., ~/tools/pocketbase-mcp/)

Option 2: Build from Source

# Clone the repository
git clone https://github.com/YOUR_USERNAME/pocketbase-dev-mcp.git
cd pocketbase-dev-mcp

# Install dependencies and build
bun install
bun run build

# Built file is at dist/index.js

Configuration

Environment Variables (.env)

Create a .env file in the project root to customize defaults:

cp .env.example .env

Variable

Description

Default

POCKETBASE_BINARY

Path to pocketbase executable

pocketbase (searches PATH)

DEFAULT_ADMIN_EMAIL

Default admin email for new projects

admin@local.dev

DEFAULT_ADMIN_PASSWORD

Default admin password

admin123456

STARTING_PORT

Starting port for auto-assignment

8090

Claude Desktop Setup

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "pocketbase": {
      "command": "bun",
      "args": ["/path/to/pocketbase-dev-mcp/dist/index.js"]
    }
  }
}

Usage

Setup a New Project

Set up PocketBase for my project at ~/projects/myapp

This creates:

  • .pocketbase.json - Project configuration

  • pocketbase-start.sh - Start script (foreground mode)

  • pocketbase-stop.sh - Stop script

  • pocketbase-status.sh - Status check script

Start PocketBase

cd ~/projects/myapp
./pocketbase-start.sh

The start script runs in foreground mode so logs are visible in the terminal. Press Ctrl+C to stop.

Stop PocketBase

./pocketbase-stop.sh

Check Status

./pocketbase-status.sh

Generated Scripts

pocketbase-start.sh

Runs PocketBase in foreground mode with:

  • Project-specific data directory

  • Dedicated port

  • Visible logs in terminal

  • PID file management

pocketbase-stop.sh

Stops the PocketBase instance by:

  • Finding process on the configured port

  • Sending graceful shutdown signal

  • Cleaning up PID file

pocketbase-status.sh

Shows:

  • Project name and configuration

  • Data directory location

  • Port number

  • Running/stopped status

  • Admin UI and API URLs

Project Configuration

The .pocketbase.json file in your project root:

{
  "projectName": "myapp",
  "port": 8090,
  "dataDir": "./pb_data",
  "pocketbaseBinary": "/path/to/pocketbase",
  "generatedAt": "2025-03-12T..."
}

Debug Logging

PocketBase v0.20.0+ does not have a --debug flag. To enable debug logging:

  1. Start the instance with ./pocketbase-start.sh

  2. Open Admin UI: http://127.0.0.1:PORT/_/_

  3. Go to Settings → Logs

  4. Set "Minimum log level" to DEBUG

  5. Logs will appear in the terminal in real-time

Architecture

How Multiple Instances Work

PocketBase stores data in a pb_data directory by default. To run multiple instances:

  1. Different Data Directories: Each instance uses --dir flag

  2. Different Ports: Each instance uses --http flag

  3. Same Binary: All instances run from the same ./pocketbase executable

Example:

# Instance for project "myapp"
./pocketbase serve --dir=./pb_data --http=127.0.0.1:8090

# Instance for project "blog"
./pocketbase serve --dir=./pb_data --http=127.0.0.1:8091

Available MCP Tools

setup-project

Creates project configuration, generates scripts, and creates admin user.

Input: { projectPath: string, projectName?: string, port?: number }

start-pocketbase

Starts PocketBase for a project (background mode).

Input: { projectPath: string }

stop-pocketbase

Stops PocketBase for a project.

Input: { projectPath: string }

status-pocketbase

Checks if PocketBase is running.

Input: { projectPath: string }

read-logs

Reads/tails logs with optional grep search.

Input: { projectPath: string, search?: string, lines?: number, ignoreCase?: boolean }

query-sqlite

Runs read-only SQLite queries against the database.

Input: { projectPath: string, query: string, format?: "table" | "json" }

list-project-configs

Lists all configured PocketBase projects.

Input: { searchPath?: string }

File Structure

pocketbase-mcp/
├── src/
│   ├── index.ts              # MCP server entry point
│   ├── script-generator.ts   # Script generation logic
│   ├── config.ts             # Configuration management
│   └── types.ts              # TypeScript types
├── pocketbase                # PocketBase binary
├── package.json
├── tsconfig.json
└── README.md

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      Enables managing PocketBase instances through intent-first tools for schema inspection, record CRUD, bulk operations, authentication, file handling, and server monitoring, with optional destructive operations gated behind explicit opt-in.
      11
      15
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables LLM clients to run advanced operations against a PocketBase backend, including creating and inspecting collections, CRUD on records with filtering and pagination, user authentication and account creation, and database backups. It also supports local stdio and Docker-based deployment with admin credentials configured via environment variables.
      18 npm
      ISC