pocketbase-mcp

pocketbase-mcp

A Model Context Protocol server that provides AI assistants like Claude with full access to PocketBase backends through natural language. It enables CRUD operations on records, collection management, authentication, file handling, and database administration via a Pythonic interface.

Category
访问服务器

README

pocketbase-mcp

A Model Context Protocol (MCP) server for PocketBase — giving AI assistants like Claude full access to your PocketBase backend through a clean, Pythonic interface.


Overview

pocketbase-mcp bridges the gap between LLMs and your PocketBase instance. Once connected, AI assistants can list collections, perform CRUD operations on records, manage authentication, handle file uploads, and administer your database — all through natural language.

Built with FastMCP (the standard Python MCP framework) and httpx for async HTTP communication with the PocketBase REST API.


Features

  • Records — list, get, create, update, delete, and batch-operate on records in any collection
  • Collections — list, inspect, create, update, and delete collection schemas
  • Authentication — authenticate as a superuser or regular user via email/password or API key
  • Files — generate file tokens and retrieve file URLs with optional image transformations
  • Settings — read and update application settings
  • Filtering & Pagination — pass PocketBase filter expressions, sort, expand, and pagination params directly
  • Realtime-aware — designed with SSE subscription patterns in mind for future extension

Requirements

  • Python 3.11+
  • A running PocketBase instance (local or remote)
  • uv (recommended) or pip

Installation

Using pip

pip install pocketbase-mcp

Configuration

The server is configured via environment variables:

Variable Required Default Description
POCKETBASE_URL Yes — Base URL of your PocketBase instance (e.g. http://127.0.0.1:8090)
POCKETBASE_SUPERUSER_EMAIL No — Superuser email for admin operations
POCKETBASE_SUPERUSER_PASSWORD No — Superuser password
POCKETBASE_API_KEY No — Long-lived API key (alternative to email/password)

Set them in a .env file or export directly:

export POCKETBASE_URL=http://127.0.0.1:8090
export POCKETBASE_SUPERUSER_EMAIL=admin@example.com
export POCKETBASE_SUPERUSER_PASSWORD=your-password

Running the Server

stdio transport (default — for Claude Desktop, Claude Code, etc.)

pocketmcp

<!-- ### Streamable HTTP transport (for remote/multi-client setups)

uv run server.py --transport streamable-http --port 8000
``` -->

### With MCP Inspector (for development and testing)

```bash
# Terminal 1
pocketmcp

# Terminal 2
npx @modelcontextprotocol/inspector
# Connect to: http://localhost:8000/mcp

Connecting to Claude

Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "pocketbase": {
      "command": "uv",
      "args": ["run", "/absolute/path/to/pocketbase-mcp/server.py"],
      "env": {
        "POCKETBASE_URL": "http://127.0.0.1:8090",
        "POCKETBASE_SUPERUSER_EMAIL": "admin@example.com",
        "POCKETBASE_SUPERUSER_PASSWORD": "your-password"
      }
    }
  }
}

Available Tools

Records

Tool Description
list_records List records in a collection with filtering, sorting, and pagination
get_record Get a single record by ID
create_record Create a new record
update_record Update an existing record
delete_record Delete a record by ID
batch_records Perform multiple create/update/upsert/delete operations in one request

Collections

Tool Description
list_collections List all collections
get_collection Get a collection schema by name or ID
create_collection Create a new collection with fields and API rules
update_collection Update a collection's schema or rules
delete_collection Delete a collection

Authentication

Tool Description
auth_with_password Authenticate a user or superuser with email and password
auth_with_api_key Authenticate using a long-lived API key
get_auth_store Return the current authentication state

Files

Tool Description
get_file_url Generate the URL for a file attached to a record
create_file_token Create a short-lived token for accessing protected files

Settings

Tool Description
get_settings Retrieve all application settings
update_settings Update application settings

Project Structure

pocketbase-mcp/
├── server.py            # MCP server entry point (FastMCP)
├── tools/
│   ├── records.py       # Record CRUD tools
│   ├── collections.py   # Collection management tools
│   ├── auth.py          # Authentication tools
│   ├── files.py         # File tools
│   └── settings.py      # Settings tools
├── client.py            # Async PocketBase HTTP client (httpx)
├── config.py            # Environment variable loading
├── pyproject.toml
└── README.md

Example Usage

Once connected to Claude, you can interact with your PocketBase instance through natural language:

"List all records in the posts collection where status = 'published', sorted by created descending."

"Create a new record in users with name 'Alice' and role 'editor'."

"Show me the schema for the products collection."

"Delete the record with ID ae40239d2bc4477 from comments."

"Update the app name in PocketBase settings to 'My App'."


PocketBase Compatibility

This MCP server targets PocketBase v0.36.9+. The batch API requires it to be explicitly enabled in your PocketBase Dashboard under Settings → Application.


Security Notes

  • Never commit credentials to version control. Use environment variables or a .env file (add .env to .gitignore).
  • For production deployments, prefer API key authentication over email/password.
  • Collection API rules in PocketBase govern what the authenticated user can actually access — pocketbase-mcp respects these rules.

Contributing

Contributions are welcome! Please open an issue before submitting a pull request for significant changes.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-feature)
  3. Commit your changes
  4. Open a pull request

License

MIT License. See LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选