LucasXu0/appflowy_mcp

★ 10Forks 2PythonGitHub ↗Compare

README

AppFlowy MCP Server

This is an MCP server implementation for AppFlowy API integration. It provides tools to interact with AppFlowy's REST API through MCP.

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables (optional):
# Base URL of your AppFlowy instance
export APPFLOWY_BASE_URL="https://your-appflowy-instance.com"

# Your authentication token
export APPFLOWY_ACCESS_TOKEN="your-token-here"
  1. Run the server:
python appflowy_mcp.py

Authentication

There are two ways to provide authentication credentials:

  1. Environment Variables (recommended):

    • Set APPFLOWY_BASE_URL for the API base URL
    • Set APPFLOWY_ACCESS_TOKEN for authentication
  2. Direct Parameter Passing:

    await client.invoke(
        "Get workspace list",
        base_url="https://your-appflowy-instance.com",
        access_token="your-token-here"
    )

Available Tools

The server provides the following tools for interacting with AppFlowy:

  • Get workspace list: List all workspaces for the authenticated user
  • Get workspace folder: Get the folder structure of a workspace
  • Create new page: Create a new page in the workspace
  • Update page: Update a page's properties
  • Get page details: Get details of a specific page
  • Move page to trash: Move a page to trash
  • Get trash: Get all items in trash
  • Restore from trash: Restore a page from trash
  • Delete from trash: Permanently delete a page from trash
  • Get favorites: Get favorite pages
  • Toggle favorite: Add or remove a page from favorites

Required Parameters

Most tools require the following base parameters:

  • base_url: The base URL of your AppFlowy instance
  • access_token: Your authentication token
  • workspace_id: The ID of the workspace you're operating in

Example Usage

Here's an example of how to use the tools in Python:

from mcp.clients import LocalClient

async def main():
    client = LocalClient()

    # List workspaces
    workspaces = await client.invoke(
        "Get workspace list",
        base_url="https://your-appflowy-instance.com",
        access_token="your-token"
    )

    # Create a new page
    new_page = await client.invoke(
        "Create new page",
        base_url="https://your-appflowy-instance.com",
        access_token="your-token",
        workspace_id="your-workspace-id",
        parent_view_id="parent-view-id",
        name="My New Page"
    )

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Error Handling

All API calls include proper error handling and will return an error object if something goes wrong:

{
  "error": "Error message details"
}

Contributors

LucasXu0

Issues