The PocketBase MCP Server enables advanced interactions with PocketBase databases through the Model Context Protocol (MCP). It provides tools for database operations, schema management, and data manipulation, all accessible through a structured API.
To set up the PocketBase MCP Server locally:
Configure your MCP settings file located in your Cursor/Claude user settings directory:
{
"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"
]
}
}
}
Set the correct environment variables:
POCKETBASE_URL
: Required - URL of your PocketBase instancePOCKETBASE_ADMIN_EMAIL
: Optional - Admin email for privileged operationsPOCKETBASE_ADMIN_PASSWORD
: Optional - Admin passwordPOCKETBASE_DATA_DIR
: Optional - Custom data directory pathawait mcp.use_tool("pocketbase", "create_collection", {
name: "posts",
schema: [
{
name: "title",
type: "text",
required: true
},
{
name: "content",
type: "text",
required: true
}
]
});
await mcp.use_tool("pocketbase", "get_collection", {
collection: "posts"
});
await mcp.use_tool("pocketbase", "create_record", {
collection: "posts",
data: {
title: "My First Post",
content: "This is the content of my first post."
}
});
await mcp.use_tool("pocketbase", "list_records", {
collection: "posts",
filter: "title ~ 'First'",
sort: "-created",
limit: 10
});
await mcp.use_tool("pocketbase", "update_record", {
collection: "posts",
id: "record_id_here",
data: {
title: "Updated Post Title",
content: "This content has been updated."
}
});
await mcp.use_tool("pocketbase", "delete_record", {
collection: "posts",
id: "record_id_here"
});
await mcp.use_tool("pocketbase", "authenticate_user", {
email: "[email protected]",
password: "securepassword",
collection: "users"
});
await mcp.use_tool("pocketbase", "create_user", {
email: "[email protected]",
password: "securepassword",
passwordConfirm: "securepassword",
name: "New User"
});
await mcp.use_tool("pocketbase", "backup_database", {
format: "json" // or other supported formats
});
When setting up the server in your MCP settings file, you can configure these options:
node
)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "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"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"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"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"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"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect