PocketBase MCP Server
dynamic-pocketbase-mcp
用于 PocketBase 的动态模型上下文协议 (MCP) 服务器。连接一次您的 AI 客户端,即可使用运行时工具管理任何 PocketBase 项目中的集合和记录。
为什么此服务器与众不同
许多 PocketBase MCP 服务器是静态的:它们硬编码了特定于集合的行为,或者需要为每个模式定义自定义工具。
dynamic-pocketbase-mcp 是动态的:
使用与集合无关的工具(
list_collections、list_records、create_record等)无需重新生成服务器代码即可在现有和新创建的集合上工作
将实时 PocketBase 集合公开为 MCP 资源
Related MCP server: PocketBase MCP Server
功能
18 个用于健康检查、身份验证、集合、规则和记录的 MCP 工具
集合生命周期操作(创建、更新、删除、检查)
具有过滤、排序、分页和字段选择功能的记录 CRUD 操作
通过工具进行基于会话的身份验证(
auth_admin、auth_user、get_auth_status、logout)内置字段模式和规则语法参考
安装
npm install dynamic-pocketbase-mcp
# or
bun install dynamic-pocketbase-mcp在 AI 客户端中配置
Claude Desktop
添加到您的 Claude Desktop 配置中(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"dynamic-pocketbase": {
"command": "npx",
"args": ["-y", "dynamic-pocketbase-mcp"]
}
}
}如果未设置 POCKETBASE_URL,服务器默认为 http://localhost:8090。
直接使用
# Use default URL (http://localhost:8090)
npx -y dynamic-pocketbase-mcp
# Use custom PocketBase URL
POCKETBASE_URL=https://pb.example.com \
bunx dynamic-pocketbase-mcp简单教程:使用此 MCP 与 AI 聊天
配置好 MCP 客户端后,打开聊天窗口并尝试以下提示:
"Set PocketBase URL to
https://pb.example.com.""Check my PocketBase server health."
"List all PocketBase collections."
"Authenticate as admin with email
<your-email>and password<your-password>.""Create a collection named
noteswith a requiredtitletext field.""Create a record in
noteswith titleFirst note.""Show all records in
notes, newest first.""Log out from PocketBase auth session."
如果这些步骤成功,您的 AI 现在可以通过此 MCP 服务器管理模式和数据。
身份验证流程(通过工具)
auth_admin或auth_userget_auth_statuslogout
可用工具
健康检查与参考
health- 检查 PocketBase 服务器健康状态set_base_url- 更新当前 MCP 会话的 PocketBase URL 并清除身份验证令牌get_field_schema_reference- 获取字段类型文档get_rules_reference- 获取 API 规则语法参考
身份验证
auth_admin- 以管理员/超级用户身份验证auth_user- 以身份验证集合用户身份验证(电子邮件/用户名)get_auth_status- 检查当前身份验证状态logout- 清除身份验证会话
集合
list_collections- 列出所有集合view_collection- 按名称或 ID 查看集合create_collection- 创建新集合(除非提供,否则自动为基础/身份验证集合添加created和updated自动日期字段)update_collection- 更新集合模式/设置delete_collection- 删除集合update_collection_rules- 更新访问控制规则
记录
list_records- 通过过滤、排序、分页列出/搜索记录view_record- 按 ID 查看单条记录create_record- 创建新记录update_record- 更新现有记录delete_record- 删除记录
开发
# Install dependencies
bun install
# Run in development mode
bun run dev
# Type check
bun run typecheck
# Run tests (builds dist first)
bun run test
# Run all checks (typecheck + tests)
bun run check
# Interactive release helper (bump, check, publish, push tag)
bun run release
# Build for production
bun run build环境变量
变量 | 必需 | 描述 |
| 否 | PocketBase 服务器 URL(默认: |
许可证
MIT
Available Tools
22 toolsanalyze_collection_dataC
Analyze data patterns and provide insights about a collection
Inputs: collection (required), options.
authenticate_userC
Authenticate a user and get auth token
Inputs: email (required), password (required), autoRefreshThreshold, collection.
backup_databaseC
Create a backup of the PocketBase database
Inputs: format.
create_collectionC
Create a new collection in PocketBase
Inputs: fields (required), name (required), createRule, deleteRule, +7 more.
create_recordC
Create a new record in a collection
Inputs: collection (required), data (required), expand, fields.
create_userC
Create a new user account
Inputs: email (required), password (required), passwordConfirm (required), additionalData, +3 more.
delete_collectionB
Delete a collection from PocketBase
Inputs: collection (required).
delete_recordC
Delete a record
Inputs: collection (required), id (required).
download_fileC
Download a file from a record in PocketBase
Inputs: collection (required), fileField (required), recordId (required).
generate_pb_schemaB
Generate a PocketBase schema based on TypeScript interfaces or database diagram
Inputs: sourceCode (required), options.
generate_typescript_interfacesB
Generate TypeScript interfaces from PocketBase collections
Inputs: collections, options.
get_collection_schemaC
Get schema details for a collection
Inputs: collection (required).
import_dataC
Import data into a collection
Inputs: collection (required), data (required), mode.
list_collectionsC
List all collections with optional sorting
Inputs: sort.
list_recordsC
List records from a collection with optional filters
Inputs: collection (required), expand, fields, filter, +4 more.
manage_indexesC
Manage collection indexes
Inputs: action (required), collection (required), index.
migrate_collectionC
Add, remove, or modify fields from a collection
Inputs: collection (required), fields (required), createRule, dataTransforms, +5 more.
query_collectionC
Advanced query with filtering, sorting, and aggregation
Inputs: collection (required), aggregate, expand, filter, +1 more.
truncate_collectionB
Delete all records associated with the specified collection
Inputs: collection (required).
update_recordC
Update an existing record
Inputs: collection (required), data (required), id (required), expand, +1 more.
upload_fileB
Upload a file to a record in PocketBase
Inputs: collection (required), fileContent (required), fileField (required), fileName (required), +1 more.
upload_file_from_urlC
Upload a file from URL to a record in PocketBase
Inputs: collection (required), fileField (required), recordId (required), url (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Most tools have distinct purposes targeting specific resources and actions, but some potential confusion exists: 'list_records' and 'query_collection' both retrieve records, though 'query_collection' offers advanced features; 'upload_file' and 'upload_file_from_url' are closely related but differentiated by source. Overall, descriptions help clarify boundaries, but minor overlaps could cause occasional misselection.
Tool names follow a highly consistent verb_noun pattern throughout, such as 'create_collection', 'delete_record', and 'list_records'. All tools use snake_case with clear, descriptive verbs aligned with their actions, making the set predictable and easy to navigate without any deviations in style.
With 22 tools, the count is slightly high for a typical MCP server scope, but it is reasonable given the comprehensive coverage of PocketBase operations. It includes CRUD, schema management, data handling, and utilities, which justifies the number, though it might feel heavy compared to more focused servers.
The tool set provides complete coverage for PocketBase operations, including full CRUD for collections and records, user authentication, schema management, data import/export, file handling, and utilities like backup and analysis. There are no obvious gaps, ensuring agents can handle all core workflows without dead ends.
Maintenance
Related MCP Connectors
Hosted MCP server for AI-driven data ops. Create apps, manage schemas, and CRUD structured data.
MCP server for interacting with the Supabase platform
Agent-native backend: Postgres, auth, storage, functions, hosting and deploy, over MCP
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Related MCP Servers
- AlicenseDqualityNot gradedmaintenanceA comprehensive MCP server that provides sophisticated tools for interacting with PocketBase databases. This server enables advanced database operations, schema management, and data manipulation through the Model Context Protocol (MCP).14164 npm70MIT
- AlicenseAqualityCmaintenanceMCP server that allows interaction with PocketBase databases, enabling record operations (fetch, list, create, update), file management, and schema migrations through natural language.2243MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants and MCP clients to interact with PocketBase databases for authentication, data management, and administrative operations.65MIT
- 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