Skip to content

Self-hosted: Database model validation fails on missing policies/archives fields #52

Description

@CodeCraftsman-Jr

Description

The mcp-server-appwrite package (v0.8.1) depends on the appwrite Python SDK 21.0.0+, whose Database Pydantic model requires policies (List[BackupPolicy]) and archives (List[BackupArchive]) as mandatory fields. Self-hosted Appwrite instances (including the latest stable v1.9.5) do not return these Cloud-only fields in the database list response (GET /tablesdb).

Impact

The MCP server's startup validation (validate_services -> tables_db.list()) fails immediately with:

RuntimeError: Appwrite startup validation failed during the minimal startup probe.
- tables_db: Unable to parse response into DatabaseList: 6 validation errors for DatabaseList
databases.0.policies
  Field required
databases.0.archives
  Field required

This makes the MCP server completely unusable on self-hosted Appwrite instances.

Steps to Reproduce

  1. Run a self-hosted Appwrite instance (tested on v1.9.0 and v1.9.5 stable)
  2. Set up the MCP server with self-hosted config per docs/self-hosted.md
  3. Start the MCP server -> validation fails on tables_db

Workaround

Making policies and archives fields Optional in the Database model resolves the issue. We are currently using a wrapper script that monkey-patches the model at import time.

Suggested Fix

Make the policies and archives fields in appwrite/models/database.py optional with a default of None:

policies: Optional[List[BackupPolicy]] = Field(default=None, alias='policies')
archives: Optional[List[BackupArchive]] = Field(default=None, alias='archives')

This is backward-compatible since Cloud instances always return these fields, and self-hosted instances simply omit them.

Environment

  • Appwrite version: 1.9.5 stable (self-hosted)
  • mcp-server-appwrite: 0.8.1
  • appwrite Python SDK: 21.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions