pocketbase-mcp
Provides tools for interacting with PocketBase, enabling AI agents to manage collections and records, query data, handle file operations, authenticate users, and inspect server status.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pocketbase-mcp show me the schema for the users collection"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pocketbase-mcp
An MCP server that exposes PocketBase through 13 intent-first tools rather than ~50 endpoint wrappers.
Install
Requires Python >=3.11 and uv.
uv syncuv sync installs the pypocketbase client from its Git repository.
Related MCP server: PocketBase MCP Server
Environment Variables
Variable | Default | Description |
|
| PocketBase instance URL |
| (none) | Superuser email for startup auth |
| (none) | Superuser password for startup auth |
| (unset) | Set any truthy value to register |
|
| HTTP transport bind host |
|
| HTTP transport bind port |
|
| Max page size for |
|
| Max operations per |
Tools
13 intent-first tools. Each one returns {"ok": true, "data": …, "hint"?: …} on
success or {"ok": false, "error_type": …, "message": …, "hint": …} on failure.
The hint names the next tool to call or the step that fixes the error. The
Kind column marks each tool R read-only, I idempotent, or D
destructive.
Always registered (11)
Tool | Kind | Purpose | Key parameters |
| R | Inventory every collection (name, id, type, field count) |
|
| R | Full field defs, types, |
|
| R | Query/look up records — by id, or |
|
| I | Create or update one record; the server validates the payload against the cached schema first |
|
| — | Many writes as one atomic transaction |
|
| I | Create or alter a collection (base / auth / view) |
|
| — | Check or switch the process identity |
|
| — | Auth lifecycle: password reset, verification, email change, token refresh |
|
| — | File on a record: get URL, download bytes, upload local file |
|
| R | Health, settings summary, cron list, log stats (non-health sections need superuser) | (none) |
| R | Request log entries (superuser only) |
|
Destructive — opt-in only (2)
The server registers these two only when POCKETBASE_ENABLE_DESTRUCTIVE is set.
Each one requires a confirmation argument that must match the current state, so
you cannot run the call without first checking what it will affect.
Tool | Kind | Purpose | Key parameters |
| D | Permanently delete records. IRREVERSIBLE |
|
| D |
|
|
Resource & prompts
Resource
pocketbase://schema— all collections (id, name, type, field_count).Prompts:
inspect_then_query,safe_delete,create_with_validation.
Skills
skills/pocketbase-mcp-tools/SKILL.md is an agent skill that teaches an MCP
client to use these tools correctly. It covers the inspect-then-act order,
filter templates instead of string interpolation, pagination limits, the
complex-query grammar (relation traversal, ?= any-of, API-rule shapes), and
the confirmation steps for destructive tools. Point your agent at the file, or
copy it into the client's skills directory. It gives better tool use than the
tool docstrings alone.
Docker
The image runs the HTTP transport (pocketbase-mcp --http). This is the
only transport that works in a container, because the stdio transport needs the
MCP client to start the process itself. The image binds 0.0.0.0:8000, runs as
a non-root user, and contains no build tools.
Pull the published image. Every GitHub release triggers
.github/workflows/docker-release.yml, which builds linux/amd64 and
linux/arm64 and pushes to GHCR:
docker run -d --name pocketbase-mcp -p 8000:8000 --env-file .env \
ghcr.io/touexe/pocketbase-mcp:latestTags: latest, the full version (1.0.0), 1.0, and 1.
Read the logs with docker logs -f pocketbase-mcp. Stop and remove the
container with docker rm -f pocketbase-mcp.
Build it yourself:
docker build -t pocketbase-mcp .
docker run -d --name pocketbase-mcp -p 8000:8000 --env-file .env pocketbase-mcpdocker-compose has two profiles:
docker compose --profile local up --build # build from the local Dockerfile
docker compose --profile registry up # pull ghcr.io/touexe/pocketbase-mcp:latestBoth services read the variables from .env (POCKETBASE_URL,
POCKETBASE_ADMIN_EMAIL, POCKETBASE_ADMIN_PASSWORD,
POCKETBASE_ENABLE_DESTRUCTIVE, and the rest) and set
POCKETBASE_MCP_HOST=0.0.0.0 and POCKETBASE_MCP_PORT=8000.
To reach a PocketBase server on the host: inside the container, 127.0.0.1
points at the container itself, not the host. Set
POCKETBASE_URL=http://host.docker.internal:8090. On Linux, also add
--add-host=host.docker.internal:host-gateway to docker run. Or run
PocketBase in the same compose network and use its service name.
To override the default flag (for example, to bind a different port), append the arguments:
docker run -d --name pocketbase-mcp-9000 -p 9000:9000 -e POCKETBASE_MCP_PORT=9000 \
--env-file .env ghcr.io/touexe/pocketbase-mcp:latest --httpOne Identity Per Process
This server carries exactly one PocketBase identity. The pypocketbase client writes the auth token into a single shared aiohttp session. Calling connect(as_='user', ...) changes the identity for all subsequent calls in the session.
For multi-tenant use (different identities in parallel), run one server process per identity.
Destructive Tools Opt-In
delete_records and destroy_collection are not registered by default. Set POCKETBASE_ENABLE_DESTRUCTIVE=1 to make them available. The opt-in stops a deployment that must never delete data from doing so by accident, whatever the agent requests.
Running
stdio (default, for Claude Desktop / MCP clients):
uv run pocketbase-mcpHTTP transport:
uv run pocketbase-mcp --httpClient Config Snippet
For Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"pocketbase": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp", "pocketbase-mcp"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_ADMIN_EMAIL": "admin@example.com",
"POCKETBASE_ADMIN_PASSWORD": "your-password"
}
}
}
}Testing
The default suite is hermetic: no network, no credentials.
uv run python -m pytestLive integration suite
tests/live/ drives the in-memory FastMCP client (the surface an agent sees)
against a real PocketBase server. It is marked live and excluded from the
default run; opt in with:
uv run python -m pytest -m liveRequired environment (names only; never commit a value):
Variable | Purpose |
| instance the suite runs against (defaults to |
| superuser identity, established through the |
| superuser password |
The suite sets settings.enable_destructive for its own session, so
delete_records and destroy_collection are exercised; you do not need to
set POCKETBASE_ENABLE_DESTRUCTIVE yourself.
When the server is unreachable or either credential is missing, every live test skips with a stated reason; it never errors.
⚠️ Development instances only. The live suite creates and deletes collections. Never point
POCKETBASE_URLat production or any instance whose data you care about.
The mcptest_ prefix rule: the safety contract
Every collection a live test touches must be one it created itself, named
mcptest_<area>_<hex8> via the live_collection factory. Teardown (both the
per-test finalizer and the session-end sweep) deletes only mcptest_*
names and raises rather than deletes anything else. This, plus the rule that
no test names a collection it did not create, keeps a mis-pointed
POCKETBASE_URL from destroying real data. Anyone adding a live test must
honor it: draw collections from the factory, never hard-code a bare name.
Resolved design questions
Session-end sweep is always on (no
--no-live-sweep). The sweep runs at the start and end of the next session and removes a crashed run'smcptest_*leftovers, so a fresh run is always clean; diagnose a failure by rerunning the single test.File-upload fixture is a generated temp file, not a committed binary asset. No thumbnail behaviour is exercised, so no real image is needed.
Smoke-testing over HTTP
tests/ and tests/live/ both run in-process; neither builds an HTTP
request. scripts/curl_smoke.sh closes that gap: it drives an
already-running HTTP server with nothing but curl, jq, and sed,
completing the MCP Streamable HTTP handshake, then issuing one real tools/call
against every registered tool. It is an operator/developer
command; it is not collected by pytest and not wired into CI.
⚠️ It writes to a real instance. Point it only at a development PocketBase. Every collection and record it creates lives under an ephemeral
mcpsmoke_-prefixed collection that it drops again on exit.
1. Start the server (a second terminal), against a development instance, with the destructive tools registered so all 13 are covered:
POCKETBASE_URL=http://127.0.0.1:8090 \
POCKETBASE_ADMIN_EMAIL=admin@example.com \
POCKETBASE_ADMIN_PASSWORD=your-password \
POCKETBASE_ENABLE_DESTRUCTIVE=1 \
uv run pocketbase-mcp --httpWithout POCKETBASE_ENABLE_DESTRUCTIVE=1 the server registers only 11 tools and
the harness prints a SKIP: line saying the flag is required for full coverage.
2. Run the harness:
POCKETBASE_ADMIN_EMAIL=admin@example.com \
POCKETBASE_ADMIN_PASSWORD=your-password \
bash scripts/curl_smoke.shIt reads POCKETBASE_MCP_HOST / POCKETBASE_MCP_PORT (default
127.0.0.1:8000) to find the server. POCKETBASE_ADMIN_EMAIL /
POCKETBASE_ADMIN_PASSWORD are the superuser credentials it authenticates and
tears down with; the same names the server itself uses.
Prerequisites: bash, curl, jq, and sed on PATH. Missing any of
them, missing a credential, or an unreachable MCP port each produce a SKIP:
line and exit 0, never a failure. A genuine assertion failure prints the
request and the full response body, still runs the remaining cases, tears down,
and exits 1.
Cleanup. A clean run, a failed run, and a Ctrl-C all trigger an EXIT trap
that reconnects as superuser and drops every mcpsmoke_ collection the run
created. A hard kill (SIGKILL) can still strand mcpsmoke_* collections;
they are safe to drop by hand. If teardown's own superuser reconnect fails
(the process may be left holding an ephemeral user identity), restart the
server process before retrying.
Design Decisions (Open Questions Resolved)
Should find_records fall back to get_full_list automatically?
Decision: Explicit fetch_all=True required.
An accidental full-table read floods the context window. An agent that asks for "all records" from a 100,000-row table would silently exhaust its context budget if the fallback were automatic. Passing fetch_all=True is a deliberate signal; the default paged behavior is safe.
Expose the schema as an MCP resource in addition to describe_schema?
Decision: Deferred. Tools only for v1.
Resources require the client to know when to re-fetch them (cache invalidation). Tools give the agent explicit control: call describe_schema(refresh=True) after a schema change. Once real usage shows the schema being re-read every turn, a resource is the right fix. Adding it later is cheap; it doesn't change any tool contracts.
Available Tools
11 toolsbulk_writeA
USE WHEN you need to create/update/delete multiple records atomically.
EXAMPLES:
operations=[ {"collection": "posts", "action": "create", "data": {"title": "A"}}, {"collection": "posts", "action": "update", "record_id": "xyz", "data": {"title": "B"}}, ]
NEXT STEPS: find_records to verify results.
Inputs: operations (required). Returns: object
connectA
USE WHEN you need to authenticate or check the current session identity.
EXAMPLES:
Check identity: connect(as_="status")
Superuser: connect(as_="superuser", email="admin@x.com", password="...")
User: connect(as_="user", collection="users", email="u@x.com", password="...")
Impersonate: connect(as_="impersonate", user_id="abc123")
NEXT STEPS: All subsequent tool calls in this session use the new identity.
Inputs: as_, email, user_id, password, +1 more. Returns: object
describe_collectionARead-only
USE WHEN you need full field definitions, API rules, or relation targets for one collection.
EXAMPLES:
"What fields does 'posts' have?" -> describe_collection(collection="posts")
Before write_record to see required fields -> describe_collection(collection="posts")
"What are the auth rules?" -> describe_collection(collection="users")
NEXT STEPS: find_records or write_record with the correct field names.
Inputs: collection (required). Returns: object
describe_schemaARead-only
USE WHEN you need a quick inventory of all collections before querying or writing.
EXAMPLES:
"What collections exist?" -> describe_schema()
"Does a 'posts' collection exist?" -> describe_schema()
After adding a collection -> describe_schema(refresh=True)
NEXT STEPS: describe_collection(collection="") for field details.
Inputs: refresh. Returns: object
find_recordsARead-only
USE WHEN you need to query or look up records in a collection.
EXAMPLES:
By id: find_records(collection="posts", record_id="abc123")
By filter: find_records(collection="posts", filter_template="status = {:s}", filter_params={"s": "published"})
All records: find_records(collection="posts", fetch_all=True)
NEXT STEPS: write_record to mutate, describe_collection for field names.
Inputs: collection (required), page, sort, expand, +6 more. Returns: object
inspect_serverARead-only
USE WHEN you need an overview of server health, settings, cron jobs, and log statistics.
EXAMPLES:
"Is PocketBase running?" -> inspect_server()
"What cron jobs are registered?" -> inspect_server()
"How many requests in the last 7 days?" -> inspect_server()
NEXT STEPS: read_logs for detailed log entries; connect(as_='superuser') for full access.
Inputs: no named parameters. Returns: object
manage_authA
USE WHEN you need to manage auth lifecycle: password reset, verification, email change, or token refresh.
EXAMPLES:
Request reset: manage_auth(action="request_password_reset", collection="users", email="u@x.com")
Confirm reset: manage_auth(action="confirm_password_reset", collection="users", token="...", password="new", password_confirm="new")
Refresh token: manage_auth(action="refresh", collection="users")
NEXT STEPS: connect(as_='status') to verify identity after refresh.
Inputs: action (required), email, token, password, +3 more. Returns: object
manage_collectionAIdempotent
USE WHEN you need to create or modify a collection schema.
EXAMPLES:
Create base: manage_collection(action="create", name="posts", fields=[{"name": "title", "type": "text", "required": True}])
Create view: manage_collection(action="create", name="post_stats", collection_type="view", view_query="SELECT id, title FROM posts")
Update rules: manage_collection(action="update", name="posts", api_rules={"list": "@request.auth.id != ''"})
NEXT STEPS: describe_collection to verify, find_records or write_record to use.
Inputs: name (required), action (required), fields, indexes, +3 more. Returns: object
manage_filesA
USE WHEN you need to get a file URL, download a file, or upload a new file to a record.
EXAMPLES:
URL: manage_files(action="url", collection="posts", record_id="abc", field="cover", filename="img.jpg")
Thumb: manage_files(action="url", ..., thumb="200x200")
Download: manage_files(action="download", ..., filename="doc.pdf")
Upload: manage_files(action="upload", ..., field="cover", local_path="/tmp/img.jpg", filename="img.jpg")
NEXT STEPS: find_records to see the updated file field after upload.
Inputs: field (required), action (required), record_id (required), collection (required), +3 more. Returns: object
read_logsARead-only
USE WHEN you need to inspect request log entries. Superuser access required.
EXAMPLES:
Latest logs: read_logs()
Single entry: read_logs(log_id="xyz")
Filter by level: read_logs(filter_template="level >= {:l}", filter_params={"l": 4})
NEXT STEPS: inspect_server for aggregate stats; connect(as_='superuser') if unauthorized.
Inputs: page, log_id, per_page, filter_params, +1 more. Returns: object
write_recordAIdempotent
USE WHEN you need to create or update a single record.
EXAMPLES:
Create: write_record(collection="posts", action="create", data={"title": "Hi", "body": "..."})
Update: write_record(collection="posts", action="update", record_id="abc", data={"title": "New"})
NEXT STEPS: find_records to verify, describe_collection for field names.
Inputs: data (required), action (required), collection (required), expand, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct resource and action. Overlapping pairs like describe_schema/describe_collection and inspect_server/read_logs are clearly differentiated by their descriptions and intended use cases.
All tool names follow a consistent snake_case style, mostly verb_noun (e.g., describe_schema, find_records, manage_collection). The only deviation, bulk_write, still fits the style and does not introduce a mixed convention.
With 11 tools, the server is well-scoped for a backend platform, covering schema, records, auth, files, logs, and server health without being over- or under-populated.
While the core workflows are covered, there are notable gaps: no dedicated tool for deleting a single record (only via bulk_write) and manage_collection does not support deleting collections. These are core CRUD operations that an agent would expect.
Maintenance
Related MCP Connectors
Manage PocketBase Cloud projects, instances, deploys, domains, collections and records.
Manage Supabase projects end to end across database, auth, storage, realtime, and migrations. Moni…
The Instant MCP server is a wrapper around the Instant Platform SDK that enables creating, managing, and updating InstantDB applications directly within an editor. It provides tools for fetching rules files for LLMs, retrieving and pushing app schemas, managing permission rules, and executing database queries. Key capabilities include schema management (get-schema, push-schema), permission management (get-perms, push-perms), query execution, and listing recent query history.
Manage uivoid projects, tools, keys, hosted databases and teams from your agent.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables Claude to manage a self-hosted PocketBase instance: querying and editing records, inspecting and changing collection schemas, handling files, users and backups, and auditing API rules for exposure risks. Writes are gated by a read-only mode plus a two-step confirmation that returns a preview diff and single-use token, so nothing changes until the identical call is approved.18 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables creating and managing collections, performing record CRUD operations with pagination and expansions, handling user authentication, and backing up PocketBase databases through MCP tools.18 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to perform advanced database operations against a PocketBase instance, including collection and schema management, record CRUD with filtering, pagination and relationship expansion, user authentication and account creation, and database backups. It connects over stdio with configurable URL and admin credentials, supporting local, VS Code, and Docker deployments.18 npmISC
- AlicenseNot gradedqualityAmaintenanceProvides sophisticated tools for interacting with a PocketBase database, enabling collection schema management, record CRUD operations with filtering and pagination, user authentication, and database backups. It runs locally via Node or Docker and connects to your instance through environment-configured credentials.18 npmISC