pocketbase-mcp

pocketbase-mcp

Enables AI assistants to perform CRUD operations on Pocketbase collections, manage authentication, and query logs via a type-safe API.

Category
Visit Server

README

Pocketbase MCP Server

MCP (Model Context Protocol) server for Pocketbase - enables AI assistants to interact with Pocketbase backend through a clean, type-safe API.

Features

  • šŸ” Silent Authentication - Automatic authentication with retry logic
  • šŸ“¦ Full CRUD Operations - Complete record management
  • šŸ” Advanced Querying - Filtering, sorting, pagination, field selection
  • šŸ“Š Collections Management - List and inspect collections
  • šŸ“ Logs Access - Query system logs with filters
  • šŸ›”ļø Type Safety - Full TypeScript support with Zod validation
  • šŸ—ļø Clean Architecture - Layered design for easy maintenance

Installation

# Install dependencies
pnpm install

# Build the project
pnpm build

Configuration

Environment Variables

Create a .env file in the project root:

POCKETBASE_URL=https://your-pocketbase-instance.com
POCKETBASE_IDENTITY=your-email@example.com
POCKETBASE_PASSWORD=your-password

MCP Client Configuration

Add to your MCP client config (e.g., Claude Desktop):

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "pocketbase": {
      "command": "node",
      "args": ["path/to/pocketbase-mcp/dist/index.js"],
      "env": {
        "POCKETBASE_URL": "https://your-pocketbase-instance.com",
        "POCKETBASE_IDENTITY": "your-email@example.com",
        "POCKETBASE_PASSWORD": "your-password"
      }
    }
  }
}

Available Tools

1. pocketbase_auth (Optional)

Authenticate with Pocketbase. Note: Authentication is handled automatically for other tools.

pocketbase_auth({
  pocketbaseUrl?: string,
  identity?: string,
  password?: string
})

2. pocketbase_list_collections

List all collections from Pocketbase.

pocketbase_list_collections({
  page?: number,        // default: 1
  perPage?: number,     // default: 500
  skipTotal?: number    // default: 1
})

3. pocketbase_list_records

List records from a collection with filtering and pagination.

pocketbase_list_records({
  collection: string,   // required
  page?: number,
  perPage?: number,     // default: 30, max: 500
  sort?: string,        // e.g., "-created,name"
  filter?: string,      // e.g., 'status="active"'
  expand?: string,      // e.g., "user,category"
  fields?: string,      // e.g., "id,name,email"
  skipTotal?: number
})

4. pocketbase_get_record

Get a single record by ID.

pocketbase_get_record({
  collection: string,   // required
  id: string,          // required
  expand?: string,
  fields?: string
})

5. pocketbase_create_record

Create a new record in a collection.

pocketbase_create_record({
  collection: string,   // required
  data: object,        // required - record data
  expand?: string,
  fields?: string
})

6. pocketbase_update_record

Update an existing record.

pocketbase_update_record({
  collection: string,   // required
  id: string,          // required
  data: object,        // required - fields to update
  expand?: string,
  fields?: string
})

7. pocketbase_delete_record

Delete a record from a collection.

pocketbase_delete_record({
  collection: string,   // required
  id: string           // required
})

8. pocketbase_list_logs

Query system logs with filtering and pagination.

pocketbase_list_logs({
  page?: number,
  perPage?: number,     // default: 50, max: 500
  sort?: string,
  filter?: string,      // e.g., '(message ~ "error")'
  skipTotal?: number    // default: 1
})

Architecture

The project follows a clean, layered architecture:

src/
ā”œā”€ā”€ index.ts              # MCP server entry point
ā”œā”€ā”€ config/               # Environment configuration
ā”œā”€ā”€ types/                # TypeScript type definitions
ā”œā”€ā”€ schemas/              # Zod validation schemas
ā”œā”€ā”€ utils/                # Error handling & response formatting
ā”œā”€ā”€ client/               # HTTP client & authentication manager
ā”œā”€ā”€ repositories/         # Data access layer
ā”œā”€ā”€ services/             # Business logic layer
ā”œā”€ā”€ handlers/             # MCP request handlers
└── tools/                # Tool definitions registry

Design Patterns

  • Repository Pattern: Separates data access from business logic
  • Service Pattern: Encapsulates business logic
  • Singleton Pattern: For HTTP client and auth manager
  • Template Method: Base classes for common functionality
  • Dependency Injection: Services injected into handlers

Development

# Run in development mode
pnpm dev

# Build for production
pnpm build

# Start production server
pnpm start

License

ISC

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured