SP

ssakone/pb_mcp_server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

65 stars 3 forks 质量 71 趋势 0MIT

ssakone/pb_mcp_server 是一个从 https://github.com/ssakone/pb_mcp_server. 导入的 MCP 服务器候选

概览

ssakone/pb_mcp_server 是一个从 https://github.com/ssakone/pb_mcp_server. 导入的 MCP 服务器候选

概述(AI 翻译)

一台模型上下文协议(MCP)服务器,提供对 PocketBase 功能的全面访问。该服务器使 AI 助手和其他 MCP 客户端能够与 PocketBase 数据库交互,进行身份验证、数据管理和管理操作。

特色

  • 认证:管理员和用户认证,并结合会话管理
  • 会话持久性:将会话保存为saveSession参数的跨工具调用
  • 自动认证:启动时使用环境变量自动认证
  • 收藏管理:创建、更新、删除和查询收藏(仅管理员)
  • 记录 CRUD:记录的完整创建、读取、更新和删除操作
  • 用户管理:管理认证集合中的用户账户
  • 自定义头部:发送任意请求的自定义HTTP头部
  • 自定义HTTP请求:向任何PocketBase API端点发送原始HTTP请求
  • 查询支持:记录和用户的筛选、排序和分页
  • 错误处理:一致且信息丰富的错误响应
  • 多实例:支持连接多个PocketBase实例

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

PocketBase MCP Server

A Model Context Protocol (MCP) server that provides comprehensive access to PocketBase functionality. This server enables AI assistants and other MCP clients to interact with PocketBase databases for authentication, data management, and administrative operations.

Features

  • Authentication: Admin and user authentication with session management
  • Session Persistence: Save sessions across tool calls with saveSession parameter
  • Auto-Authentication: Automatically authenticate at startup using environment variables
  • Collection Management: Create, update, delete, and query collections (admin only)
  • Record CRUD: Full create, read, update, delete operations on records
  • User Management: Manage user accounts in auth collections
  • Custom Headers: Send custom HTTP headers with any request
  • Custom HTTP Requests: Send raw HTTP requests to any PocketBase API endpoint
  • Query Support: Filtering, sorting, and pagination for records and users
  • Error Handling: Consistent, informative error responses
  • Multi-Instance: Support for connecting to multiple PocketBase instances
  • TOON Output Format: Optional TOON format for 30-60% token reduction with LLMs

Installation

# Clone the repository
git clone https://github.com/ssakone/pocketbase-mcp-server.git
cd pocketbase-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Environment Variables

Create a .env file or set environment variables:

# PocketBase server URL (default: http://127.0.0.1:8090)
POCKETBASE_URL=http://127.0.0.1:8090

# Admin token for authenticated operations (optional - can be provided per-request)
POCKETBASE_ADMIN_TOKEN=your_admin_token_here

# Auto-authentication at startup (optional)
# If both are provided, the server will authenticate and obtain a token automatically
[email protected]
POCKETBASE_ADMIN_PASSWORD=your_admin_password

# Output format: json (default) or toon
# TOON format reduces token usage by 30-60% when communicating with LLMs
MCP_OUTPUT_FORMAT=json

Configuration File

Alternatively, create a pocketbase.config.json:

{
  "pocketbaseUrl": "http://127.0.0.1:8090",
  "pocketbaseAdminToken": "your_admin_token_here"
}

Running the Server

stdio Mode (for MCP clients like Cursor, Kiro)

npm start

HTTP/SSE Mode (for web clients and remote access)

# Default port 3001
npm run start:http

# Custom port
PORT=8080 npm run start:http

The HTTP server exposes an SSE endpoint at http://localhost:3001/sse.

MCP Client Configuration

Cursor/Kiro Configuration

Add to your MCP configuration:

{
  "mcpServers": {
    "pocketbase": {
      "command": "npm",
      "args": ["start"],
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "pocketbase": { "command": "npm", "args": ["start"], "cwd": "/path/to/pocketbase-mcp-server", "env": { "POCKETBASE_URL": "http://127.0.0.1:8090", "POCKETBASE_ADMIN_EMAIL": "[email protected]", "POCKETBASE_ADMIN_PASSWORD": "your_password" } } } }