External agents (MCP)
mdai can let AI agents that run on your computer — Claude Code, for example — work with the vault that is open in mdai, through MCP (Model Context Protocol). It is off until you turn it on.
Turning it on
Section titled “Turning it on”- Open Settings → AI.
- Under External agents (MCP), choose On.
- mdai shows the command that connects Claude Code. Click Copy under it and run it in a terminal. It has this shape:
claude mcp add --transport http mdai http://127.0.0.1:<port>/mcp --header "Authorization: Bearer <token>"The port and the token are your own; Copy takes the whole line with them.
Claude Code saves this connection only for the folder you run the command
in. To use mdai from Claude Code in any folder, start the command with
claude mcp add -s user instead of claude mcp add.
- The connection is open only on your own computer (
127.0.0.1), and only while mdai is running with the setting On. - A request without the token is refused.
- Choosing Off closes it.
What an agent can do
Section titled “What an agent can do”- List the Markdown notes in the open vault.
- Read any of them.
- Propose new content for a note.
- Ask whether you accepted or rejected a proposal.
An agent sees only the notes of the vault that is open. A path that points
outside the vault, or into a hidden folder such as .git, is refused.
What a connected tool does with what it reads is governed by that tool’s own terms.
Proposals
Section titled “Proposals”When an agent proposes a change, mdai opens the note and shows Change proposed by an agent: the difference line by line, and the agent’s note about what it changed.
- Reject — nothing happens to the file. Reject is the default button.
- Accept — the change goes into the editor and is saved like your own typing. ⌘Z / Ctrl+Z undoes it.
Nothing is written to your file until you click Accept.