Self-hosted: Database model validation fails on missing policies/archives fields
- Dominant language
- Python
- Stars
- 72
- Forks
- 18
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 16
Description
## 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`:
```python
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
Contributor guide
Research direction
Start with appwrite/models/database.py and the validate_services -> tables_db.list() startup probe; compare the Database fields with the self-hosted response described. Confirm that omitted policies and archives are accepted without breaking Cloud responses, then verify the startup validation succeeds against a self-hosted instance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100