Skip to content

Attachment modes: MCP or CLI

You choose how your agent reaches a mount: through the tools of one MCP server, or through its shell. Both modes read the same files. They differ only in how the agent searches, calls source tools, and saves notes.

Use MCP mode unless your agent has a shell and you want fewer tool schemas in its context.

MCP mode is the default. stash attach adds a server named stash to each harness:

Terminal window
stash attach ops

The agent gets a search tool, a note tool when the mount has [extraction], and the tools of each MCP or Gateway source. Stash saves each result file that fits the result and cache limits, while the tool returns a compact view.

See the stash mcp reference for the tools and their inputs.

In CLI mode, Stash adds no MCP server. The agent uses its shell:

Terminal window
ls /tmp/ops-context/
cat /tmp/ops-context/_sources/incidents.md
grep -rl "checkout latency" /tmp/ops-context/agentcore-memory/incidents/
stash search ops "checkout latency" --path "/agentcore-memory/incidents/*"
stash tool call ops ticketing/get_ticket --input '{"id": "INC-4412"}'
jq '.comments | length' /tmp/ops-context/mcp/ticketing/_tools_results/get_ticket/*/content/1.json
stash note save ops --topic "INC-4412 mitigation plan" < plan.md

Attach with --no-mcp:

Terminal window
stash attach ops --no-mcp

The steering block names the CLI commands and the schema file of each source tool. See the references for stash search, stash tool call, and stash note save.

MCP modeCLI mode
Agent toolsStash search, notes, and source toolsNo Stash tools
Agent requirementsA file readerA shell and a file reader
CallsMCP tool callsstash commands
Good fitAn agent that prefers tools or has no shellA coding agent with a shell

StrandsStash uses MCP mode by default. Turn off its mcp option for CLI mode, and give the agent a shell.

See Strands Agents for the Python and TypeScript setup.

Run attach again for the same mount:

Terminal window
stash attach ops --no-mcp
stash attach ops

Stash updates its steering block and MCP entry. It keeps the rest of each file. Start a new agent session so the harness reads the new steering.

Both modes install a generated steering block and harness hooks.

The steering block tells the agent where the mount is and how to use it. Stash keeps every byte outside its markers. The stash attach reference lists the steering, hook, and MCP files for each harness. The steering also tells the agent to use filters, limits, and queries so each tool returns only what the task needs.

The hooks warm the mount at session start and capture each completed turn. They also ask for notes when the mount has [extraction]. The stash hook reference owns the event behavior, output, and exit codes.

A Strands agent gets the same steering and session context through StrandsStash. It does not need harness files.

With [extraction], Claude Code and Codex can ask for a note after a tool call. Kiro can ask at the end of a turn. The agent can continue when there is nothing to record.

See The local store for note extraction and stash hook for the request threshold and harness output.