Connect an AI assistant
Diffwell runs its own MCP server at https://app.diffwell.com/mcp. Add it to your assistant, and the first time the assistant uses it, a browser window asks you to sign in, pick a workspace and approve. There's no token to paste into a config file.
Claude Code
claude mcp add --transport http diffwell https://app.diffwell.com/mcp
Cursor
Add this to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project:
{
"mcpServers": {
"diffwell": { "url": "https://app.diffwell.com/mcp" }
}
}
GitHub Copilot in VS Code
code --add-mcp '{"name":"diffwell","type":"http","url":"https://app.diffwell.com/mcp"}'
Or add it to .vscode/mcp.json so everyone on the repo gets it:
{
"servers": {
"diffwell": { "type": "http", "url": "https://app.diffwell.com/mcp" }
}
}
What your assistant can do
| Tool | What it does |
|---|---|
search | Searches pages you can open and returns titles, links, breadcrumbs and a snippet. |
read_page | Returns a page as Markdown, with its link and version. Takes an id, a URL or SPACE/slug. |
list_spaces | Lists the spaces you can see. |
list_space_tree | Returns a space's folders and pages, up to five levels deep. |
read_comments | Returns a page's comment threads, open, resolved or both. |
create_page | Creates a page from Markdown. Write tool. |
edit_page | Replaces or appends to a page's Markdown, with an optional version check. Write tool. |
add_comment | Adds a comment to a page, or to a quoted passage in it. Write tool. |
Every call runs with your own access, through the same permission check as the app. A page you can't open is "not found" to your assistant too.
- Write tools are off by default. A workspace admin, or the owner of a personal workspace, turns them on under Settings → AI & API.
- AI edits are versions. Each one is labelled, for example "via Claude Code on behalf of Priya Shah", and you can compare or restore it like any other version.
- Admins stay in control. They can turn MCP off for the workspace, see 30 days of calls per person, and revoke any connected assistant.
Clients that prefer a header can also send a personal access token with the read scope as Authorization: Bearer.
Personal access tokens
Scripts and CI jobs use personal access tokens. Create one under Settings → AI & API. It's shown only once, so copy it then. Tokens start with dw_pat_ and go in the Authorization header:
curl -H "Authorization: Bearer $DIFFWELL_TOKEN" https://app.diffwell.com/v1/me
| Scope | Allows |
|---|---|
read | Reading only: every GET you could do in the app. |
write | Read, plus content changes: pages, folders, spaces, comments, attachments, imports and exports. |
admin | Write, plus workspace administration such as members, groups and permissions. You still need the admin role. |
- A token belongs to you and one workspace, and never has more access than you do. If you leave the workspace, it stops working on the next request.
- Each token has an expiry date and shows when it was last used. You can revoke yours at any time, and admins can revoke any token in the workspace.
- Some actions always need you to be signed in to the app, so a leaked token can't do them: changing your password, deleting your account, exporting your personal data and creating new tokens.
REST API
The API lives at https://app.diffwell.com/v1 and speaks JSON. It's the same API the app uses, so there's an API call for everything you can create or edit in the app, with the same permissions.
The OpenAPI spec is public. Use it to generate a client, or open it in your API tool of choice:
Create a page from Markdown in one call:
curl -X POST https://app.diffwell.com/v1/workspaces/$WORKSPACE_ID/spaces/$SPACE_ID/pages \
-H "Authorization: Bearer $DIFFWELL_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Deploy runbook", "markdown": "## Before you start\n\n- Check the release notes."}'
Pages as Markdown
Every page reads and writes as Markdown through /pages/{pageId}/markdown. Diffwell converts it with the editor's own rules, so what you send is what people see.
# Read the published page as raw Markdown
curl -H "Authorization: Bearer $DIFFWELL_TOKEN" \
-H "Accept: text/markdown" \
https://app.diffwell.com/v1/workspaces/$WORKSPACE_ID/pages/$PAGE_ID/markdown
# Replace the body from a local file
curl -X PUT -H "Authorization: Bearer $DIFFWELL_TOKEN" \
-H "Content-Type: text/markdown" \
--data-binary @runbook.md \
"https://app.diffwell.com/v1/workspaces/$WORKSPACE_ID/pages/$PAGE_ID/markdown?mode=replace"
- Replace or append.
mode=replacechanges only the blocks that differ, so comments stay attached to the text they were on.mode=appendadds to the end. - No lost edits. Send
expected_head_seq, and if the page changed since you read it, you get409 version_conflictinstead of overwriting someone. - Live for everyone. People with the page open see your change appear, and it shows up in the page's history.
- Drafts. Reads return the published page. Editors can add
state=draftto read the current draft, unpublished edits included.
The format is CommonMark with GitHub Flavored Markdown (tables, task lists, strikethrough), plus a few extensions that match GitHub where it has one:
| Block | Markdown |
|---|---|
| Callout | > [!WARNING] (GitHub alert syntax; also INFO and DANGER) |
| Highlighted lines | ```ts {3-5} |
| Diagram | ```mermaid |
| Whiteboard | ```excalidraw with the board's JSON |
| Toggle | <details><summary>…</details> |
| Table of contents | [[toc]] on its own line |
Docs from your repo
Keep a runbook or an ADR next to the code it describes and publish it on merge. This GitHub Actions step pushes docs/runbook.md to its Diffwell page whenever it changes on main:
on:
push:
branches: [main]
paths: [docs/runbook.md]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish to Diffwell
run: |
curl --fail-with-body -X PUT \
-H "Authorization: Bearer ${{ secrets.DIFFWELL_TOKEN }}" \
-H "Content-Type: text/markdown" \
--data-binary @docs/runbook.md \
"https://app.diffwell.com/v1/workspaces/${{ vars.DIFFWELL_WORKSPACE }}/pages/${{ vars.RUNBOOK_PAGE }}/markdown?mode=replace"
Use a token with the write scope, stored as a repository secret. Each publish becomes a version labelled with the token's name, so the page history shows what came from CI.
- Bring a folder in. Import a
.zipof Markdown files or an Obsidian vault into any space, from the app or withPOST /v1/workspaces/{id}/imports. - Take it all out. Export a page, a folder, a space or the whole workspace as Markdown. Folders become directories, so it drops straight into a repo.
Rate limits and errors
- Each token can make 100 requests a minute. Each person's assistants can make 60 MCP calls a minute.
- Responses carry
RateLimit-Limit,RateLimit-RemainingandRateLimit-Reset. Over the limit, you get429withRetry-After. - Errors have the same shape everywhere: a stable
codeto match on, a readablemessage, and arequest_idto quote if you contact us.
{
"error": {
"code": "version_conflict",
"message": "The page changed since you read it.",
"request_id": "01JD8Z…",
"details": { "current_head_seq": 420 }
}
}
Not there yet
These aren't available today. If one of them blocks you, tell us:
- Webhooks
- A command-line tool. The API and
curlcover the same ground for now. - MCP resources and prompts. The server offers tools only.
- IP allowlists for tokens
How tokens and assistants are secured is on the security page. New API features land in the changelog.