AffineCAUTION
Model Context Protocol server for AFFiNE. Connect AI assistants to AFFiNE workspaces, documents, databases, and collaboration APIs over stdio or HTTP.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
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.
[](https://github.com/dawncr0w/affine-mcp-server/releases) [](https://github.com/modelcontextprotocol/typescript-sdk) [](https://github.com/dawncr0w/affine-mcp-server/actions/workflows/ci.yml) [](LICENSE)
Table of Contents
- Overview
- Choose Your Path
- Quick Start
- Compatibility Matrix
- Tool Surface
- Documentation Map
- Verify Your Setup
- Security and Scope
- Development
- Release Notes
- License
- Support
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
- Coordinates concurrent writes per workspace through one shared MCP server; optional document revisions reject stale edits
- Supports session-cookie and email/password authentication, plus compa
2d13eb0ca77aOBSERVED · 2026-10-06Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add affine-mcp-server --env AFFINE_ADMIN_PASSWORD=${AFFINE_ADMIN_PASSWORD} --env AFFINE_MCP_HTTP_ALLOW_QUERY_TOKEN=${AFFINE_MCP_HTTP_ALLOW_QUERY_TOKEN} --env AFFINE_MCP_HTTP_ALLOW_UNAUTHENTICATED=${AFFINE_MCP_HTTP_ALLOW_UNAUTHENTICATED} --env AFFINE_MCP_HTTP_TOKEN=${AFFINE_MCP_HTTP_TOKEN} -- npx -y [email protected]{
"mcpServers": {
"affine-mcp-server": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"AFFINE_ADMIN_PASSWORD": "${AFFINE_ADMIN_PASSWORD}",
"AFFINE_MCP_HTTP_ALLOW_QUERY_TOKEN": "${AFFINE_MCP_HTTP_ALLOW_QUERY_TOKEN}",
"AFFINE_MCP_HTTP_ALLOW_UNAUTHENTICATED": "${AFFINE_MCP_HTTP_ALLOW_UNAUTHENTICATED}",
"AFFINE_MCP_HTTP_TOKEN": "${AFFINE_MCP_HTTP_TOKEN}"
}
}
}
}Exposed tools (107)
45 read · 46 write · 16 destructive. Blast radius: 16 tools can delete or overwrite — an agent that can be talked into calling a tool can be talked into calling this one.
| Tool | Risk | Description |
|---|---|---|
add_database_column | write | |
add_database_row | write | |
add_doc_to_collection | write | |
add_mindmap_node | write | |
add_organize_link | write | |
add_surface_element | write | |
add_tag_to_doc | write | |
analyze_doc_fidelity | read | |
append_block | read | |
append_markdown | read | |
append_semantic_section | read | |
cleanup_blobs | read | |
clear_doc_property | destructive | |
compose_database_from_intent | read | |
create_collection | write | |
create_comment | write | |
create_custom_property | write | |
create_doc | write | |
create_doc_from_markdown | write | |
create_folder | write | |
create_mindmap | write | |
create_semantic_page | write | |
create_tag | write | |
create_workspace | write | |
create_workspace_blueprint | write | |
current_user | read | |
delete_blob | destructive | |
delete_block | destructive | |
delete_collection | destructive | |
delete_comment | destructive | |
delete_custom_property | destructive | |
delete_database_row | destructive | |
delete_doc | destructive | |
delete_folder | destructive | |
delete_organize_link | destructive | |
delete_surface_element | destructive | |
delete_tag | destructive | |
delete_workspace | destructive | |
export_doc_markdown | read | |
export_with_fidelity_report | read | |
find_doc_by_title | read | |
get_capabilities | read | |
get_collection | read | |
get_doc | read | |
get_doc_icon | read | |
get_edgeless_canvas | read | |
get_folder_icon | read | |
get_mindmap | read | |
get_orphan_docs | read | |
get_workspace | read | |
inspect_template_structure | read | |
instantiate_template_native | read | |
list_children | read | |
list_collections | read | |
list_comments | read | |
list_doc_properties | read | |
list_docs | read | |
list_docs_by_tag | read | |
list_histories | read | |
list_notifications | read | |
list_organize_nodes | read | |
list_surface_elements | read | |
list_tags | read | |
list_workspace_tree | read | |
list_workspaces | read | |
move_block | write | |
move_doc | write | |
move_organize_node | write | |
publish_doc | write | |
read_all_notifications | read | |
read_database_cells | read | |
read_database_columns | read | |
read_doc | read | |
remove_doc_from_collection | destructive | |
remove_tag_from_doc | destructive | |
rename_folder | write | |
reparent_mindmap_node | read | |
replace_doc_with_markdown | read | |
resolve_comment | read | |
restore_doc | read | |
revoke_doc | destructive | |
search_docs | read | |
set_doc_journal | write | |
set_doc_property | write | |
set_mindmap_layout | write | |
set_mindmap_lock | write | |
set_mindmap_style | write | |
sign_in | read | |
trash_doc | read | |
update_block | write | |
update_collection | write | |
update_collection_rules | write | |
update_comment | write | |
update_database_row | write | |
update_doc_icon | write | |
update_doc_title | write | |
update_edgeless_block | write | |
update_folder_icon | write | |
update_frame_children | write | |
update_mindmap_node | write | |
update_profile | write | |
update_settings | write | |
update_surface_element | write | |
update_table_cell | write | |
update_table_column_widths | write | |
update_workspace | write | |
upload_blob | write |
Trust audit
CAUTIONgrade B · trust 81/100 Install with care. The audit found things worth knowing before you trust its output.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | WARN |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (1 observation(s))
- Network
- declared (8 observation(s))
- Shell
- declared (2 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (22)
if (summary.apiToken) console.log(`API token: ${summary.apiToken} (${summary.sources.apiToken})`);console.log(`HTTP auth token: ${summary.http.authToken || "(unset)"} (${summary.sources.httpAuthToken})`);CMD wget -qO- http://127.0.0.1:${PORT}/healthz || exit 1const DEFAULT_ENDPOINT = `http://127.0.0.1:${process.env.PORT || "3000"}/mcp`;clear_doc_property, delete_blob, delete_block, delete_collection, delete_comment, delete_custom_property, delete_database_row, delete_doc, delete_folder, delete_organize_link, delete_surface_element,
.coderabbit.yaml
console.log(`Auth mode: email/password (sync login at startup)`);
import { connectWorkspaceSocket, joinWorkspace, loadDoc, wsUrlFromGraphQLEndpoint } from '../../dist/ws.js';() => resolveTestRunId({ AFFINE_TEST_RUN_ID: '../../unsafe' }),"AFFINE_MCP_HTTP_PROXY_URL": "http://127.0.0.1:3000/mcp"
| `AFFINE_MCP_HTTP_PROXY_URL` | No | `http://127.0.0.1:${PORT:-3000}/mcp` | Loopback Streamable HTTP endpoint used by `affine-mcp-http-proxy` |`http://127.0.0.1:${PORT:-3000}/mcp` and accepts loopback URLs only.f.mutate('update', { mindmapId: f.map.mindmapId, nodeId: c, text: 'Renamed\nЗадача', collapsed: true });assert.equal(result.nodes.find(n => n.nodeId === c).text, 'Renamed\nЗадача');
@modelcontextprotocol/sdk, cors, express, form-data, jose, fractional-indexing, markdown-it, node-fetch
> 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
config file. Some consumers intentionally read environment variables directly
- Added `login --save-credentials`, which stores the email/password used to sign in instead of the session cookie, so the server can sign in on its own and renew the session before it expires.
- Classify AFFiNE Cloud by complete hostname labels instead of substring-matching `affine.pro`. Self-hosted deployments such as `https://affine.proxy.internal` or `https://affine.pro.example.com` prev
- Email/password sign-in and all GraphQL/REST requests now send the `x-affine-version` header (configurable via the new `AFFINE_CLIENT_VERSION`, default `0.26.0`). AFFiNE servers that gate on a minimu
With the email/password method, this stores `AFFINE_EMAIL` and `AFFINE_PASSWORD` so the server signs in on its own and renews the session before it expires. The password is written to the mode-`600` c
Always send the MCP bearer token in the `Authorization` header. The server
Gates applied: no_behavioural_pass.
2d13eb0ca77afull audit observations/trust-audit/mcp-server/dawncr0w__affine.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-06 | 2d13eb0ca77a | CAUTION | B | 81 | first audit |
Questions
What is the Affine MCP server?
Model Context Protocol server for AFFiNE. Connect AI assistants to AFFiNE workspaces, documents, databases, and collaboration APIs over stdio or HTTP.
What tools does Affine expose?
107 in total: 45 read-only, 46 that write, and 16 that can delete or overwrite (clear_doc_property, delete_blob, delete_block, delete_collection, delete_comment). Every one is listed on this page with its risk.
Is Affine safe to connect to an agent?
With care. The audit graded it B (81/100) and found 22 things worth knowing before you trust this server, listed below with the exact line each was found on. Separately from the audit: 16 of its tools can destroy data, so scope the token you give it to what you actually need.
What credentials does Affine need?
It reads AFFINE_ADMIN_PASSWORD, AFFINE_MCP_HTTP_ALLOW_QUERY_TOKEN, AFFINE_MCP_HTTP_ALLOW_UNAUTHENTICATED, AFFINE_MCP_HTTP_TOKEN and AFFINE_PASSWORD from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Affine run?
It speaks sse, stdio and streamable-http, so it runs as a local process your client starts. It is published on npm as affine-mcp-server at 3.9.0.
How current is this page?
The grade is for one exact copy of the source (2d13eb0ca77a), read on 2026-10-06. The repository is watched and re-audited when it changes.