Skip to content

Tooling

Pi_

Learn how you can add the Appwrite MCP server to Pi to interact with both the Appwrite API and documentation, and to react to events in your project.

3 min read

Raw

1. Quick start prompts

Get started quickly with these pre-built prompts for common Appwrite integrations:

2. Add the MCP server

Connect the Appwrite MCP server to Pi, a terminal coding agent, for deeper integration with the Appwrite API and documentation. It is a remote HTTP server, so you don't run a server on your machine.

If you don't have Pi yet, install it from your terminal on macOS or Linux. On Windows, or to install with npm, see pi.dev.

Bash
curl -fsSL https://pi.dev/install.sh | sh

Pi connects to the server through pi-mcp-adapter, a Pi extension that adds MCP servers to your sessions. Install it:

Bash
pi install npm:pi-mcp-adapter

Add the Appwrite MCP server to ~/.pi/agent/mcp-adapter.json. Create the file if it doesn't exist, or merge this into it:

JSON
{
"mcpServers": {
"appwrite": {
"url": "https://mcp.appwrite.io/",
"auth": "oauth"
}
}
}

The server uses OAuth for authentication. Start Pi by running pi in your terminal, then run /mcp-auth appwrite. Your browser opens so you can sign in to your Appwrite account and authorize access. You don't need an API key. The adapter keeps the sign-in in your operating system's credential store.

3. Test the integration

Run /mcp in Pi to check that appwrite is listed with its tools. Then try out the following example prompts:

Example prompts:

  • Create a new user in my Appwrite project
  • List all databases in my project
  • Show me the tables in my database
  • How do I set up real-time subscriptions in Appwrite?
  • Show me how to authenticate users with OAuth
  • How do I implement file uploads with Appwrite Storage?

The following screenshot shows Pi answering List the users in my Appwrite project pi-guide for a test project.

Pi lists the users in an Appwrite project
Pi lists the users in an Appwrite project

4. React to project events

The Appwrite MCP server supports MCP Events, an MCP extension that lets an agent subscribe to changes in your project. Pi can subscribe to an event, such as a new user, finish its turn, and wake up when the event happens. The server pushes each event over the connection Pi already has open, so you don't need a public URL.

Pi receives events through pi-mcp-events, an extension that adds an mcp_events tool on top of pi-mcp-adapter. Install it, then restart Pi to load it:

Bash
pi install npm:@realmikekelly/pi-mcp-events

Ask Pi to subscribe to users.user.created. Replace <PROJECT_ID> with your project ID:

Plain text
Subscribe with mcp_events to users.user.created on the appwrite server for project_id <PROJECT_ID>, then finish your turn and wait. Whenever an event arrives, look up that user and tell me their name and email.

Pi opens the subscription and goes idle. When a user signs up or you create one in the Appwrite Console, Pi wakes up without a new prompt, looks up the user, and replies with their name and email.

When you no longer need the events, ask Pi to unsubscribe:

Plain text
Unsubscribe from users.user.created

The following recording shows the whole flow in a test project. Pi subscribes, wakes up when a user is created, reports the user, and then unsubscribes.

Pi subscribes to users.user.created, wakes up when a user is created, and unsubscribes
Pi subscribes to users.user.created, wakes up when a user is created, and unsubscribes

Subscriptions last as long as the Pi session. After you restart Pi or run /reload, ask it to subscribe again. To see every event you can subscribe to and how delivery works, read Events.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.