Skip to main content

pocketbase-mcp

A Model Context Protocol (MCP) server for PocketBase — giving AI assistants like Claude full access to your PocketBase backend through a clean, Pythonic interface.


Overview

pocketbase-mcp bridges the gap between LLMs and your PocketBase instance. Once connected, AI assistants can list collections, perform CRUD operations on records, manage authentication, handle file uploads, and administer your database — all through natural language.

Built with FastMCP (the standard Python MCP framework) and httpx for async HTTP communication with the PocketBase REST API.


Features

  • Records — list, get, create, update, delete, and batch-operate on records in any collection
  • Collections — list, inspect, create, update, and delete collection schemas
  • Authentication — authenticate as a superuser or regular user via email/password or API key
  • Files — generate file tokens and retrieve file URLs with optional image transformations
  • Settings — read and update application settings
  • Filtering & Pagination — pass PocketBase filter expressions, sort, expand, and pagination params directly
  • Realtime-aware — designed with SSE subscription patterns in mind for future extension

Requirements

  • Python 3.11+
  • A running PocketBase instance (local or remote)
  • uv (recommended) or pip

Installation

Using pip

pip install pocketbase-mcp

Configuration

The server is configured via environment variables:

Variable Required Default Description
POCKETBASE_URL Yes — Base URL of your PocketBase instance (e.g. http://127.0.0.1:8090)
POCKETBASE_SUPERUSER_EMAIL No — Superuser email for admin operations
POCKETBASE_SUPERUSER_PASSWORD No — Superuser password
POCKETBASE_API_KEY No — Long-lived API key (alternative to email/password)

Set them in a .env file or export directly:

export POCKETBASE_URL=http://127.0.0.1:8090
export POCKETBASE_SUPERUSER_EMAIL=admin@example.com
export POCKETBASE_SUPERUSER_PASSWORD=your-password

Running the Server

stdio transport (default — for Claude Desktop, Claude Code, etc.)

pocketmcp

With MCP Inspector (for development and testing)

# Terminal 1
pocketmcp

# Terminal 2
npx @modelcontextprotocol/inspector

Connecting to Claude

Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "pocketbase": {
      "command": "pocketmcp",
      "args": ["server"],
      "env": {
        "POCKETBASE_URL": "http://127.0.0.1:8090",
        "POCKETBASE_SUPERUSER_EMAIL": "admin@admin.com",
        "POCKETBASE_SUPERUSER_PASSWORD": "adminadmin"
      }
    }
  }
}

Available Tools

Records

Tool Description
list_records List records in a collection with filtering, sorting, and pagination
get_record Get a single record by ID
create_record Create a new record
update_record Update an existing record
delete_record Delete a record by ID
batch_records Perform multiple create/update/upsert/delete operations in one request

Collections

Tool Description
list_collections List all collections
get_collection Get a collection schema by name or ID
create_collection Create a new collection with fields and API rules
update_collection Update a collection's schema or rules
delete_collection Delete a collection

Authentication

Tool Description
auth_with_password Authenticate a user or superuser with email and password
get_auth_store Return the current authentication state

Files

Tool Description
get_file_url Generate the URL for a file attached to a record
create_file_token Create a short-lived token for accessing protected files

Settings

Tool Description
get_settings Retrieve all application settings
update_settings Update application settings

Project Structure

pocketbase-mcp/
├── server.py            # MCP server entry point (FastMCP)
├── tools/
│   ├── records.py       # Record CRUD tools
│   ├── collections.py   # Collection management tools
│   ├── auth.py          # Authentication tools
│   ├── files.py         # File tools
│   └── settings.py      # Settings tools
├── client.py            # Async PocketBase HTTP client (httpx)
├── config.py            # Environment variable loading
├── pyproject.toml
└── README.md

Example Usage

Once connected to Claude, you can interact with your PocketBase instance through natural language:

"List all records in the posts collection where status = 'published', sorted by created descending."

"Create a new record in users with name 'Alice' and role 'editor'."

"Show me the schema for the products collection."

"Delete the record with ID ae40239d2bc4477 from comments."

"Update the app name in PocketBase settings to 'My App'."


PocketBase Compatibility

This MCP server targets PocketBase v0.36.9+. The batch API requires it to be explicitly enabled in your PocketBase Dashboard under Settings → Application.


Security Notes

  • Never commit credentials to version control. Use environment variables or a .env file (add .env to .gitignore).
  • For production deployments, prefer API key authentication over email/password.
  • Collection API rules in PocketBase govern what the authenticated user can actually access — pocketbase-mcp respects these rules.

Contributing

Contributions are welcome! Please open an issue before submitting a pull request for significant changes.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-feature)
  3. Commit your changes
  4. Open a pull request

License

MIT License. See LICENSE for details.

Metadata

Release files for pocketbase-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pocketbase-mcp 0.1.1
File Size Uploaded Provenance Actions
pocketbase_mcp-0.1.1.tar.gz 15.4 kB With provenance Details for pocketbase_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pocketbase-mcp 0.1.1
File Interpreter ABI Platform Actions
pocketbase_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for pocketbase_mcp-0.1.1-py3-none-any.whl

Total release size: 32.8 kB

Release files / pocketbase_mcp-0.1.1.tar.gz

Download URL pocketbase_mcp-0.1.1.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1bf244701696ec6941d189ec7d1ab55efcc812704776b7cf13790ec4cbacbaf6
BLAKE2b-256 checksum
How to use checksums
75f5ebe79ec0bf2502c6297d965ee2afae328c7c813f4337a92e66ba76391b8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / pocketbase_mcp-0.1.1-py3-none-any.whl

Download URL pocketbase_mcp-0.1.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7b083af947f4ccc523767bc7af9ee3bc912904750997f1fdfc26193af5b9fee
BLAKE2b-256 checksum
How to use checksums
5a4acc7d5cb8127c82b275addbe0665a6bf15f81cc731b35c66abfaf48abaf14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for pocketbase-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pocketbase_mcp-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page