Skip to content

Agents and MCP

AI agents, any client of the Model Context Protocol, can read people’s notes and, if allowed, edit them. Two places serve them, and both serve the one copy of the notes there is:

Serves For Where it runs
The server’s /mcp Standard workspaces, and end-to-end encrypted ones through a token that carries their key Your server, on by default
The desktop app’s local MCP Whatever the app has open, from the app’s own data The person’s computer, while the app is open

The tools are the same everywhere: 40 of them, for pages (reading, writing, moving, copying, the trash, properties, icons, covers and descriptions), parts of pages, databases (rows, properties and views), the journal and canvases; Agents and MCP lists them. Nothing is deleted for good: delete_page and delete_row only move pages to the trash, and only for an agent allowed to. Every change an agent makes is recorded, and people undo it from Settings → Agents. How people connect agents is in Agents and MCP.

The server’s /mcp

Agents connect to https://notes.example.com/mcp (MCP over Streamable HTTP). An agent that can open a browser needs only that address: it signs in through the browser as an app does, using a Client ID Metadata Document, so there’s no registration step. A consent page then asks the person:

  • which workspace it can see;
  • read only, or read and edit (never more than their own role);
  • whether it may edit journal entries (off unless allowed);
  • whether it may move pages to the trash (off unless allowed);
  • whether it may publish pages to the web (off unless allowed).

People change these later in Settings → Agents, without a new token; the server checks them on every call. Its tokens are good at /mcp only (RFC 8707). An agent that can’t open a browser, such as one on a server, uses a token made in the app (Settings → Agents → Create token) or on the account page (/account → Agents → Make a token), sent as Authorization: Bearer <token>. The app shows it once, with the address and ready-made configuration (the standard mcpServers JSON, a Claude Code command, YAML): Tokens. Any MCP client works, for example with curl:

Terminal window
curl -s https://notes.example.com/mcp \
-H "Authorization: Bearer $NOTES_MCP_TOKEN" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'

or Hermes Agent, in its config.yaml:

mcp_servers:
drusite:
url: "https://notes.example.com/mcp"
headers:
Authorization: "Bearer ${NOTES_MCP_TOKEN}"

Revoking a token or disconnecting an agent ends its access at once. Rotating a token (POST /api/v1/agent-tokens/<id>/rotate, Rotate in the app) gives the same entry, with its name, permissions, workspaces and expiry, a new secret, and refuses the old one in the same transaction.

[agents]
enabled = true # false turns /mcp off
max_token_days = 365 # the longest an account-page token can last
# mcp_hosts = ["drusite:8080"] # other names agents reach /mcp by
# allow_insecure_client_ids = false # development only

/mcp answers only requests addressed to public_url’s host, which stops DNS rebinding. An agent beside the server that calls it by another name, such as a container on the same Docker network calling http://drusite:8080/mcp, is refused with “Host header is not allowed” until that name is in mcp_hosts, as the request’s Host gives it (with its port, if it has one).

When the server fetches a client’s metadata document it refuses addresses on private networks, unless allow_insecure_client_ids is on (only for testing a client on your own machine). Your proxy must pass /mcp, /oauth/… and /.well-known/oauth-protected-resource through to the server.

Encrypted workspaces through /mcp

The server can’t read an end-to-end encrypted workspace by itself. A headless agent (a bot on a server, say) uses one through the server’s own /mcp with a token made in the app: the person’s device puts the workspace’s key in the token, wrapped so that only the token opens it. The server keeps that wrap, the token’s public keys and the hash it looks the token up by: nothing that opens the workspace without the token itself. On each request it opens the key with the token presented, decrypts only what the call needs, answers, and drops it. There’s still one copy of the notes, the encrypted one in your database; nothing readable is written to the database, the object store or the logs, and search decrypts and scans in the request instead of keeping an index.

  • One person’s token, for the workspaces they chose. It reads what everyone in the workspace can, not their private pages. A token from the account page carries no key, so it can’t open encrypted workspaces.
  • Edits are sealed and signed with the token’s own key, which the person’s device certified, so other members’ devices check them like any device’s. They’re listed in What agents changed, sealed, and undone from a member’s device.
  • Key changes: when the workspace’s key is replaced, the device that replaces it gives the new key to every live token. Revoking a token, or its running out, deletes its keys at once and replaces the workspace’s key without it.
  • Rotating does all that making a token does, for the new secret: the app derives new key pairs from it, certifies them with the person’s account key, and wraps each workspace’s current key to the new token. The old token’s wraps are deleted in the same transaction, and the workspace’s key is replaced, so the old secret opens nothing written after. The old token’s certificate is kept (its signed edits still verify).
  • Members see it in the workspace’s member list, with whose it is.
  • Publishing a page uploads a readable copy of that one page, as publishing from the app does.

What this trusts: whoever runs your server while an agent uses it could capture the token and read that workspace, and so could whoever holds the token. The security design has the details.

The MCP library’s own logs show every request and result in full at debug level, so the server holds them at warn whatever RUST_LOG says.