Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

dynamic-pocketbase-mcp

用于 PocketBase 的动态模型上下文协议 (MCP) 服务器。连接一次您的 AI 客户端,即可使用运行时工具管理任何 PocketBase 项目中的集合和记录。

为什么此服务器与众不同

许多 PocketBase MCP 服务器是静态的:它们硬编码了特定于集合的行为,或者需要为每个模式定义自定义工具。

dynamic-pocketbase-mcp 是动态的:

  • 使用与集合无关的工具(list_collectionslist_recordscreate_record 等)

  • 无需重新生成服务器代码即可在现有和新创建的集合上工作

  • 将实时 PocketBase 集合公开为 MCP 资源

Related MCP server: PocketBase MCP Server

功能

  • 18 个用于健康检查、身份验证、集合、规则和记录的 MCP 工具

  • 集合生命周期操作(创建、更新、删除、检查)

  • 具有过滤、排序、分页和字段选择功能的记录 CRUD 操作

  • 通过工具进行基于会话的身份验证(auth_adminauth_userget_auth_statuslogout

  • 内置字段模式和规则语法参考

安装

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 客户端后,打开聊天窗口并尝试以下提示:

  1. "Set PocketBase URL to https://pb.example.com."

  2. "Check my PocketBase server health."

  3. "List all PocketBase collections."

  4. "Authenticate as admin with email <your-email> and password <your-password>."

  5. "Create a collection named notes with a required title text field."

  6. "Create a record in notes with title First note."

  7. "Show all records in notes, newest first."

  8. "Log out from PocketBase auth session."

如果这些步骤成功,您的 AI 现在可以通过此 MCP 服务器管理模式和数据。

身份验证流程(通过工具)

  1. auth_adminauth_user

  2. get_auth_status

  3. logout

可用工具

健康检查与参考

  • 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 - 创建新集合(除非提供,否则自动为基础/身份验证集合添加 createdupdated 自动日期字段)

  • 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

PocketBase 服务器 URL(默认:http://localhost:8090

许可证

MIT

Install Server
A
security – no known vulnerabilities
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fadlee/pocketbase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server