Skip to main content
Glama
imatrixme

PocketBase MCP Server

by imatrixme

고급 PocketBase MCP 서버

대장간 배지 PocketBase 데이터베이스와의 상호 작용을 위한 정교한 도구를 제공하는 포괄적인 MCP 서버입니다. 이 서버는 모델 컨텍스트 프로토콜(MCP)을 통해 고급 데이터베이스 작업, 스키마 관리 및 데이터 조작을 지원합니다.

특징

컬렉션 관리

  • 사용자 정의 스키마를 사용하여 컬렉션을 만들고 관리합니다.

  • 데이터 보존을 통한 컬렉션 스키마 마이그레이션

  • 고급 인덱스 관리(생성, 삭제, 목록)

  • 스키마 검증 및 유형 안전성

  • 컬렉션 스키마 및 메타데이터 검색

기록 작업

  • 레코드에 대한 CRUD 작업

  • 필터링, 정렬 및 집계를 통한 고급 쿼리

  • 일괄 가져오기/내보내기 기능

  • 관계 확장 지원

  • 페이지 매김 및 커서 기반 탐색

사용자 관리

  • 사용자 인증 및 토큰 관리

  • 사용자 계정 생성 및 관리

  • 비밀번호 관리

  • 역할 기반 액세스 제어

  • 세션 처리

데이터베이스 작업

  • 데이터베이스 백업 및 복원

  • 다양한 내보내기 형식(JSON/CSV)

  • 데이터 마이그레이션 도구

  • 인덱스 최적화

  • 일괄 작업

Related MCP server: PocketBase MCP Server

사용 가능한 도구

컬렉션 관리

  • create_collection : 사용자 정의 스키마를 사용하여 새 컬렉션을 만듭니다.

  • get_collection_schema : 컬렉션에 대한 스키마 세부 정보를 가져옵니다.

  • migrate_collection : 데이터 보존을 통한 컬렉션 스키마 마이그레이션

  • manage_indexes : 컬렉션 인덱스를 생성, 삭제 또는 나열합니다.

기록 작업

  • create_record : 컬렉션에 새 레코드를 만듭니다.

  • list_records : 선택적 필터와 페이지 매김을 사용하여 레코드를 나열합니다.

  • update_record : 기존 레코드를 업데이트합니다

  • delete_record : 레코드 삭제

  • query_collection : 필터링, 정렬, 집계 기능이 있는 고급 쿼리

  • import_data : create/update/upsert 모드를 사용하여 컬렉션에 데이터 가져오기

사용자 관리

  • authenticate_user : 사용자를 인증하고 인증 토큰을 얻습니다.

  • create_user : 새로운 사용자 계정을 생성합니다

  • list_auth_methods : 사용 가능한 모든 인증 방법을 나열합니다.

  • authenticate_with_oauth2 : OAuth2로 사용자 인증

  • authenticate_with_otp : 일회용 비밀번호로 사용자를 인증합니다.

  • auth_refresh : 인증 토큰 새로 고침

  • request_verification : 이메일 인증 요청

  • confirm_verification : 토큰으로 이메일 검증을 확인합니다.

  • request_password_reset : 비밀번호 재설정 요청

  • confirm_password_reset : 토큰으로 비밀번호 재설정 확인

  • request_email_change : 이메일 변경 요청

  • confirm_email_change : 토큰으로 이메일 변경 확인

  • impersonate_user : 다른 사용자로 가장(관리자만 가능)

데이터베이스 작업

  • backup_database : 포맷 옵션을 사용하여 PocketBase 데이터베이스의 백업을 생성합니다.

  • import_data : 다양한 모드(create/update/upsert)로 데이터 가져오기

구성

서버에는 다음과 같은 환경 변수가 필요합니다.

선택적 환경 변수:

  • POCKETBASE_ADMIN_EMAIL : 특정 작업에 대한 관리자 이메일

  • POCKETBASE_ADMIN_PASSWORD : 관리자 비밀번호

  • POCKETBASE_DATA_DIR : 사용자 정의 데이터 디렉토리 경로

사용 예

컬렉션 관리

지엑스피1

고급 쿼리

// Query with filtering, sorting, and aggregation
await mcp.use_tool("pocketbase", "query_collection", {
  collection: "posts",
  filter: "created >= '2024-01-01'",
  sort: "-created",
  aggregate: {
    totalLikes: "sum(likes)",
    avgRating: "avg(rating)"
  },
  expand: "author,categories"
});

데이터 가져오기/내보내기

// Import data with upsert mode
await mcp.use_tool("pocketbase", "import_data", {
  collection: "posts",
  data: [
    {
      title: "First Post",
      content: "Hello World"
    },
    {
      title: "Second Post",
      content: "More content"
    }
  ],
  mode: "upsert"
});

// Backup database
await mcp.use_tool("pocketbase", "backup_database", {
  format: "json" // or "csv"
});

스키마 마이그레이션

// Migrate collection schema
await mcp.use_tool("pocketbase", "migrate_collection", {
  collection: "posts",
  newSchema: [
    {
      name: "title",
      type: "text",
      required: true
    },
    {
      name: "content",
      type: "text",
      required: true
    },
    {
      name: "tags",
      type: "json",
      required: false
    }
  ],
  dataTransforms: {
    // Optional field transformations during migration
    tags: "JSON.parse(oldTags)"
  }
});

인증 방법

// List available authentication methods
await mcp.use_tool("pocketbase", "list_auth_methods", {
  collection: "users"
});

// Authenticate with password
await mcp.use_tool("pocketbase", "authenticate_user", {
  email: "user@example.com",
  password: "securepassword",
  collection: "users"
});

// Authenticate with OAuth2
await mcp.use_tool("pocketbase", "authenticate_with_oauth2", {
  provider: "google",
  code: "auth_code_from_provider",
  codeVerifier: "code_verifier_from_pkce",
  redirectUrl: "https://your-app.com/auth/callback",
  collection: "users"
});

// Request password reset
await mcp.use_tool("pocketbase", "request_password_reset", {
  email: "user@example.com",
  collection: "users"
});

// Confirm password reset
await mcp.use_tool("pocketbase", "confirm_password_reset", {
  token: "verification_token",
  password: "new_password",
  passwordConfirm: "new_password",
  collection: "users"
});

// Refresh authentication token
await mcp.use_tool("pocketbase", "auth_refresh", {
  collection: "users"
});

오류 처리

모든 도구에는 자세한 오류 메시지와 함께 포괄적인 오류 처리 기능이 포함되어 있습니다. 오류는 올바르게 입력되며 다음을 포함합니다.

  • 잘못된 요청 오류

  • 인증 오류

  • 데이터베이스 작업 오류

  • 스키마 검증 오류

  • 네트워크 오류

유형 안전

서버에는 모든 작업에 대한 TypeScript 정의가 포함되어 있어 도구 사용 시 타입 안전성을 보장합니다. 각 도구의 입력 스키마는 엄격하게 타입 지정되고 검증됩니다.

모범 사례

  1. 항상 try/catch 블록을 사용하여 적절한 오류 처리를 사용하세요.

  2. 작업을 수행하기 전에 데이터를 검증하세요

  3. 더 나은 쿼리 성능을 위해 적절한 인덱스를 사용하세요

  4. 정기적으로 데이터베이스를 백업하세요

  5. 스키마 변경에 마이그레이션 사용

  6. 사용자 관리를 위한 보안 모범 사례를 따르세요

  7. 데이터베이스 성능 모니터링 및 최적화

개발

  1. 저장소를 복제합니다

  2. 종속성 설치: npm install

  3. .env.example``.env 로 복사하고 구성하세요.

  4. 빌드: npm run build

  5. PocketBase 인스턴스를 시작하세요

  6. MCP 서버는 자동으로 PocketBase 인스턴스에 연결됩니다.

Smithery를 통해 설치

Smithery를 통해 Claude Desktop용 PocketBase Server를 자동으로 설치하려면:

npx -y @smithery/cli install pocketbase-server --client claude

기여하다

  1. 저장소를 포크하세요

  2. 기능 브랜치 생성

  3. 변경 사항을 커밋하세요

  4. 지점으로 밀어 넣기

  5. 풀 리퀘스트 만들기

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access 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/imatrixme/pocketbase-mcp-server'

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