Skip to content
Back to catalog
Pi

MCP with Pi

Connect Pi to your Appwrite project through the hosted Appwrite MCP server and react to project events

Pi is a minimal coding agent for the terminal. You shape it to your workflow with packages that add extensions, skills, prompt templates, and themes. Two packages connect it to Appwrite: pi-mcp-adapter adds MCP servers to your Pi sessions, and pi-mcp-events lets Pi react to events those servers send.

How does the integration work?

The Appwrite MCP server connects Pi to your Appwrite project through the Model Context Protocol. It is a hosted server at https://mcp.appwrite.io/ that signs you in with OAuth, so you don't run a server on your machine or create an API key.

Once connected, Pi can look up your projects, read and change resources such as users, databases, and tables, and search the Appwrite documentation. Changes go through a separate write tool that requires confirmation, and each change carries a short reason that appears in your project's Activity tab.

The server also supports MCP Events, an extension to the protocol. With pi-mcp-events installed, Pi can subscribe to a change in your project, such as a new user, finish its turn, and wake up when the event arrives over the connection it already has open, without a public URL.

How to implement

To connect Pi to Appwrite, there are several steps you must complete:

Step 1: Set up your Appwrite project

First, create an account on Appwrite Cloud if you haven't already, and create a project. You don't need an API key: Pi opens your browser so you can sign in to Appwrite.

Step 2: Install Pi and the MCP adapter

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

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

Then install pi-mcp-adapter:

Bash
pi install npm:pi-mcp-adapter

Step 3: Add the Appwrite MCP server

Add the Appwrite 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"
}
}
}

Start Pi by running pi, then run /mcp-auth appwrite. Sign in to your Appwrite account in the browser window that opens and authorize access. The adapter keeps the sign-in in your operating system's credential store.

Pi also has built-in MCP support, which you set up with pi mcp add. This guide uses the adapter because the events extension needs it. The adapter turns off the built-in support and reads the servers you added with pi mcp add, so those keep working.

Step 4: Test the integration

Run /mcp in Pi to check that appwrite is listed with its tools, then try prompts like:

  • Create a new user in my Appwrite project
  • List all databases in my project
  • Show me the tables in my database

Step 5: React to project events

Install pi-mcp-events, which adds an mcp_events tool on top of the adapter, then restart Pi to load it:

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

Ask Pi to subscribe to new users. 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. Ask Unsubscribe from users.user.created when you're done.

Subscriptions last as long as the Pi session. After you restart Pi or run /reload, ask it to subscribe again. The events reference lists every event you can subscribe to, including failed function executions, completed deployments, new rows, and new files.

Read more about Pi and the Appwrite MCP server

If you would like to learn more about Pi and the Appwrite MCP server, we have some resources that you should visit:

Technology Partner Program

Building on Appwrite?

Teams and developers who ship integrations, tools, or services on Appwrite can join our partner program for verified catalog placement, co-marketing, training, and engineering support.