AFFiNE MCP Server
Provides tools for interacting with AFFiNE workspaces, documents, databases, organizations, comments, notifications, and blob storage, supporting both AFFiNE Cloud and self-hosted AFFiNE instances.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AFFiNE MCP Server list my recent documents from all workspaces"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AFFiNE MCP Server
A Model Context Protocol (MCP) server for AFFiNE. It exposes AFFiNE workspaces and documents to AI assistants over stdio (default) or HTTP (/mcp) and supports both AFFiNE Cloud and self-hosted deployments.
Table of Contents
Related MCP server: notepm-mcp-server
Overview
AFFiNE MCP Server is designed for three common scenarios:
Run a local stdio MCP server for Claude Code, Codex CLI, Cursor, or Claude Desktop
Expose a remote HTTP MCP endpoint for hosted or browser-connected clients
Automate AFFiNE workspace, document, database, organization, and comment workflows through a stable MCP tool surface
Highlights:
Supports AFFiNE Cloud and self-hosted AFFiNE instances
Supports stdio and HTTP transports
Supports session-cookie and email/password authentication, plus compatible bearer tokens for older deployments
Exposes 96 canonical MCP tools backed by AFFiNE GraphQL and WebSocket APIs
Includes official AFFiNE LLM prompt catalog integration and native MCP Prompts (
prompts/list,prompts/get)Includes rich visual dashboard generation, mindmaps, presentation slide decks, semantic page composition, native template instantiation, database intent composition, capability and fidelity reporting, and workspace blueprint helpers
Includes Docker images, health probes, and end-to-end test coverage
Scope boundaries:
This server can access only server-backed AFFiNE workspaces
Browser-local workspaces stored only in local storage are not available through AFFiNE server APIs
AFFiNE 0.27+ removed the legacy personal-access-token GraphQL API; this server no longer exposes token-management tools
AFFiNE Cloud requires browser-session authentication for this external GraphQL integration; programmatic email/password sign-in is blocked by Cloudflare
New in v3.2.1: Scripted cookie login now keeps session secrets out of process arguments, validates workspace access before saving credentials, and restores document pagination for ordinary workspace members.
Choose Your Path
Goal | Start here |
Set up a local stdio server with the least friction | |
Run the server in Docker or another OCI runtime | |
Configure Claude Code, Claude Desktop, Codex CLI, or Cursor | |
Run the server remotely over HTTP or behind OAuth | |
Lock down tool exposure for least-privilege deployments | docs/configuration-and-deployment.md#least-privilege-tool-exposure |
Learn common AFFiNE workflows and tool sequences | |
Browse the tool catalog by domain |
Quick Start
1. Install the CLI
npm i -g affine-mcp-server
affine-mcp --versionYou can also run the package ad hoc:
npx -y -p affine-mcp-server affine-mcp -- --version2. Or run the server in Docker
docker run -d \
-p 3000:3000 \
-e MCP_TRANSPORT=http \
-e AFFINE_BASE_URL=https://your-affine-instance.com \
-e AFFINE_EMAIL=you@example.com \
-e AFFINE_PASSWORD=your-password \
-e AFFINE_MCP_AUTH_MODE=bearer \
-e AFFINE_MCP_HTTP_TOKEN=your-strong-secret \
ghcr.io/dawncr0w/affine-mcp-server:latestThen point your client at:
{
"mcpServers": {
"affine": {
"type": "http",
"url": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer your-strong-secret"
}
}
}
}For Docker, health checks, and remote deployment details, see docs/configuration-and-deployment.md#docker.
3. Save credentials with interactive login
affine-mcp loginThis stores credentials in $XDG_CONFIG_HOME/affine-mcp/config when XDG_CONFIG_HOME is set, otherwise in ~/.config/affine-mcp/config, with mode 600.
For AFFiNE Cloud, paste the Cookie request header from a signed-in browser session
For self-hosted AFFiNE, use email/password (recommended) or a signed-in session cookie
AFFINE_API_TOKENremains available only for deployments that still accept a compatible GraphQL bearer token
For scripted session-cookie setup, keep the cookie out of process arguments:
affine-mcp login --url https://app.affine.pro --cookie-stdin --workspace-id your-workspace-id --forcePaste the cookie at the hidden prompt, or pipe it from a trusted secret source. The CLI verifies --workspace-id against the authenticated account before saving it. Piped input requires --force when existing credentials would be replaced.
4. Register the server with your client
Claude Code project config:
{
"mcpServers": {
"affine": {
"command": "affine-mcp"
}
}
}Codex CLI:
codex mcp add affine -- affine-mcpMore client-specific setup is in docs/client-setup.md.
5. Verify the connection
affine-mcp status
affine-mcp doctorIf you want to expose the server remotely over HTTP instead of stdio, start with docs/configuration-and-deployment.md.
Compatibility Matrix
Node.js 20 is the minimum supported runtime. CI validates the minimum runtime and the current Node.js release used by the npm publish workflow.
Target | Transport | Recommended auth | Recommended path |
Claude Code | stdio | Saved config | |
Claude Desktop | stdio | Saved config or session cookie | |
Codex CLI | stdio | Saved config or self-hosted email/password | |
Cursor | stdio | Saved config or session cookie | |
Containerized remote deployment | HTTP | Bearer token or OAuth | |
Remote MCP clients | HTTP | Bearer token or OAuth | |
AFFiNE Cloud | stdio or HTTP | Signed-in browser session cookie | |
Self-hosted AFFiNE | stdio or HTTP | Email/password or session cookie |
Tool Surface
tool-manifest.json is the source of truth for canonical tool names. The MCP server exposes those tools through tools/list and tools/call; tool definitions returned by tools/list include MCP annotations that mark read-only, destructive, idempotent, and external-world behavior for client-side tool selection.
Every canonical tool also declares an MCP outputSchema for its structuredContent. Object results retain their existing top-level fields, while array and scalar results use stable { items }, { text }, or { value } envelopes. The existing text content remains unchanged for compatibility with clients that do not consume structured results.
Domains:
Workspace: create, inspect, update, delete, and traverse workspaces
Organization: collections, collection-rule sync, workspace blueprints, and experimental organize or folder helpers
Documents: search, read, create, publish, move, tag, custom properties, import/export, semantic composition, template inspection and native instantiation, capability and fidelity reporting, and block-level mutation
Visual Dashboards & AI Prompts: retrieve official AFFiNE LLM prompts (
make_it_real,code_artifact,mindmap_generate,slides_outline, etc.), create rich interactive HTML/CSS dashboards, generate nested mindmaps, and build presentation slide decksDatabases: create columns, add rows, update rows, inspect schema, and compose database structures from intent
Comments: list, create, update, delete, and resolve
History: version history listing
Users and authentication: current user, sign-in, and profile/settings
Notifications: list and mark notifications as read
Blob storage: upload, delete, and cleanup blobs
Use AFFINE_TOOL_PROFILE=read_only, core, or authoring when a deployment should expose a smaller surface than the complete full default. This is the recommended path for hosted, browser-connected, or least-privilege deployments because it reduces agent choice overload while keeping the full tool catalog available as an opt-in surface. You can also combine profiles with AFFINE_DISABLED_GROUPS such as docs.database, destructive, or admin for finer control.
For the grouped catalog, notes, and operational caveats, see docs/tool-reference.md.
Documentation Map
Document | Purpose |
First-run setup paths and verification | |
Client-specific configuration snippets and tips | |
Environment variables, auth modes, Docker, HTTP mode, and deployment guidance | |
End-to-end workflows and example tool sequences | |
Tool catalog grouped by domain | |
Edgeless canvas layout helpers and surface elements, worked end-to-end | |
Contributor workflow | |
Security reporting |
Verify Your Setup
Useful CLI commands:
affine-mcp status- test the effective configurationaffine-mcp status --json- machine-readable status outputaffine-mcp doctor- diagnose config and connectivity issuesaffine-mcp show-config- print the effective config with secrets redactedaffine-mcp config-path- print the config file pathaffine-mcp snippet <claude|cursor|codex|all> [--env]- generate ready-to-paste client configaffine-mcp logout- remove stored credentials
status, doctor, and the server runtime use the same environment > saved config > defaults resolution. For a self-hosted deployment with a non-standard GraphQL route, use affine-mcp login --graphql-path /your/graphql/path or set AFFINE_GRAPHQL_PATH; show-config --json prints the exact resolved graphqlEndpoint without exposing secrets.
For common failures, see:
Security and Scope
Never commit passwords, session cookies, or compatible bearer tokens
Use a dedicated least-privilege AFFiNE account for unattended deployments
Email/password HTTP sessions share one login and never fall back to anonymous backend requests after authentication failure
Use HTTPS for non-local deployments
Keep remote HTTP MCP listeners authenticated; bearer mode refuses a non-loopback bind without
AFFINE_MCP_HTTP_TOKENSend MCP bearer tokens in the
Authorizationheader, never in the URLRe-run
affine-mcp loginwhen a saved browser session expiresRestrict exposed tools with
AFFINE_DISABLED_GROUPSandAFFINE_DISABLED_TOOLSfor least-privilege setupsTreat OAuth mode as a shared AFFiNE service-account deployment: it defaults to
read_only, and write-capable profiles requireAFFINE_OAUTH_ALLOW_SERVICE_WRITES=trueUse
/healthzand/readyzwhen running the HTTP server behind a container platform or load balancerSet HTTP body, session, idle, and shutdown limits explicitly for high-volume deployments
Development
Run the main quality gates before opening a PR:
npm run ciAdditional validation:
npm testverifies tool metadata, test-suite coverage, and the fast regression suite without requiring a live AFFiNE instancenpm run test:comprehensiveboots a local Docker AFFiNE stack and validates the tool surfacenpm run test:e2eruns Docker, MCP, and Playwright togethernpm run test:playwrightruns the Playwright suite onlyFocused runners for the new high-level tool surface include
npm run test:create-placement,npm run test:capabilities-fidelity,npm run test:native-template,npm run test:mutation-ack,node tests/test-database-intent.mjs,node tests/test-semantic-page-composer.mjs,node tests/test-structured-receipts.mjs,node tests/test-organize-tools.mjs, andnode tests/test-supporting-tools.mjs
Live tests can mutate or delete AFFiNE data. They allow loopback targets by
default and refuse non-loopback targets unless the disposable target is
explicitly enabled and confirmed as documented in CONTRIBUTING.md. Never run
them against production.
Local clone flow:
git clone https://github.com/dawncr0w/affine-mcp-server.git
cd affine-mcp-server
npm install
npm run build
node dist/index.jsRelease Notes
License
MIT License - see LICENSE.
Support
Open an issue on GitHub
Review AFFiNE product documentation at docs.affine.pro
Acknowledgments
Built for the AFFiNE knowledge base platform
Uses the Model Context Protocol specification
Powered by @modelcontextprotocol/sdk
Available Tools
96 toolsadd_database_columnAdd Database ColumnA
Add a column to an existing AFFiNE database block. Supports rich-text, select, multi-select, number, checkbox, link, date types.
Inputs: name (required), docId (required), databaseBlockId (required), type, +3 more. Returns: name, type, added, columnId
add_database_rowAdd Database RowA
Add a row to an AFFiNE database block. Provide cell values mapped by column name or column ID. Title column text is stored on the row paragraph block. Select columns auto-create options by label.
Inputs: cells (required), docId (required), databaseBlockId (required), linkedDocId, +1 more. Returns: added, cellCount, rowBlockId, linkedDocId, +1 more
add_doc_to_collectionAdd Doc To CollectionA
Add an existing document id to an AFFiNE collection allow-list. Use update_collection_rules instead when membership should be rule-driven.
Inputs: docId (required), collectionId (required), workspaceId. Returns: id, name, rules, allowList
add_organize_linkAdd Organize LinkA
Experimental: add a doc, tag, or collection link under an AFFiNE organize folder. Use move_organize_node for an existing link node instead of creating a duplicate link.
Inputs: type (required), folderId (required), targetId (required), index, +1 more. Returns: id, data, type, index, +1 more
add_surface_elementAdd Surface ElementA
Add a shape, connector, text, or group to the AFFiNE edgeless canvas surface. Shapes support rect/ellipse/diamond/triangle with fill, stroke, and text. Connectors draw arrows between shapes (by id) or between absolute points. Use for building diagrams programmatically. Style fields that don't apply to the chosen element type are reported in the response 'ignored' list (mirrors update_surface_element).
Inputs: type (required), docId (required), x, y, +26 more. Returns: type, added, ignored, elementId, +1 more
add_tag_to_docAdd Tag To DocumentA
Attach a workspace tag to a document, creating the workspace tag option if needed. This updates workspace metadata and attempts to sync the document's own metadata.
Inputs: tag (required), docId (required), workspaceId. Returns: tag, tags, added, docId, +3 more
analyze_doc_fidelityAnalyze Document FidelityARead-onlyIdempotent
Inspect a document for markdown export fidelity risk, including unsupported AFFiNE block flavours and risky content paths.
Inputs: docId (required), workspaceId. Returns: docId, exists, unsupportedBlocks, conditionallyRiskyBlocks
append_blockAppend BlockA
Append document blocks with canonical types and legacy aliases (supports placement + strict validation).
Inputs: type (required), docId (required), x, y, +33 more. Returns: ok, kind, type, docId, +7 more
append_markdownAppend MarkdownB
Append markdown content to an existing AFFiNE document.
Inputs: docId (required), markdown (required), strict, placement, +1 more. Returns: ok, kind, docId, lossy, +6 more
append_semantic_sectionAppend Semantic SectionB
Append a semantic section to an existing AFFiNE document by heading title and native block composition.
Inputs: docId (required), sectionTitle (required), bullets, callouts, +3 more. Returns: docId, noteId, blockIds, workspaceId, +4 more
cleanup_blobsCleanup Deleted BlobsADestructive
Permanently release blobs that were already marked deleted in a workspace. This is destructive cleanup and should be used only after confirming deleted blobs are no longer needed.
Inputs: workspaceId (required), confirmWorkspaceId (required). Returns: ok, code, kind, error, +6 more
clear_doc_propertyClear Document PropertyA
Remove a custom property value from a document (property by id or name).
Inputs: docId (required), property (required), workspaceId. Returns: docId, cleared, propertyId, workspaceId
compose_database_from_intentCompose Database From IntentA
Create a useful AFFiNE database/data-view from declarative intent. Supports task_board and issue_tracker presets with starter schema, kanban view, and optional starter rows.
Inputs: docId (required), intent (required), title, seedRows, +2 more. Returns: docId, lossy, stats, title, +10 more
create_collectionCreate CollectionA
Create a new AFFiNE sidebar collection with optional rules. This writes workspace sidebar metadata but does not create documents.
Inputs: name (required), rules, workspaceId. Returns: id, name, rules, allowList
create_commentCreate CommentA
Create a new comment on an existing document. This writes collaboration state; use update_comment when editing an existing comment instead.
Inputs: docId (required), content (required), docMode, docTitle, +2 more. Returns: id, ok, kind, docId, +3 more
create_custom_propertyCreate Custom PropertyA
Create a workspace-wide custom property definition (text, number, checkbox, or date). Returns its propertyId.
Inputs: name (required), type (required), icon, workspaceId. Returns: name, type, index, created, +2 more
create_dashboard_docA
Create an AFFiNE document containing a rich interactive HTML/CSS dashboard widget styled with AFFiNE color tokens and design system layout.
Inputs: topic (required), title, htmlContent, workspaceId. Returns: ok, kind, docId, title, +4 more
create_docCreate DocumentA
Create a new AFFiNE document with optional content. If parentDocId is provided, the new doc is linked into the sidebar tree immediately. If folderId is provided, the doc is placed inside that folder in the sidebar.
Inputs: title, content, folderId, parentDocId, +1 more. Returns: ok, kind, docId, title, +7 more
create_doc_from_markdownCreate Document From MarkdownA
Create a new AFFiNE document and import markdown content. Use parentDocId to automatically embed the new doc into a parent, making it visible in the sidebar instead of being an orphan.
Inputs: markdown (required), title, strict, parentDocId, +1 more. Returns: ok, kind, docId, lossy, +6 more
create_folderCreate FolderA
Experimental: create an AFFiNE organize folder node in the sidebar tree. This only changes sidebar organization, not document content.
Inputs: name (required), index, parentId, workspaceId. Returns: id, data, type, index, +2 more
create_mindmap_canvasA
Generate a structured markdown nested list mindmap for AFFiNE edgeless canvas.
Inputs: title (required), rootTopic (required), subtopics, workspaceId, +1 more. Returns: ok, kind, docId, title, +3 more
create_presentation_slidesA
Generate a structured ND-JSON presentation slide deck outline and insert it into an AFFiNE document.
Inputs: title (required), topic (required), slides, workspaceId. Returns: ok, kind, docId, title, +3 more
create_semantic_pageCreate Semantic PageB
Create an AFFiNE-native page with intentional section structure and native block composition.
Inputs: title, pageType, sections, parentDocId, +1 more. Returns: docId, title, noteId, pageId, +7 more
create_tagCreate TagA
Create a workspace-level tag entry for future reuse. This does not attach the tag to a document; use add_tag_to_doc for that.
Inputs: tag (required), workspaceId. Returns: tag, created, workspaceId
create_workspaceCreate WorkspaceA
Create a new workspace with initial document (accessible in UI)
Inputs: name (required), avatar. Returns: id, ok, url, code, +11 more
create_workspace_blueprintCreate Workspace BlueprintA
Create a simple AFFiNE organize folder blueprint with one root folder and optional child folders. This is a convenience wrapper around create_folder.
Inputs: rootFolderName (required), workspaceId, childFolderNames. Returns: workspaceId, childFolders, rootFolderId, storageDocId, +2 more
current_userCurrent UserARead-onlyIdempotent
Return the currently authenticated AFFiNE user profile. Use this read-only check to verify credentials before workspace or document operations.
Inputs: no named parameters. Returns: id, name, email, disabled, +2 more
delete_blobDelete BlobADestructive
Delete a blob from AFFiNE workspace storage. Set permanently only when the blob should bypass recoverable deletion.
Inputs: key (required), workspaceId (required), confirmKey, permanently. Returns: ok, key, code, kind, +8 more
delete_blockDelete BlockADestructive
Delete a block by id. Removes descendants and unlinks from the parent's sys:children by default; set deleteChildren=false to keep descendants orphaned (for re-parenting), or pruneConnectors=true to also drop surface connectors referencing any deleted id. Refuses affine:page — use delete_doc for whole docs.
Inputs: docId (required), blockId (required), workspaceId, deleteChildren, +1 more. Returns: reason, blockId, deleted, deletedIds, +1 more
delete_collectionDelete CollectionADestructive
Delete an AFFiNE sidebar collection. This removes the collection metadata but does not delete the documents it referenced.
Inputs: collectionId (required), workspaceId. Returns: success, collectionId
delete_commentDelete CommentADestructive
Delete an existing comment by id. This is destructive for that comment; use resolve_comment when you only want to mark a thread resolved.
Inputs: id (required). Returns: id, ok, code, kind, +5 more
delete_custom_propertyDelete Custom PropertyADestructive
Soft-delete a workspace custom property definition (by propertyId or name). Existing values are hidden.
Inputs: property (required), workspaceId. Returns: name, deleted, propertyId, workspaceId
delete_database_rowDelete Database RowBDestructive
Delete a row from an AFFiNE database block.
Inputs: docId (required), rowBlockId (required), databaseBlockId (required), workspaceId. Returns: deleted, rowBlockId, databaseBlockId
delete_docDelete DocumentADestructive
Delete a document, wait for the AFFiNE WebSocket outcome, and report workspace-metadata and content deletion separately. This is destructive; use revoke_doc when you only need to remove public access.
Inputs: docId (required), confirmDocId (required), workspaceId. Returns: ok, code, kind, docId, +5 more
delete_folderDelete FolderADestructive
Experimental: delete an AFFiNE organize folder and every nested folder or link node. This is destructive for sidebar organization but does not delete target documents, tags, or collections.
Inputs: folderId (required), workspaceId. Returns: success, deletedIds
delete_organize_linkDelete Organize LinkADestructive
Experimental: delete an AFFiNE organize doc, tag, or collection link node. This removes only the sidebar link, not the target resource.
Inputs: nodeId (required), workspaceId. Returns: nodeId, success
delete_surface_elementDelete Surface ElementADestructive
Delete a surface element by id. Set pruneConnectors=true to also delete any connectors whose source or target referenced the deleted element.
Inputs: docId (required), elementId (required), workspaceId, pruneConnectors. Returns: reason, deleted, elementId, prunedConnectors
delete_tagDelete TagADestructive
Delete a workspace-level tag and remove it from every document that references it. Accepts a tag id or name; an ambiguous name is rejected with the candidate ids.
Inputs: tag (required), workspaceId. Returns: tag, tagId, value, deleted, +4 more
delete_workspaceDelete WorkspaceADestructive
Delete a workspace permanently and report success only when AFFiNE confirms the mutation.
Inputs: id (required), confirmWorkspaceId (required). Returns: id, ok, code, kind, +7 more
export_doc_markdownExport Document MarkdownCRead-onlyIdempotent
Export AFFiNE document content to markdown.
Inputs: docId (required), workspaceId, includeFrontmatter. Returns: tags, docId, lossy, stats, +4 more
export_with_fidelity_reportExport With Fidelity ReportARead-onlyIdempotent
Export document markdown together with a structured fidelity report that highlights markdown loss risk and unsupported AFFiNE-native content.
Inputs: docId (required), workspaceId, includeFrontmatter. Returns: docId, exists, fidelity, markdown
find_doc_by_titleFind Doc by TitleARead-onlyIdempotent
Resolve docs by exact title. Returns ALL matches up to limit (callers handle ambiguity). Case-sensitive by default; pass caseInsensitive: true to fold case. Reads workspace metadata — fast, no per-doc fetch. Unlike search_docs (which is always case-insensitive and capped at limit 20), this tool defaults to case-sensitive matching and returns up to limit matches (default 50, max 200). Prefer this over search_docs when you know the exact title and want every match. Returns: { query, caseInsensitive, matches: [{ id, title, createdAt, updatedAt, inTrash }], workspaceDocCount, truncated }.
Inputs: title (required), limit, workspaceId, caseInsensitive. Returns: query, matches, truncated, caseInsensitive, +1 more
get_affine_promptARead-onlyIdempotent
Retrieve official AFFiNE LLM prompt specs, system prompts, visual style guide, and rendered templates from the backend catalog.
Inputs: promptId (required), vars. Returns: ok, kind, name, action, +6 more
get_capabilitiesGet CapabilitiesARead-onlyIdempotent
Return machine-readable capability flags for this MCP server, including block, database, collaboration, and export support.
Inputs: no named parameters. Returns: docs, server
get_collectionGet CollectionARead-onlyIdempotent
Read one AFFiNE sidebar collection by id, including rules and allow-list. Use list_collections first when the id is unknown.
Inputs: collectionId (required), workspaceId. Returns: id, name, rules, allowList
get_docGet DocumentARead-onlyIdempotent
Read GraphQL metadata for one document, such as title, summary, public state, roles, and timestamps. Use read_doc when you need block content.
Inputs: docId (required), workspaceId. Returns: id, value
get_doc_iconGet Document IconARead-onlyIdempotent
Read the current sidebar icon of a document. Returns null when none is set.
Inputs: docId (required), workspaceId. Returns: ok, icon, kind, docId, +2 more
get_edgeless_canvasGet Edgeless CanvasARead-onlyIdempotent
Read the full edgeless canvas: all edgeless-positioned blocks (notes, frames, edgeless-text) with their xywh, plus all surface elements (shapes, connectors, text, groups). Includes aggregate bounding box and per-type element counts. Use this when you need to understand canvas layout end-to-end before placing new elements.
Inputs: docId (required), workspaceId. Returns: docId, bounds, exists, elementCounts, +3 more
get_folder_iconGet Folder IconARead-onlyIdempotent
Read the current sidebar icon of an organize folder. Returns null when none is set. Experimental.
Inputs: folderId (required), workspaceId. Returns: ok, icon, kind, hasIcon, +2 more
get_orphan_docsGet Orphan DocumentsARead-onlyIdempotent
Find all documents that have no parent (not linked from any other doc via embed_linked_doc / embed_synced_doc blocks or inline LinkedPage references). Useful for workspace hygiene. Note: scans all docs — O(n). Each doc includes an inTrash flag.
Inputs: workspaceId. Returns: count, orphans
get_workspaceGet WorkspaceARead-onlyIdempotent
Get workspace details with best-effort profile metadata and a direct URL
Inputs: id (required). Returns: id, ok, code, error, +6 more
inspect_template_structureInspect Template StructureARead-onlyIdempotent
Inspect a template doc's native structure, tags, and fallback risk before instantiation.
Inputs: templateDocId (required), workspaceId. Returns: tags, title, blocks, noteId, +8 more
instantiate_template_nativeInstantiate Template NativelyA
Instantiate a template using native AFFiNE block cloning when supported, falling back to markdown materialization only when necessary.
Inputs: templateDocId (required), title, variables, parentDocId, +3 more. Returns: mode, docId, title, warnings, +9 more
list_childrenList Document ChildrenARead-onlyIdempotent
List the direct children of a document in the sidebar (embed_linked_doc / embed_synced_doc blocks and inline LinkedPage references). Returns docId, title, URL, and inTrash for each child.
Inputs: docId (required), workspaceId. Returns: count, docId, children
list_collectionsList CollectionsARead-onlyIdempotent
List AFFiNE sidebar collections and their rules. Use this read-only tool before updating, deleting, or adding documents to a collection.
Inputs: workspaceId. Returns: items
list_commentsList CommentsARead-onlyIdempotent
List paginated comments for a document, including nested replies and resolution state. Use this before update_comment, delete_comment, or resolve_comment when you need the existing comment ids.
Inputs: docId (required), after, first, offset, +1 more. Returns: edges, pageInfo, totalCount
list_doc_propertiesList Document PropertiesBRead-onlyIdempotent
List the workspace custom-property definitions and a document's current values for them.
Inputs: docId (required), workspaceId. Returns: docId, properties, definitions, workspaceId, +1 more
list_docsList DocumentsARead-onlyIdempotent
List documents in a workspace (GraphQL), falling back to bounded workspace metadata when GraphQL document access is denied. Each doc includes an inTrash flag; fallback summary, public, and defaultRole values are null. GraphQL and fallback cursors are not interchangeable; restart pagination without after if a cursor is rejected.
Inputs: after, first, offset, workspaceId. Returns: edges, pageInfo, totalCount
list_docs_by_tagList Documents By TagARead-onlyIdempotent
List documents that contain the requested tag. This is read-only and each result includes title metadata and an inTrash flag.
Inputs: tag (required), ignoreCase, workspaceId. Returns: tag, docs, totalDocs, ignoreCase, +1 more
list_historiesList HistoriesARead-onlyIdempotent
List doc histories (timestamps) for a doc.
Inputs: guid (required), take, before, workspaceId. Returns: items
list_notificationsList NotificationsARead-onlyIdempotent
List one server page of current-user AFFiNE notifications in a stable envelope. The response preserves each edge cursor, server pageInfo, and serverTotalCount. unreadOnly is a client-side filter over only the fetched page; it does not change server counts or pageInfo.
Inputs: after, first, offset, unreadOnly. Returns: ok, code, error, items, +2 more
list_organize_nodesList Organize NodesARead-onlyIdempotent
Experimental: list AFFiNE sidebar organize folder and link nodes from the folders workspace DB. Use this before moving or deleting organize nodes.
Inputs: workspaceId. Returns: nodes, workspaceId, storageDocId
list_surface_elementsList Surface ElementsARead-onlyIdempotent
List all shape/connector/text/group elements on the AFFiNE edgeless canvas surface. Returns raw xywh strings plus parsed {x,y,width,height} bounds, with Y.Text fields serialized to plain strings. Optional filters by element type or id.
Inputs: docId (required), type, elementId, workspaceId. Returns: count, docId, exists, elements, +1 more
list_tagsList TagsARead-onlyIdempotent
List all workspace-level tags and the number of documents attached to each tag. Use this before tag mutation when the exact tag name or id is unknown.
Inputs: workspaceId. Returns: tags, totalTags, workspaceId
list_workspacesList WorkspacesARead-onlyIdempotent
List available AFFiNE workspaces with best-effort profile metadata and direct URLs
Inputs: includeProfile. Returns: ok, code, error, items, +2 more
list_workspace_treeList Workspace TreeARead-onlyIdempotent
Returns the full document hierarchy as a tree (roots → children → grandchildren). Use depth to limit nesting (default: 3). Note: loads all docs — may be slow on large workspaces. Each node includes an inTrash flag.
Inputs: depth, workspaceId. Returns: tree, rootCount, totalDocs, workspaceId
move_docMove Document in SidebarA
Move a doc in the AFFiNE sidebar. The destination link is validated and added before the optional source link is removed, cycles are rejected, and partial outcomes are reported explicitly.
Inputs: docId (required), toParentDocId (required), workspaceId, fromParentDocId. Returns: ok, code, kind, docId, +7 more
move_organize_nodeMove Organize NodeA
Experimental: move an AFFiNE organize folder or link node to another folder or root. This preserves the target document, tag, or collection and changes only sidebar placement.
Inputs: nodeId (required), index, parentId, workspaceId. Returns: id, index, parentId
publish_docPublish DocumentA
Make a document publicly accessible through AFFiNE public sharing. This changes sharing state; use revoke_doc to disable public access later.
Inputs: docId (required), mode, workspaceId. Returns: ok, kind, docId, workspaceId
read_all_notificationsMark All Notifications ReadA
Ask AFFiNE to mark every current-user notification as read. Inspect applied/status in the response; a false server result is reported as not_applied, not as success.
Inputs: no named parameters. Returns: ok, code, error, details, +3 more
read_database_cellsRead Database CellsARead-onlyIdempotent
Read row titles and database cell values from an AFFiNE database block.
Inputs: docId (required), databaseBlockId (required), columns, rowBlockIds, +1 more. Returns: rows
read_database_columnsRead Database ColumnsARead-onlyIdempotent
Read schema metadata for an AFFiNE database block, including columns, select options, and view column mappings. Useful for empty databases before any rows exist.
Inputs: docId (required), databaseBlockId (required), workspaceId. Returns: title, views, columns, rowCount, +3 more
read_docRead Document ContentARead-onlyIdempotent
Read document block content via WebSocket snapshot (blocks + plain text). Set includeMarkdown: true to also get the rendered markdown — useful when you need to read content without a separate export_doc_markdown call.
Inputs: docId (required), workspaceId, includeMarkdown. Returns: tags, docId, title, blocks, +4 more
remove_doc_from_collectionRemove Doc From CollectionA
Remove a document id from an AFFiNE collection allow-list. This does not delete the document or change collection rules.
Inputs: docId (required), collectionId (required), workspaceId. Returns: id, name, rules, allowList
remove_tag_from_docRemove Tag From DocumentA
Detach a tag from one document without deleting the workspace-level tag. Use delete_tag only when the tag should be removed from every document.
Inputs: tag (required), docId (required), workspaceId. Returns: tag, tags, docId, removed, +3 more
rename_folderRename FolderA
Experimental: rename an AFFiNE organize folder node. This changes sidebar metadata only and does not rename documents inside the folder.
Inputs: name (required), folderId (required), workspaceId. Returns: id, name
replace_doc_with_markdownReplace Document With MarkdownB
Replace the main note content of a document with markdown content.
Inputs: docId (required), markdown (required), strict, allowEmpty, +1 more. Returns: ok, kind, docId, lossy, +4 more
resolve_commentResolve CommentA
Set a comment thread's resolved state without changing its content. Use delete_comment only when the comment should be removed.
Inputs: id (required), resolved (required). Returns: id, ok, code, kind, +6 more
revoke_docRevoke DocumentADestructive
Disable public sharing for a document without deleting the document. Use delete_doc only when the document itself should be removed.
Inputs: docId (required), workspaceId. Returns: ok, kind, docId, workspaceId
search_docsSearch Documents by TitleARead-onlyIdempotent
Fast search for documents by title using workspace metadata. Much faster than exporting each doc. Returns docId, title, direct URL, and inTrash for each match.
Inputs: query (required), tag, limit, sortBy, +3 more. Returns: tag, query, sortBy, results, +3 more
set_doc_propertySet Document PropertyB
Set a document's custom property value (property by id or name). Value is validated against the property type (text/number/checkbox/date).
Inputs: docId (required), value (required), property (required), workspaceId. Returns: name, type, docId, value, +4 more
sign_inSign InA
Sign in to AFFiNE using email and password; sets session cookies for subsequent calls.
Inputs: email (required), password (required). Returns: signedIn
update_collectionUpdate CollectionA
Rename an existing AFFiNE sidebar collection without changing its rules or allow-list.
Inputs: collectionId (required), name, workspaceId. Returns: id, name, rules, allowList
update_collection_rulesUpdate Collection RulesA
Replace an AFFiNE collection's rules and rebuild its allow-list from current workspace documents. This can change which docs appear in the collection.
Inputs: rules (required), collectionId (required), workspaceId. Returns: rules, allowList, workspaceId, collectionId, +2 more
update_commentUpdate CommentA
Replace the content of an existing comment. This preserves the comment thread; use create_comment for a new thread.
Inputs: id (required), content (required). Returns: id, ok, code, kind, +5 more
update_database_rowUpdate Database RowA
Batch update multiple cells on an existing AFFiNE database row. Include title in the cells map to update the Kanban row title.
Inputs: cells (required), docId (required), rowBlockId (required), databaseBlockId (required), +3 more. Returns: updated, cellCount, rowBlockId
update_doc_iconUpdate Document IconA
Set or clear the sidebar icon (the Notion-style emoji slot) on a document. Pass an emoji string, a full icon object, or null to remove it.
Inputs: icon (required), docId (required), workspaceId. Returns: ok, icon, kind, docId, +2 more
update_doc_titleUpdate Document TitleA
Rename a document — updates both the sidebar title (workspace metadata) and the doc's internal page block title.
Inputs: docId (required), title (required), workspaceId. Returns: ok, kind, docId, title, +2 more
update_edgeless_blockUpdate Edgeless BlockA
Partially update a note/frame/edgeless-text block by id. x/y/width/height merge with current prop:xywh (move without resizing, or vice versa). background replaces prop:background (AFFiNE token or {light, dark} hex object). Fields that don't apply to the block's flavour come back under ignored.
Inputs: docId (required), blockId (required), x, y, +4 more. Returns: blockId, changed, flavour, ignored, +1 more
update_folder_iconUpdate Folder IconA
Set or clear the sidebar icon on an organize folder. Pass an emoji string, a full icon object, or null to remove it. Experimental.
Inputs: icon (required), folderId (required), workspaceId. Returns: ok, icon, kind, cleared, +2 more
update_frame_childrenUpdate Frame ChildrenA
Replace a frame block's contents wholesale. Accepts ids of surface elements (shapes/connectors/groups) AND edgeless blocks (notes/frames/edgeless-text) — all go into BlockSuite's prop:childElementIds map, matching what the editor writes when you drag members into a frame. Dragging the frame drags every owned member. Ids that don't resolve come back under 'missing'. By default the frame is resized to fit its new contents (plus padding + title band); set resizeToFit=false to leave xywh untouched. Pass [] to clear ownership (resize is skipped in that case).
Inputs: docId (required), blockId (required), childElementIds (required), padding, +2 more. Returns: xywh, blockId, flavour, missing, +3 more
update_profileUpdate ProfileA
Update current user's profile information.
Inputs: name, avatarUrl. Returns: id, ok, code, name, +4 more
update_settingsUpdate SettingsC
Update user settings and preferences.
Inputs: settings (required). Returns: ok, code, error, details, +2 more
update_surface_elementUpdate Surface ElementA
Partially update a surface element by id. x/y/width/height merge with the element's current xywh (move without resizing, or vice versa). text/label/title replace their Y.Text wholesale. Fields that don't apply to the element's type are reported in the response 'ignored' list.
Inputs: docId (required), elementId (required), x, y, +26 more. Returns: type, changed, ignored, updated, +1 more
update_workspaceUpdate WorkspaceC
Update workspace settings
Inputs: id (required), public, enableAi. Returns: id, ok, code, kind, +4 more
upload_blobUpload BlobA
Upload a file or blob into AFFiNE workspace storage and return its blob key. This creates stored content but does not attach it to a document by itself.
Inputs: content (required), workspaceId (required), encoding, filename, +1 more. Returns: id, ok, key, code, +9 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 96 tools
Most tools have clearly distinct purposes (workspaces, docs, tags, databases, canvas, comments, collections, folders, properties, icons, user, blobs, notifications), and descriptions explicitly distinguish near-overlaps like get_doc vs read_doc and find_doc_by_title vs search_docs. A few pairs (update_surface_element vs update_edgeless_block) could cause confusion, but their descriptions are clear enough.
The overwhelming majority follow a consistent verb_noun snake_case pattern (list_, get_, create_, update_, delete_, append_, etc.). Minor deviations like 'current_user' (a noun phrase rather than verb-first) and a few multi-word descriptive names (analyze_doc_fidelity, instantiate_template_native) break the pattern slightly but do not hinder readability.
At 96 tools, this is an extreme count, far exceeding the 'well-scoped' guideline of 3-15 tools. Even accounting for AFFiNE's broad feature set, the sheer number imposes a high selection burden and increases the risk of misselection, making the tool surface unwieldy.
The server covers an impressively broad range of AFFiNE domains with full CRUD or lifecycle operations for workspaces, docs, tags, databases, canvas elements, comments, collections, folders, properties, icons, blobs, and notifications. Minor gaps exist (e.g., no full-text search, no explicit move-doc-to-folder tool, no workspace member management), but the core workflows are well covered.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Hosted Notion MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
AlicenseBqualityCmaintenanceAn MCP server that enables AI assistants to interact with the Notion API, allowing them to search, read, comment on, and create content in Notion workspaces through natural language commands.19320,999 npm4,721MIT- AlicenseAqualityBmaintenanceAn unofficial MCP server that enables AI assistants to search, read, create, and update pages in your NotePM workspace.846 npm1MIT
- AlicenseBqualityCmaintenanceA live MCP server that connects AI assistants to a running Obsidian instance, enabling full app automation including reading notes, clicking UI elements, managing plugins, and executing JavaScript.4313 npm3MIT
- FlicenseBqualityDmaintenanceAn MCP server that enables AI assistants to access and manage your local Obsidian vault through a standardized protocol.142-