# Appwrite 智能数据库协议
## 基本信息
- Slug: `appwrite-mcp`
- Source: modelscope
- Publisher: @appwrite/mcp
- Categories: databases / cloud-platforms
- Hosted: No
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/@appwrite/mcp
## 简介
一个模型上下文协议服务器，允许AI助手与Appwrite的API进行交互，提供管理Appwrite项目中数据库、用户、函数、团队和其他资源的工具。
## 安装提示

```bash
然后，打开终端并运行以下命令 ### Linux 和 MacOS ```sh source .env ``` ### Windows #### 命令提示符 ```cmd for /f "tokens=1,2 delims==" %A in (.env) do set %A=%B ``` #### PowerShell ```powershell Get-Content .\.env | ForEach-Object { if ($_ -match '^(.*?)=(.*)$') { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process") } } ``` ## 安装 ### 使用 uv（推荐） 当使用 [`uv`](https://docs.astral.sh/uv/) 时，无需特定的安装步骤。我们将使用 [`uvx`](https://docs.astral.sh/uv/guides/tools/) 直接运行 *mcp-server-appwrite*。
```

## MCP Server 详情

# Appwrite MCP 服务器

<!-- 封面图片将在可用时放在这里 -->

<a href="https://glama.ai/mcp/servers/xkj2px7r0v">
  <img width="380" height="200" src="https://glama.ai/mcp/servers/xkj2px7r0v/badge" alt="Appwrite MCP 服务器" />
</a>

## 概述

一个用于与 Appwrite API 交互的 Model Context Protocol 服务器。该服务器提供了管理数据库、用户、函数、团队等功能的工具，以便在您的 Appwrite 项目中使用。

## 快速链接
- [配置](#configuration)
- [安装](#installation)
- IDE 集成：
  - [Claude Desktop](#usage-with-claude-desktop)
  - [Cursor](#usage-with-cursor)
  - [Windsurf 编辑器](#usage-with-windsurf-editor)
- [本地开发](#local-development)
- [调试](#debugging)

## 配置

> 在启动 MCP 服务器之前，您必须设置一个 [Appwrite 项目](https://cloud.appwrite.io/) 并创建一个具有所需权限范围的 API 密钥。

在工作目录中创建一个 `.env` 文件，并添加以下内容：

```env
APPWRITE_PROJECT_ID=your-project-id
APPWRITE_API_KEY=your-api-key
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
```


然后，打开终端并运行以下命令

### Linux 和 MacOS

```sh
source .env
```


### Windows

#### 命令提示符

```cmd
for /f "tokens=1,2 delims==" %A in (.env) do set %A=%B
```


#### PowerShell

```powershell
Get-Content .\.env | ForEach-Object {
  if ($_ -match '^(.*?)=(.*)$') {
    [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
  }
}
```


## 安装

### 使用 uv（推荐）
当使用 [`uv`](https://docs.astral.sh/uv/) 时，无需特定的安装步骤。我们将使用 [`uvx`](https://docs.astral.sh/uv/guides/tools/) 直接运行 *mcp-server-appwrite*。

```bash
uvx mcp-server-appwrite [args]
```


### 使用 pip

```bash
pip install mcp-server-appwrite
```
然后通过运行以下命令来启动服务器

```bash
python -m mcp_server_appwrite [args]
```


### 命令行参数

无论是 `uv` 还是 `pip` 的设置过程，都需要某些参数来为各种 Appwrite API 启用 MCP 工具。

> 当启用 MCP 工具时，工具的定义将传递给 LLM，这会占用模型可用上下文窗口中的令牌。因此，有效的上下文窗口会减少。
>
> 默认的 Appwrite MCP 服务器仅启用了 Databases 工具（我们最常用的 API），以保持在这些限制内。可以通过使用下面的标志来启用其他工具。

| 参数 | 描述 |
| --- | --- |
| `--databases` | 启用 Databases API |
| `--users` | 启用 Users API |
| `--teams` | 启用 Teams API |
| `--storage` | 启用 Storage API |
| `--functions` | 启用 Functions API |
| `--messaging` | 启用 Messaging API |
| `--locale` | 启用 Locale API |
| `--avatars` | 启用 Avatars API |
| `--all` | 启用所有 Appwrite API |

## 与 Claude Desktop 一起使用

在 Claude Desktop 应用程序中，打开应用程序的 **设置** 页面（在 Windows 上按 `CTRL + ,` 或在 MacOS 上按 `CMD + ,`），然后转到 **开发者** 标签页。点击 **编辑配置** 按钮将带您进入 `claude_desktop_config.json` 文件，在其中您必须添加以下内容：

```json
{
  "mcpServers": {
    "appwrite": {
      "command": "uvx",
      "args": [
        "mcp-server-appwrite"
      ],
      "env": {
        "APPWRITE_PROJECT_ID": "your-project-id",
        "APPWRITE_API_KEY": "your-api-key",
        "APPWRITE_ENDPOINT": "https://cloud.appwrite.io/v1" // Optional
      }
    }
  }
}

```


> 注意：如果您看到 `uvx ENOENT` 错误，请确保将 `uvx` 添加到系统环境变量 `PATH` 中，或者在配置文件中使用 `uvx` 安装的完整路径。

配置成功后，你应该能在 Claude Desktop 的可用服务器列表中看到该服务器。

![Claude Desktop 配置](images/claude-desktop-integration.png)

## 与 [Cursor](https://www.cursor.com/) 一起使用

前往 Cursor `设置 > MCP` 并点击 **添加新的 MCP 服务器**。选择类型为 `命令`，并将下面的命令添加到 **命令** 字段中。

- **MacOS**

```bash
env APPWRITE_API_KEY=your-api-key env APPWRITE_PROJECT_ID=your-project-id uvx mcp-server-appwrite
```


- **Windows**

```cmd
cmd /c SET APPWRITE_PROJECT_ID=your-project-id && SET APPWRITE_API_KEY=your-api-key && uvx mcp-server-appwrite
```


![Cursor 设置](./images/cursor-integration.png)

## 与 [Windsurf 编辑器](https://codeium.com/windsurf) 一起使用

前往 Windsurf `设置 > 级联 > 模型上下文协议 (MCP) 服务器` 并点击 **查看原始配置**。更新 `mcp_config.json` 文件以包含以下内容：

```json
{
  "mcpServers": {
    "appwrite": {
      "command": "uvx",
      "args": [
        "mcp-server-appwrite"
      ],
      "env": {
        "APPWRITE_PROJECT_ID": "your-project-id",
        "APPWRITE_API_KEY": "your-api-key",
        "APPWRITE_ENDPOINT": "https://cloud.appwrite.io/v1" // Optional
      }
    }
  }
}
```


![Windsurf 设置](./images/windsurf-integration.png)

## 本地开发

### 克隆仓库

```bash
git clone https://github.com/appwrite/mcp.git
```


### 安装 `uv`

- Linux 或 MacOS

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```


- Windows (PowerShell)

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```


### 准备虚拟环境

首先，创建一个虚拟环境。

```bash
uv venv
```


接下来，激活虚拟环境。

- Linux 或 MacOS

```bash
source .venv/bin/activate
```


- Windows

```powershell
.venv\Scripts\activate
```


### 运行服务器

```bash
uv run -v --directory ./ mcp-server-appwrite
```


## 调试

你可以使用 MCP 检查器来调试服务器。

```bash
npx @modelcontextprotocol/inspector \
  uv \
  --directory . \
  run mcp-server-appwrite
```


确保在运行检查器之前正确配置了你的 `.env` 文件。然后你可以在 `http://localhost:5173` 访问检查器。

## 许可证

此 MCP 服务器根据 MIT 许可证授权。这意味着你可以在遵守 MIT 许可证条款和条件的前提下自由使用、修改和分发软件。更多详情，请参见项目仓库中的 LICENSE 文件。

