No project description provided
Project description
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) orpip
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
# Connect to: http://localhost:8000/mcp
Connecting to Claude
Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"pocketbase": {
"command": "uv",
"args": ["run", "/absolute/path/to/pocketbase-mcp/server.py"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_SUPERUSER_EMAIL": "admin@example.com",
"POCKETBASE_SUPERUSER_PASSWORD": "your-password"
}
}
}
}
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 |
auth_with_api_key |
Authenticate using a long-lived API key |
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
postscollection wherestatus = 'published', sorted bycreateddescending."
"Create a new record in
userswith name 'Alice' and role 'editor'."
"Show me the schema for the
productscollection."
"Delete the record with ID
ae40239d2bc4477fromcomments."
"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
.envfile (add.envto.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-mcprespects these rules.
Contributing
Contributions are welcome! Please open an issue before submitting a pull request for significant changes.
- Fork the repository
- Create a feature branch (
git checkout -b feat/my-feature) - Commit your changes
- Open a pull request
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pocketbase_mcp-0.1.0.tar.gz.
File metadata
- Download URL: pocketbase_mcp-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c4c21e3e6f9da25ac168be0fc84ac6038b1bc08d9255b06433d9508cd4b454
|
|
| MD5 |
51885772a9d9e16187d0998dad9ec2fc
|
|
| BLAKE2b-256 |
589a4164155fc2b4955df1d01a3bafa3e10b1938bf5df40a90c667be31e6833b
|
Provenance
The following attestation bundles were made for pocketbase_mcp-0.1.0.tar.gz:
Publisher:
main-push.yaml on victormpa/pocketbase-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocketbase_mcp-0.1.0.tar.gz -
Subject digest:
d7c4c21e3e6f9da25ac168be0fc84ac6038b1bc08d9255b06433d9508cd4b454 - Sigstore transparency entry: 1334903035
- Sigstore integration time:
-
Permalink:
victormpa/pocketbase-mcp@38b40923c4b97e9df512466984ba9ee0897113f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/victormpa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main-push.yaml@38b40923c4b97e9df512466984ba9ee0897113f5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pocketbase_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pocketbase_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6add7803ba7977c1a9bcc81ad7e1adafedf83fcdf8d19851cafe5d81cdc79d
|
|
| MD5 |
1fa5a20a99c1a9f4b6ce74a5c637d980
|
|
| BLAKE2b-256 |
b1d59b1b86815153fdc585eb2bb266e7d246792b1207891f6abcf72e1ef23667
|
Provenance
The following attestation bundles were made for pocketbase_mcp-0.1.0-py3-none-any.whl:
Publisher:
main-push.yaml on victormpa/pocketbase-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocketbase_mcp-0.1.0-py3-none-any.whl -
Subject digest:
2b6add7803ba7977c1a9bcc81ad7e1adafedf83fcdf8d19851cafe5d81cdc79d - Sigstore transparency entry: 1334903158
- Sigstore integration time:
-
Permalink:
victormpa/pocketbase-mcp@38b40923c4b97e9df512466984ba9ee0897113f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/victormpa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main-push.yaml@38b40923c4b97e9df512466984ba9ee0897113f5 -
Trigger Event:
push
-
Statement type: