Affine MCP Server logo

Affine MCP Server

Connects AI assistants to AFFiNE workspaces for document search, text edits, database updates, and collaboration workflows.

Install Affine MCP Server

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "affine-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "-p",
        "affine-mcp-server",
        "affine-mcp"
      ],
      "env": {
        "MCP_TRANSPORT": "YOUR_VALUE_HERE",
        "AFFINE_BASE_URL": "YOUR_VALUE_HERE",
        "AFFINE_EMAIL": "YOUR_VALUE_HERE",
        "AFFINE_PASSWORD": "YOUR_VALUE_HERE",
        "AFFINE_API_TOKEN": "YOUR_VALUE_HERE",
        "AFFINE_MCP_AUTH_MODE": "YOUR_VALUE_HERE",
        "AFFINE_MCP_HTTP_TOKEN": "YOUR_VALUE_HERE",
        "AFFINE_ALLOW_INSECURE_HTTP": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y -p affine-mcp-server affine-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

affine-mcp-server connects AI assistants to AFFiNE Cloud or self-hosted AFFiNE workspaces, documents, databases, and collaboration APIs. It exposes MCP tools over stdio by default or through an HTTP endpoint at `/mcp`, with support for coordinated writes and targeted document or database changes. Use it when an agent needs to find blocks, edit rich-text content, update database rows, or automate broader AFFiNE workspace workflows. Authentication supports session cookies, self-hosted email/password login, and compatible bearer tokens for older deployments.

Use cases

  • Search AFFiNE documents for matching blocks
  • Apply targeted text changes to document blocks
  • Update multiple database rows in one request
  • Automate table schema and canvas content changes
  • Coordinate writes from multiple AI agents

Key features

  • AFFiNE Cloud and self-hosted deployment support
  • stdio and HTTP MCP transports
  • Targeted document text editing
  • Database row, schema, and view updates
  • Concurrent workspace write coordination
  • Compact reads and bounded Markdown exports

Tools3

What Affine MCP Server lets your agent do. Expand a tool for its parameters.

Self-reported~85 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 7d ago via OSV.dev · affine-mcp-server (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars338Stargazers on the source repository.
npm downloads5.6kPackage downloads in the last 30 days.
Last commit3d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed3Callable tools this server registers over MCP.

How Affine MCP Server works

What affine-mcp-server does

affine-mcp-server gives MCP-compatible AI clients access to server-backed AFFiNE workspaces. It can locate document blocks, apply targeted text replacements, and update database row cells. The broader tool surface covers workspace and document operations, database and table changes, comments, organizations, canvas content, code blocks, journal dates, templates, page composition, and workspace blueprints.

The server supports both AFFiNE Cloud and self-hosted AFFiNE instances. It works with documents stored through AFFiNE server APIs; browser-local workspaces that exist only in local storage are outside its scope.

How it works

A local deployment communicates with the client over stdio. Remote deployments expose the MCP endpoint at /mcp over HTTP, including Streamable HTTP and legacy SSE session handling. The server uses AFFiNE GraphQL, WebSocket, and REST APIs behind its MCP tools.

Concurrent writes to the same workspace are coordinated through one shared server. Read operations can return a document revision, which can then be supplied as expectedRevision to reject edits based on stale content. The server also offers compact or outline reads, section and tail selection, bounded Markdown exports, compact database queries, and minimal write receipts to limit response size.

Setup and configuration

Install the CLI globally with npm i -g affine-mcp-server, or run it on demand with npx. The executable is affine-mcp. Docker images are also available for HTTP deployments, with health probes included.

For self-hosted AFFiNE, configure the instance URL and authenticate with email and password or a signed-in session cookie. AFFiNE Cloud requires the Cookie request header from an authenticated browser session because programmatic email/password sign-in is blocked by Cloudflare. Older deployments may accept AFFINE_API_TOKEN as a compatible GraphQL bearer token.

HTTP deployments can require a bearer token for clients connecting to /mcp. Configure session capacity and idle timeouts when serving multiple or long-lived clients, and close short-lived sessions with DELETE /mcp when finished.

Tools and capabilities

The documented tool examples include:

  • find_blocks, which searches a document by text and can filter by block type.
  • edit_block_text, which replaces selected text within a specified block.
  • update_database_rows, which changes cell values for identified database rows.

Additional capabilities include inserting and deleting native table rows and columns while preserving formatting and widths; modifying database columns, select options, and view column order or visibility; creating and updating code blocks; and placing, resizing, and connecting images on edgeless canvases. Native created-by and created-time row metadata can be read, and journal dates can be set or cleared.

Limitations and notes

Only server-backed AFFiNE workspaces are accessible. delete_doc removes workspace page metadata and requests content deletion, but some AFFiNE servers may retain content after acknowledging the request; trash_doc is the recoverable cleanup option. After content writes, transient workspace timestamp failures are retried up to three times. If metadata still cannot be confirmed, inspect the saved document before attempting a repair rather than repeating the edit.

AFFiNE versions that removed the legacy personal-access-token GraphQL API cannot use token-management tools. Cloud authentication must use a browser session, and insecure HTTP for self-hosted instances requires explicit opt-in.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Affine MCP Server

affine-mcp-server is an MCP server that connects AI assistants to AFFiNE Cloud or self-hosted AFFiNE workspaces, documents, databases, and collaboration APIs. Its main tools include find_blocks for locating content, edit_block_text for targeted text changes, and update_database_rows for changing database cells. It communicates over stdio or HTTP.

Install it with `npm i -g affine-mcp-server`, then run the `affine-mcp` executable. You can also launch it on demand with `npx -y -p affine-mcp-server affine-mcp`, or run the published Docker image for an HTTP deployment.

Yes, affine-mcp-server supports Cursor configuration. Cursor can connect to a local stdio process, while remote deployments can use the server's HTTP MCP endpoint at `/mcp`.

Use a session cookie copied from the Cookie request header of a signed-in AFFiNE Cloud browser session. Cloudflare blocks programmatic email/password sign-in for this external GraphQL integration, so self-hosted email/password authentication is not the Cloud login path.

Yes, it supports self-hosted AFFiNE deployments. Configure the AFFiNE base URL and authenticate with email/password or a signed-in session cookie; compatible bearer tokens remain available for older deployments that accept them.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewAffine MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/affine-mcp-server?style=directory)](https://allmcps.com/mcp/affine-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/affine-mcp-server"><img src="https://allmcps.com/api/badge/affine-mcp-server?style=directory" alt="Affine MCP Server on AllMCPs" /></a>