home / mcp / pocketbase mcp server

PocketBase MCP Server

This is an MCP server that interacts with a PocketBase instance. It allows you to fetch, list, create, update, and manage records and files in your PocketBase collections.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "mabeldata-pocketbase-mcp": {
      "command": "node",
      "args": [
        "/path/to/pocketbase-mcp/build/index.js"
      ],
      "env": {
        "POCKETBASE_API_URL": "<YOUR_POCKETBASE_API_URL>",
        "POCKETBASE_ADMIN_TOKEN": "<YOUR_POCKETBASE_ADMIN_TOKEN>"
      }
    }
  }
}

This MCP Server connects a PocketBase instance to your MCP client, enabling you to fetch, list, create, update, and manage records and files across PocketBase collections. It provides a practical bridge for dynamic data access and management within your MCP workflows.

How to use

You interact with the PocketBase MCP Server through your MCP client by selecting the pocketbase-mcp server as a data source. Configure the server with the PocketBase instance URL and an admin token, then use the available tools to manage records, schemas, files, and collections. The server exposes a comprehensive set of operations for working with PocketBase collections without needing to directly call the PocketBase API yourself.

Before you start, ensure the server has access to your PocketBase instance and that you provide the necessary authentication token. You can configure the admin token and the PocketBase URL as environment variables when you add the server to your MCP environment. The server supports operations like fetching a record, listing records with filters, creating and updating records, uploading and downloading files, and inspecting collection schemas.

How to install

Prerequisites you need on your system before installing:

  • Node.js (version compatible with the project)
  • npm (comes with Node.js)
  • git (to clone the repository, if you plan to obtain the source)

Install and build the PocketBase MCP Server using the package manager and commands shown in the setup flow.

# Install via Smithery (automatic integration with Claude Desktop)

npx -y @smithery/cli install @mabeldata/pocketbase-mcp --client claude
```

# Optional: clone the repository if you want to work with the source

git clone <repository_url>
cd pocketbase-mcp

# Install dependencies
npm install

# Build the server
npm run build

Configuration

The server requires two environment variables to be set for proper operation with your PocketBase instance. You will provide these values when adding the server to your MCP environment.

- POCKETBASE_API_URL: The URL of your PocketBase instance (for example, http://127.0.0.1:8090). If not set, it defaults to http://127.0.0.1:8090.

- POCKETBASE_ADMIN_TOKEN: An admin authentication token for your PocketBase instance. This token is required for privileged operations. You can generate it from the PocketBase admin UI under API KEYS.

Cline Installation

To run this server with Cline, add it to your MCP settings under mcpServers. Use the stdio configuration shown here to start the server and supply the required environment variables.

{
  "mcpServers": {
    "pocketbase_mcp": {
      "command": "node",
      "args": ["/path/to/pocketbase-mcp/build/index.js"],
      "env": {
        "POCKETBASE_API_URL": "<YOUR_POCKETBASE_API_URL>",
        "POCKETBASE_ADMIN_TOKEN": "<YOUR_POCKETBASE_ADMIN_TOKEN>"
      },
      "disabled": false,
      "autoApprove": [
        "fetch_record",
        "list_collections",
        "get_collection_schema",
        "list_logs",
        "get_log",
        "get_logs_stats",
        "list_cron_jobs",
        "run_cron_job"
      ]
    }
  }
}

Notes and tips

- The PocketBase MCP Server provides a broad set of tools for working with PocketBase data and schemas. You can manage records, retrieve collection schemas, handle file uploads, and inspect logs and cron jobs where available.

- The runtime command shown above runs a local, stdio-based MCP server. Ensure the path to the built entry point is correct for your environment. When you run the server, provide the same environment variables you would use in other deployment contexts.

Security considerations

Protect the admin token and limit access to the MCP server. Use strong, rotated admin credentials and restrict access to trusted clients and automation scripts. Only expose the server to trusted networks or environments.

Available tools

fetch_record

Fetch a single record from a PocketBase collection by ID.

list_records

List records from a PocketBase collection with support for pagination, filtering, sorting, and relation expansion.

create_record

Create a new record in a PocketBase collection.

update_record

Update an existing record in a PocketBase collection.

get_collection_schema

Get the schema of a PocketBase collection.

upload_file

Upload a file to a specified file field in a PocketBase collection record.

list_collections

List all collections in the PocketBase instance.

download_file

Get the download URL for a file stored in a PocketBase collection record.

list_logs

List API request logs from PocketBase.

get_log

Get a single API request log by its ID.

get_logs_stats

Get API request logs statistics with optional filtering.

list_cron_jobs

List all registered app-level cron jobs.

run_cron_job

Trigger a single cron job by its ID.

set_migrations_directory

Set the directory where migration files will be created and read from.

create_migration

Create a new, empty PocketBase migration file with a timestamped name.

create_collection_migration

Create a migration file for creating a new PocketBase collection.

add_field_migration

Create a migration file for adding a field to an existing collection.

list_migrations

List all migration files in the migrations directory.

apply_migration

Apply a specific migration file.

revert_migration

Revert a specific migration file.

apply_all_migrations

Apply all pending migrations.

revert_to_migration

Revert migrations up to a target point.