Edit through a Local MCP Client
Use an explicitly enrolled client to inspect unsaved text, edit, undo, redo and save one document. Then revoke access while keeping the editor open.
This exercise requires Linux, Racket, a source checkout with local MCP support and a client that can inspect tool arguments and structured results. It covers the current source build; packaged availability follows the guide for your installed release. Familiarity with Undo and Redo and Work with Local Agents is useful.
Prepare a private exercise
Use the disposable guide area described in Prepare the User Guide Exercises. This chapter creates its own separate directory and a small file from a terminal:
mkdir -p "$HOME/odra-guide/mcp/config/odra" "$HOME/odra-guide/mcp/work"
printf 'Small draft\n' > "$HOME/odra-guide/mcp/work/note.txt"
From the source checkout, build the development composition, create an exclusive runtime directory, and launch the exercise with its own configuration and state:
make development-build
odra_mcp_runtime=$(mktemp -d /tmp/om.XXXXXX)
printf 'Exercise runtime: %s\n' "$odra_mcp_runtime"
ODRA_DEVELOPMENT_XDG_CONFIG_HOME="$HOME/odra-guide/mcp/config" \
XDG_STATE_HOME="$HOME/odra-guide/mcp/state" \
XDG_DATA_HOME="$HOME/odra-guide/mcp/data" \
XDG_CACHE_HOME="$HOME/odra-guide/mcp/cache" \
XDG_RUNTIME_DIR="$odra_mcp_runtime" \
scripts/run-development-editor.sh "$HOME/odra-guide/mcp/work/note.txt"
The enrollment lasts for this editor instance. Each operation still has a deadline; obtain fresh captures after an operation expires. Do not assume that a timed-out edit failed.
Edit unsaved text and use history
Discover and invoke
cursor-buffer-startagainst its explicit target.Refresh
odra_sessionsand theinsert-textcontract. Submit an insertion ofClient:with a new request identity such asguide.insert.one.Check that the result is confirmed, then refresh targets and read the buffer again. It now contains
Client: Small draftfollowed by a newline.From another terminal, inspect the file:
cat "$HOME/odra-guide/mcp/work/note.txt"It still contains the original
Small draftline. The client edited the live unsaved buffer; it did not save the file.Discover
undo, refresh its targets and invoke it withguide.undo.one. Read again and confirm the original buffer text returns.Discover
redo, refresh targets and invoke it withguide.redo.one. Read again and confirm the client prefix returns.
Use a different request identity for each new intent. Reusing an identical
completed request asks for its retained result; it does not perform another edit.
If the response is lost, inspect guide.insert.one through odra_request before
issuing another insertion. An outcome-unknown result requires reconciliation.
Check a human editing conflict
Capture the current insertion contract and targets without invoking it. Type a
small change in the editor yourself. Now submit a new request identity, such as
guide.stale.capture, using the capture from before your human edit.
The old capture is rejected and performs no edit. Refresh targets and read the buffer to confirm the human text remains. If you still want another insertion, create a fresh request against the new revision. The client must not hide a conflict by silently selecting a different buffer or reusing human focus.
Previous: Work with Local Agents · User Guide · Next: Build a Linked Knowledge Base with Roman