PocketBase MCP Server is a tool that allows you to interact with a PocketBase database using the Model Context Protocol. It provides functionality for managing records, collections, files, logs, cron jobs, and database migrations in your PocketBase instance through a standardized interface.
The easiest way to install PocketBase MCP Server for Claude Desktop is via Smithery:
npx -y @smithery/cli install @mabeldata/pocketbase-mcp --client claude
If you prefer to install manually:
git clone <repository_url>
cd pocketbase-mcp
npm install
npm run build
The server needs two environment variables:
POCKETBASE_API_URL
: Your PocketBase instance URL (defaults to http://127.0.0.1:8090
)POCKETBASE_ADMIN_TOKEN
: An admin authentication token (required)You can generate an admin token from your PocketBase admin UI under API Keys section.
To use this server with Claude, add it to your MCP settings file:
Locate your Claude MCP settings file (typically at ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
or ~/Library/Application Support/Claude/claude_desktop_config.json
)
Add the following configuration:
{
"mcpServers": {
"pocketbase-mcp": {
"command": "node",
"args": ["/path/to/pocketbase-mcp/build/index.js"],
"env": {
"POCKETBASE_API_URL": "http://127.0.0.1:8090",
"POCKETBASE_ADMIN_TOKEN": "your-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"
]
}
}
}
To fetch a record by ID:
const record = await fetch_record({
collection: "users",
id: "RECORD_ID_HERE"
});
To list records with filtering, pagination, and sorting:
const records = await list_records({
collection: "users",
page: 1,
perPage: 20,
filter: "created >= '2023-01-01 00:00:00'",
sort: "-created,name",
expand: "relation_field"
});
To create a new record:
const newRecord = await create_record({
collection: "users",
data: {
name: "John Doe",
email: "[email protected]",
age: 30
}
});
To update an existing record:
const updatedRecord = await update_record({
collection: "users",
id: "RECORD_ID_HERE",
data: {
name: "Jane Doe",
age: 31
}
});
To upload a file to a record:
const result = await upload_file({
collection: "documents",
recordId: "RECORD_ID_HERE",
fileField: "attachment",
fileContent: "BASE64_ENCODED_CONTENT_OR_FILE_DATA",
fileName: "document.pdf"
});
To get a file download URL:
const fileUrl = await download_file({
collection: "documents",
recordId: "RECORD_ID_HERE",
fileField: "attachment",
downloadPath: "/local/path/to/save.pdf"
});
To get all collections:
const collections = await list_collections({});
To get the schema of a collection:
const schema = await get_collection_schema({
collection: "users"
});
The server includes a comprehensive migration system for managing database schema changes.
await set_migrations_directory({
customPath: "./my_migrations"
});
Basic migration:
await create_migration({
description: "add_user_email_index"
});
Collection migration:
await create_collection_migration({
description: "create_users_collection",
collectionDefinition: {
id: "users",
name: "users",
fields: [
{ name: "email", type: "email", required: true }
]
}
});
Add field migration:
await add_field_migration({
collectionNameOrId: "users",
fieldDefinition: {
name: "address",
type: "text"
}
});
// Apply specific migration
await apply_migration({ migrationFile: "1744005374_update_transactions_add_debt_link.js" });
// Apply all pending migrations
await apply_all_migrations({});
// Revert specific migration
await revert_migration({ migrationFile: "1744005374_update_transactions_add_debt_link.js" });
// Revert to specific point
await revert_to_migration({ targetMigration: "1743958155_update_transactions.js" });
// Revert all migrations
await revert_to_migration({ targetMigration: "" });
// List logs
const logs = await list_logs({
page: 1,
perPage: 30,
filter: "method='GET'"
});
// Get specific log
const log = await get_log({
id: "LOG_ID_HERE"
});
// Get logs statistics
const stats = await get_logs_stats({
filter: "method='GET'"
});
// List cron jobs
const jobs = await list_cron_jobs({});
// Run a cron job
await run_cron_job({
jobId: "CRON_JOB_ID_HERE"
});
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.