Skip to content

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

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