Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MCP_WS_PORT | No | Host port to expose for WebSocket transport | 7821 |
| AFFINE_EMAIL | No | Email for authentication (self-hosted) | |
| AFFINE_COOKIE | No | Session cookie string (e.g., affine_session=<...>; affine_user_id=<...>) | |
| MCP_TRANSPORT | No | Transport mode: 'stdio' for stdio mode, or 'ws' for WebSocket | ws |
| AFFINE_BASE_URL | No | Base URL of your AFFiNE server, e.g. http://affine.local:3010 | |
| AFFINE_PASSWORD | No | Password for authentication (self-hosted) | |
| AFFINE_API_TOKEN | No | Personal access token for Bearer auth | |
| AFFINE_GRAPHQL_PATH | No | GraphQL endpoint path | /graphql |
| AFFINE_HEADERS_JSON | No | Optional JSON of extra headers to send | |
| AFFINE_WORKSPACE_ID | No | Default workspace id (optional). Tools also accept explicit workspaceId |
Schema
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_workspaces | List all available AFFiNE workspaces |
| get_workspace | Get details of a specific workspace |
| create_workspace | Create a new workspace with initial document (accessible in UI) |
| update_workspace | Update workspace settings |
| delete_workspace | Delete a workspace permanently |
| list_docs | List documents in a workspace (GraphQL). |
| get_doc | Get a document by ID (GraphQL metadata). |
| search_docs | Search documents in a workspace. |
| recent_docs | List recently updated docs in a workspace. |
| publish_doc | Publish a doc (make public). |
| revoke_doc | Revoke a doc's public access. |
| affine_list_comments | List comments of a doc (with replies). |
| affine_create_comment | Create a comment on a doc. |
| affine_update_comment | Update a comment content. |
| affine_delete_comment | Delete a comment by id. |
| affine_resolve_comment | Resolve or unresolve a comment. |
| affine_list_histories | List doc histories (timestamps) for a doc. |
| affine_recover_doc | Recover a doc to a previous timestamp. |
| affine_current_user | Get current signed-in user. |
| affine_update_profile | Update current user's profile information. |
| affine_update_settings | Update user settings and preferences. |
| affine_send_verify_email | Send email verification link. |
| affine_change_password | Change user password (requires token from email). |
| affine_send_password_reset | Send password reset email. |
| affine_delete_account | Permanently delete user account. WARNING: This cannot be undone! |
| affine_apply_doc_updates | Apply CRDT updates to a doc (advanced). |
| affine_list_access_tokens | List personal access tokens (metadata). |
| affine_generate_access_token | Generate a personal access token (returns token). |
| affine_revoke_access_token | Revoke a personal access token by id. |
| affine_upload_blob | Upload a file or blob to workspace storage. |
| affine_delete_blob | Delete a blob/file from workspace storage. |
| affine_cleanup_blobs | Permanently remove deleted blobs to free up storage. |
| affine_list_notifications | Get user notifications. |
| affine_read_notification | Mark a notification as read. |
| affine_read_all_notifications | Mark all notifications as read. |
| affine_sign_in | Sign in to AFFiNE using email and password; sets session cookies for subsequent calls. |