Token导航 LogoToken导航TokenDH.com
Pocketbase MCP logo
数据服务stdio官方级别未说明来源级核验

Pocketbase MCP

MCP Server

@smithery/cli

一个与PocketBase实例交互的MCP服务器,提供记录管理、文件操作、集合管理等功能。适用于需要自动化管理PocketBase数据的开发场景。

工具数

0

提示词数

0

GitHub Stars

36

资源数

0
数据分析TypeScriptClaude开发工具Claude DesktopClaudeCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

mabeldata

提供方

mabeldata

最后核验

2026/5/17 20:48

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx -y @smithery/cli install @mabeldata/pocketbase-mcp --client claude

详细介绍

PocketBase MCP服务器

](https://smithery.ai/server/@mabeldata/pocketbase-mcp) ![Maintained_By Mabel Data](https://github.com/mabeldata/pocketbase-mcp/blob/main/LICENSE)

这是一个与PocketBase实例交互的MCP服务器。它允许您在PocketBase集合中获取、列出、创建、更新和管理记录和文件。

安装

通过Smithery安装

通过以下方式自动安装适用于Claude Desktop的PocketBase MCP服务器 史密瑟里:

npx -y @smithery/cli install @mabeldata/pocketbase-mcp --client claude
  1. 克隆存储库(如果您还没有):
   git clone 
   cd pocketbase-mcp
  1. 安装依赖项:
   npm install
  1. 构建服务器:
   npm run build

这将TypeScript代码编译为JavaScript build/ 目录,并使入口点可执行。

配置

此服务器需要设置以下环境变量:

  • POCKETBASE_API_URL:PocketBase实例的URL(例如。, http://127.0.0.1:8090).默认为 http://127.0.0.1:8090 如果没有设置。
  • POCKETBASE_ADMIN_TOKEN:PocketBase实例的管理员身份验证令牌。 这是必需的。 您可以从PocketBase管理UI生成此内容,请参阅 API密钥.

在将服务器添加到Cline时,需要配置这些变量(请参阅Cline安装部分)。

可用工具

服务器提供以下按类别组织的工具:

记录管理

  • fetch_record:按ID从PocketBase集合中获取单个记录。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "id": {
          "type": "string",
          "description": "The ID of the record to fetch."
        }
      },
      "required": [
        "collection",
        "id"
      ]
    }
  • list_records:列出PocketBase集合中的记录。支持分页、过滤、排序和扩展关系。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "page": {
          "type": "number",
          "description": "Page number (defaults to 1).",
          "minimum": 1
        },
        "perPage": {
          "type": "number",
          "description": "Items per page (defaults to 25).",
          "minimum": 1,
          "maximum": 100
        },
        "filter": {
          "type": "string",
          "description": "Filter string for the PocketBase query."
        },
        "sort": {
          "type": "string",
          "description": "Sort string for the PocketBase query (e.g., \\"fieldName,-otherFieldName\\")."
        },
        "expand": {
          "type": "string",
          "description": "Expand string for the PocketBase query (e.g., \\"relation1,relation2.subRelation\\")."
        }
      },
      "required": [
        "collection"
      ]
    }
  • create_record:在PocketBase集合中创建新记录。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "data": {
          "type": "object",
          "description": "The data for the new record.",
          "additionalProperties": true
        }
      },
      "required": [
        "collection",
        "data"
      ]
    }
  • update_record:更新PocketBase集合中的现有记录。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "id": {
          "type": "string",
          "description": "The ID of the record to update."
        },
        "data": {
          "type": "object",
          "description": "The data to update.",
          "additionalProperties": true
        }
      },
      "required": [
        "collection",
        "id",
        "data"
      ]
    }
  • get_collection_schema:获取PocketBase集合的架构。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        }
      },
      "required": [
        "collection"
      ]
    }
  • 上传文件:将文件上传到PocketBase收集记录中的特定字段。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "recordId": {
          "type": "string",
          "description": "The ID of the record to upload the file to."
        },
        "fileField": {
          "type": "string",
          "description": "The name of the file field in the PocketBase collection."
        },
        "fileContent": {
          "type": "string",
          "description": "The content of the file to upload."
        },
        "fileName": {
          "type": "string",
          "description": "The name of the file."
        }
      },
      "required": [
        "collection",
        "recordId",
        "fileField",
        "fileContent",
        "fileName"
      ]
    }
  • list_collections:列出PocketBase实例中的所有集合。

- *输入架构*:

    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  • 下载文件:获取存储在PocketBase集合记录中的文件的下载URL。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        },
        "recordId": {
          "type": "string",
          "description": "The ID of the record to download the file from."
        },
        "fileField": {
          "type": "string",
          "description": "The name of the file field in the PocketBase collection."
        },
        "downloadPath": {
          "type": "string",
          "description": "The path where the downloaded file should be saved (Note: This tool currently returns the URL, download must be handled separately)."
        }
      },
      "required": [
        "collection",
        "recordId",
        "fileField",
        "downloadPath"
      ]
    }

*注意:此工具返回文件URL。实际下载需要由客户端使用此URL执行。*

收集管理

  • list_collections:列出PocketBase实例中的所有集合。

- *输入架构*:

    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  • get_collection_schema:获取PocketBase集合的架构。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The name of the PocketBase collection."
        }
      },
      "required": [
        "collection"
      ]
    }

日志管理

注: Logs API需要管理员身份验证,并且可能无法在所有PocketBase实例或配置中使用。这些工具与PocketBase Logs API交互,如https://pocketbase.io/docs/api-logs/.
  • list_logs:列出PocketBase的API请求日志,包括筛选、排序和分页。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "page": {
          "type": "number",
          "description": "Page number (defaults to 1).",
          "minimum": 1
        },
        "perPage": {
          "type": "number",
          "description": "Items per page (defaults to 30, max 500).",
          "minimum": 1,
          "maximum": 500
        },
        "filter": {
          "type": "string",
          "description": "PocketBase filter string (e.g., \"method='GET'\")."
        }
      },
      "required": []
    }
  • get_log:按ID获取单个API请求日志。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the log to fetch."
        }
      },
      "required": [
        "id"
      ]
    }
  • get_logs_stats:使用可选筛选获取API请求日志统计信息。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "filter": {
          "type": "string",
          "description": "PocketBase filter string (e.g., \"method='GET'\")."
        }
      },
      "required": []
    }

Cron作业管理

注: Cron Jobs API需要管理员身份验证,并且可能无法在所有PocketBase实例或配置中使用。这些工具与PocketBaseCronJobsneneneba API交互。
  • list_cron_jobs:返回所有已注册的应用程序级cron作业的列表。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "fields": {
          "type": "string",
          "description": "Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.:?fields=*,expand.relField.name"
        }
      }
    }
  • run_cron_job:通过id触发单个cron作业。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string",
          "description": "The identifier of the cron job to run."
        }
      },
      "required": [
        "jobId"
      ]
    }

迁移管理

  • set_migrations_directory:设置创建和读取迁移文件的目录。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "customPath": { 
          "type": "string", 
          "description": "Custom path for migrations. If not provided, defaults to 'pb_migrations' in the current working directory." 
        }
      }
    }
  • 创建迁移:使用带时间戳的名称创建一个新的空PocketBase迁移文件。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "description": { 
          "type": "string", 
          "description": "A brief description for the migration filename (e.g., 'add_user_email_index')." 
        }
      },
      "required": ["description"]
    }
  • create_collection_migration:创建一个专门用于创建新PocketBase集合的迁移文件。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "description": { 
          "type": "string", 
          "description": "Optional description override for the filename." 
        },
        "collectionDefinition": {
          "type": "object",
          "description": "The full schema definition for the new collection (including name, id, fields, rules, etc.).",
          "additionalProperties": true
        }
      },
      "required": ["collectionDefinition"]
    }
  • add_field_migration:创建一个迁移文件,用于向现有集合中添加字段。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "collectionNameOrId": { 
          "type": "string", 
          "description": "The name or ID of the collection to update." 
        },
        "fieldDefinition": {
          "type": "object",
          "description": "The schema definition for the new field.",
          "additionalProperties": true
        },
        "description": { 
          "type": "string", 
          "description": "Optional description override for the filename." 
        }
      },
      "required": ["collectionNameOrId", "fieldDefinition"]
    }
  • list_migrations:列出PocketBase迁移目录中的所有迁移文件。

- *输入架构*:

    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  • 应用程序_迁移:应用特定的迁移文件。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "migrationFile": { 
          "type": "string", 
          "description": "Name of the migration file to apply." 
        }
      },
      "required": ["migrationFile"]
    }
  • 恢复迁移:还原特定的迁移文件。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "migrationFile": { 
          "type": "string", 
          "description": "Name of the migration file to revert." 
        }
      },
      "required": ["migrationFile"]
    }
  • 申请_所有_移民:应用所有待处理的迁移。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "appliedMigrations": { 
          "type": "array", 
          "items": { "type": "string" },
          "description": "Array of already applied migration filenames." 
        }
      }
    }
  • 恢复到迁移状态:将迁移还原到特定目标。

- *输入架构*:

    {
      "type": "object",
      "properties": {
        "targetMigration": { 
          "type": "string", 
          "description": "Name of the migration to revert to (exclusive). Use empty string to revert all." 
        },
        "appliedMigrations": { 
          "type": "array", 
          "items": { "type": "string" },
          "description": "Array of already applied migration filenames." 
        }
      },
      "required": ["targetMigration"]
    }

迁移系统

PocketBase MCP Server包括一个用于管理数据库模式更改的全面迁移系统。该系统允许您:

  1. 创建带有时间戳名称的迁移文件
  2. 为常见操作(创建集合、添加字段)生成迁移
  3. 单独或批量应用和恢复迁移
  4. 跟踪已应用的迁移

迁移文件格式

迁移文件是带有时间戳前缀和描述性名称的JavaScript文件:

// 1744005374_update_transactions_add_debt_link.js
/// 
migrate((app) => {
  // Up migration code here
  return app.save();
}, (app) => {
  // Down migration code here
  return app.save();
});

每次迁移都有一个用于应用更改的“向上”功能和一个用于恢复更改的“向下”功能。

使用示例

设置自定义迁移目录:

await setMigrationsDirectory("./my_migrations");

创建基本迁移:

await createNewMigration("add_user_email_index");

创建集合迁移:

await createCollectionMigration({
  id: "users",
  name: "users",
  fields: [
    { name: "email", type: "email", required: true }
  ]
});

向集合中添加字段:

await createAddFieldMigration("users", {
  name: "address",
  type: "text"
});

应用迁移:

// Apply a specific migration
await applyMigration("1744005374_update_transactions_add_debt_link.js", pocketbaseInstance);

// Apply all pending migrations
await applyAllMigrations(pocketbaseInstance);

还原迁移:

// Revert a specific migration
await revertMigration("1744005374_update_transactions_add_debt_link.js", pocketbaseInstance);

// Revert to a specific point (exclusive)
await revertToMigration("1743958155_update_transactions_add_relation_to_itself.js", pocketbaseInstance);

// Revert all migrations
await revertToMigration("", pocketbaseInstance);

Cline安装

要将此服务器与Cline一起使用,您需要将其添加到MCP设置文件中(cline_mcp_settings.json).

  1. 找到您的Cline MCP设置文件:

- 通常发现于 ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json 在Linux/macOS上。 - 或 ~/Library/Application Support/Claude/claude_desktop_config.json 如果在macOS上使用Claude桌面应用程序。

  1. 编辑文件并在下添加以下配置 mcpServers 钥匙。 替换 /path/to/pocketbase-mcp 使用系统上此项目目录的实际绝对路径。此外,更换 `` 使用您的实际PocketBase URL和管理员令牌。
   {
     "mcpServers": {
       // ... other servers might be listed here ...

       "pocketbase-mcp": {
         "command": "node",
         "args": ["/path/to/pocketbase-mcp/build/index.js"],
         "env": {
           "POCKETBASE_API_URL": "", // e.g., "http://127.0.0.1:8090"
           "POCKETBASE_ADMIN_TOKEN": ""
         },
         "disabled": false, // Ensure it's enabled
         "autoApprove": [
           "fetch_record",
           "list_collections",
           "get_collection_schema",
           "list_logs",
           "get_log",
           "get_logs_stats",
           "list_cron_jobs",
           "run_cron_job"
         ] // Suggested auto-approve settings
       }

       // ... other servers might be listed here ...
     }
   }
  1. 保存设置文件。 Cline应自动检测更改并连接到服务器。然后,您可以使用上面列出的工具。

依赖项

  • @modelcontextprotocol/sdk
  • pocketbase
  • typescript
  • ts-node (开发依赖性)
  • @types/node (开发依赖性)

目录标签

目录标签

数据分析TypeScriptClaude开发工具数据库管理本地部署记录操作文件存储API集成

支持客户端

Claude DesktopClaudeCline

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

部署方式(deploymentType,部署类型)

remote-capable

来源包(packageName,安装包名)

@smithery/cli

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononeremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP