The PocketBase MCP Server is a specialized server designed to accelerate the development of PocketBase applications. Built on the Model Context Protocol (MCP), it provides advanced tools for database operations, schema management, and data manipulation. This server is tested on the latest version of PocketBase (currently 26.1) and leverages the type definitions from the JS-SDK for improved accuracy and functionality.
Unlike DynamicsEndpoints, this server is actively tested and refined for the latest PocketBase version. It uses correct type definitions from the JS-SDK, ensuring reliable performance. Many methods in DynamicsEndpoints are non-functional, making this server a superior choice for developers.
To set up the MCP server locally, follow these steps:
Locate Your cline_mcp_settings.json
File
This file is typically found in your Cursor user settings directory. For example:
/Users/yourusername/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Configure the Server
Add a new entry to the mcpServers
object in your cline_mcp_settings.json
file. Here’s an example configuration:
json
{
"mcpServers": {
"pocketbase-server": {
"command": "node",
"args": ["build/index.js"],
"env": {
"POCKETBASE_URL": "http://127.0.0.1:8090",
"POCKETBASE_ADMIN_EMAIL": "[email protected]",
"POCKETBASE_ADMIN_PASSWORD": "admin_password"
},
"disabled": false,
"autoApprove": ["create_record", "create_collection"]
}
}
}
command
: The command to start the server (usually node
). args
: Arguments pointing to the compiled JavaScript file (e.g., build/index.js
). env
: Environment variables for your PocketBase instance. disabled
: Whether to disable the server on startup. autoApprove
: List of tools to auto-approve.
Start the Server
Once configured, the MCP server is ready to use with the specified tools.
create_collection
: Create a new collection with a custom schema. get_collection
: Retrieve schema details for a collection. create_record
: Add a new record to a collection. list_records
: List records with optional filters and pagination. update_record
: Modify an existing record. delete_record
: Remove a record. authenticate_user
: Authenticate a user and retrieve an auth token. create_user
: Create a new user account. backup_database
: Create a backup of the PocketBase database. The server requires the following environment variables:
POCKETBASE_URL
: URL of your PocketBase instance (e.g., http://127.0.0.1:8090
).
Optional:
POCKETBASE_ADMIN_EMAIL
: Admin email for specific operations. POCKETBASE_ADMIN_PASSWORD
: Admin password. POCKETBASE_DATA_DIR
: Custom data directory path. // Create a new collection
await mcp.use_tool("pocketbase", "create_collection", {
name: "posts",
schema: [
{ name: "title", type: "text", required: true },
{ name: "content", type: "text", required: true }
]
});
// Authenticate a user
await mcp.use_tool("pocketbase", "authenticate_user", {
email: "[email protected]",
password: "securepassword",
collection: "users"
});
The PocketBase MCP Server is designed to streamline PocketBase app development. For front-end solutions, consider FastPocket.
This project is licensed under the MIT License.