Supercharge Your Appwrite Backend with MCP Server: Practical Examples Using Cursor

Recently, Appwrite announced its new MCP (Model Context Protocol) server, and after spending some time experimenting with it, I decided to share a few practical examples to show you how it works and how you can leverage it potentials. In this article, I'll walk you through some key use cases that demonstrate the capabilities of the Appwrite MCP server.

This blog post is based on a guide by Denis Ivy a Developer Advocate at Appwrite. You can find the original videos below:


What Is an MCP Server?

Before we dive into the examples, here’s a brief explanation of what an MCP server is. Appwrite's MCP server allows you to easily connect an MCP host (like Claude, Wind Surf, or Cursor) to your Appwrite backend. Once connected, the AI agent can interact with your app's backend, perform tasks, and make core changes without the need to manually integrate custom APIs or logic.


Setting Up the MCP Server

To get started, you’ll need to configure the MCP server with your preferred AI host. For this demonstration, I’ll use Cursor, but you can use other hosts such as Wind Surf or Claude as well.

Setting up an Appwrite MCP server with Cursor can be done in just a few minutes, allowing you to seamlessly integrate with your backend and begin interacting with it via an AI agent. In this guide, we'll walk through the setup process step by step.


Prerequisites

Make sure you have UV installed. This package manager is required to run the MCP server.

For macOS and Linux: You can install UV using the following command:

curl -sSf https://astral.sh/uv/install.sh | sh

For Windows: Run this PowerShell command to install UV:

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

Alternatively, you can install UVX using pip, Homebrew, or other methods. For more options, check the official UV installation guide.


Configure Cursor with MCP

Step 1: Open Cursor

Go to the Settings tab, then click on the MCP section.

Step 2: Add MCP Server

  • Click Add New Global MCP Server.

  • macOS Users When you click "Add New Global MCP Server", macOS users get a modal (form) with these fields:

    • Name: Just a label for the server (e.g., Appwrite)

    • Type: Choose Command

    • Command: Paste the full shell command here.

        env APPWRITE_API_KEY=your-api-key env APPWRITE_PROJECT_ID=your-project-id uvx mcp-server-appwrite --databases --users
      
  • Windows Users

    On Windows, clicking "Add New Global MCP Server" opens the mcp.json file instead of a modal form. You’ll need to configure the MCP server by manually editing this file.

    So, instead of a shell command, you structure it as JSON:

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

Step 3: Add API Key and Project ID

  1. Navigate to your Appwrite Console and go to your project. If you don't have a project yet, click on "Create Project" to set one up. Enter a name for your project and choose your preferred region.

  2. Create an API Key:

    • Navigate to Overview > Integration > API keys and click “Create API key”.

    • Enter a name for the API key (e.g., MCP Server Key) and select an expiration date.

    • In the scopes section you can click ”select all” to grant all permissions, or you can select some specific ones based on your needs.

Note: You can always create multiple keys with different sets of permissions depending on the level of access you want to grant the key.

  1. Copy the API Key:

    • Once the key is created, copy the secret API key to use it in your MCP server setup.
  2. Get Your Project ID:

    • Go to your Appwrite project dashboard.

    • On the Overview page, you’ll find your Project ID at the top.

    • Copy this ID for use in the configuration of the MCP server.

  3. Replace Values in the Config:

    • Replace your-api-key with the API Key you copied earlier.

    • Replace your-project-id with the Project ID you copied from the Appwrite console.

Step 4: Save and Restart

  • On macOS: Click Add to save the MCP config.

  • On Windows: Press Ctrl + S to save your mcp.json.

Note: You’ve currently enabled only the --users and --databases API. You can enable more Appwrite APIs by editing the mcp.json file in your cursor settings and updating the args list:

ArgumentDescription
--databasesEnables Database API
--usersEnables Users API
--teamsEnables Teams API
--storageEnables Storage API
--functionsEnables Functions API
--messagingEnables Messaging API
--localeEnables Locale API
--avatarsEnables Avatars API
--allEnables all APIs

Testing the MCP Server

After setting everything up, it's a good idea to restart Cursor to ensure all changes take effect. Once that's done, you can test the MCP server's functionality by querying your Appwrite database.

Interacting with the Database and Making Core Changes to the Application

Once the AI agent is connected, you can begin querying and interacting with your database. What if you need to create new collections or modify your app’s structure? The AI can help here too.

Now that your MCP server is configured, let's explore what it can do.

For instance, if you have a products collection in a dev database, you can ask your AI agent to list all items in this collection.

The AI will attempt to list the products from the collection, and you should see a successful response with the list of items from your backend.

Practical Examples

Example 1: Create a Database

You can start by asking the AI:

“Create a new database named Dev.”

The AI will generate and run the necessary command through MCP, creating a new database called Dev in your Appwrite project.


Example 2: Create a Table of Orders

Next, ask the AI:

“Create a new collection called Orders in the Dev database with attributes like item name, quantity, and total amount.”

The AI will handle this by setting up a new collection named Orders, and it will define the necessary attributes so you can start adding records to it right away.


Example 3: Add Items to the Table

Now let’s populate the Orders table. Tell the AI:

“Add 20 items to the Orders collection. Make sure some orders have an amount greater than $100, and others below that.”

The AI will automatically generate mock data based on your instructions and insert it into the Orders collection. For example, it might create entries like:

{
  "item": "Wireless Mouse",
  "quantity": 2,
  "amount": 45.00
}

or

{
  "item": "Laptop",
  "quantity": 1,
  "amount": 1200.00
}

This gives you a balanced dataset for testing and analysis.


Example 4: List Items in the Table

To verify the data, ask the AI:

“How many items are in the Orders collection?”

The AI will first show a preview of the query it’s going to run. Once you confirm, it executes the command and responds with the result for example:

“There are 20 items in the Orders collection.”

This confirms that the data was successfully inserted and is accessible.


Example 5: Exporting Data to a CSV

Let’s say you want to export certain data from the database. Specifically, you want to export orders with a total greater than $100. You can tell the AI:

"Export all orders where the amount is greater than 100 dollars to a CSV file."

The AI starts by summarizing the steps it will take, such as filtering the orders based on the total value. For example, it might say:

"I will filter orders with total > 100, generate a Python script, and export the results as CSV."

After running the command, the AI generates a Python script to produce the filtered CSV. It successfully exports the high-value orders into a CSV file containing only those that meet the criteria.


Example 6: Creating a New Collection

Let’s say you want to create a new collection for products in your app. Normally, you’d create the collection manually by specifying the collection name and adding attributes. With the MCP server, you can just tell the AI:

"Create a new collection called Products with attributes: name, price, image, and description."

The AI will do so, assigning the correct data types for each attribute. For example:

{
  "name": "Bluetooth Speaker",
  "price": 59.99,
  "image": "speaker.jpg",
  "description": "Portable Bluetooth speaker with deep bass."
}

If any adjustments are needed later, you can always modify the collection through the app interface.


Example 7: Importing Data

Now, let’s add some real product data to your new Products collection. If you have a CSV file containing product information, you can simply tell the AI:

"Import data from products.csv into the Products collection."

The AI processes the file, validates the data, and imports the information into the collection. It will also notify you if any fields are missing or if there are issues with the formatting. This makes the data import process seamless, especially when dealing with large datasets compare to manual.

Here’s an example of what the products.csv might look like:

id,name,description,price,category,image_url,stock
1,Wireless Mouse,Ergonomic wireless mouse with 2.4GHz connectivity,25.99,Electronics,/images/mouse.jpg,120
2,Mechanical Keyboard,RGB backlit mechanical keyboard,59.99,Electronics,/images/keyboard.jpg,80
3,Cotton T-Shirt,100% cotton plain t-shirt,9.99,Apparel,/images/tshirt.jpg,250
4,Stainless Steel Water Bottle,Reusable water bottle (1L),15.00,Home & Kitchen,/images/water-bottle.jpg,75
5,Running Shoes,Breathable lightweight running shoes,49.99,Sports,/images/shoes.jpg,60
6,Laptop Backpack,Multi-compartment waterproof laptop backpack,39.99,Accessories,/images/backpack.jpg,95
7,LED Desk Lamp,Adjustable brightness with USB charging port,19.99,Home & Office,/images/lamp.jpg,50
8,Bluetooth Speaker,Portable speaker with deep bass,29.99,Electronics,/images/speaker.jpg,110
9,Ceramic Mug,Microwave-safe printed mug,7.50,Home & Kitchen,/images/mug.jpg,200
10,Fitness Tracker,Tracks steps, heart rate, and sleep,45.00,Health & Fitness,/images/tracker.jpg,70

In this case the AI detects issues with certain attributes (such as the image URL needing to be a full URL instead of a relative path) and automatically corrects them as needed.

Once imported, the products will be accessible and manageable from your dashboard. You can even query, edit, or delete them using the AI assistant.


Conclusion

With Appwrite's MCP server and a tool like Cursor, you can now interact with your backend using natural language. This integration simplifies tasks such as creating databases, managing collections, and exporting data, making it accessible even to those without extensive technical expertise. By leveraging the capabilities of AI, you can streamline backend operations, enhance productivity, and focus more on developing innovative features for your applications.

For further exploration and advanced use cases, refer to the Appwrite documentation.


📌 Acknowledgements

This article is a translation and adaptation of a video by Denis.
▶️ Watch the original video here:


🔗 You Might Also Like

1
Subscribe to my newsletter

Read articles from Abdulrasheed Abdulsalam directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdulrasheed Abdulsalam
Abdulrasheed Abdulsalam