MCP source
An mcp source connects any Model Context Protocol (MCP) server to the mount. You use
it when a system you need, such as a ticket tracker or a log store, already has an MCP
server. Stash calls its tools for the agent, writes each whole result to disk, and gives
the agent a preview that fits the context window.
What the agent sees
Section titled “What the agent sees”The source shows tools only. It has no records to browse and no search.
/tmp/ops-context/mcp/ticketing/ _tools/ get_ticket.json the JSON schema of the tool search_tickets.json _tools_results/ get_ticket/20261122T093005123Z-a1b2c3d4/ call_metadata.json the input, the error, and the facts of each block content/1.json the whole result, as pretty JSON_sources/ticketing.md lists each tool with its required arguments and its schema file.
stash tool list ops prints the same list.
Call a tool
Section titled “Call a tool”stash tool call ops ticketing/get_ticket --input '{"id": "INC-4412"}'The command prints the result and writes it to _tools_results/. A result of at most
20,000 characters prints whole, and JSON lists print as compact tables that keep every
value. A longer result prints a preview, and names the file that holds the rest. The
agent then reads only the part it needs:
jq '.comments[] | select(.author == "oncall")' \ /tmp/ops-context/mcp/ticketing/_tools_results/get_ticket/20261122T093005123Z-a1b2c3d4/content/1.jsonStash calls the tool one time and never retries, because a tool can change data. A call
that reached the tool exits 0, also when the tool reported an error. A call
runs for up to 300 seconds. See
Progressive disclosure for how the preview
is built.
In MCP mode, the agent calls the same tool as ticketing__get_ticket on the stash MCP
server. See Attachment modes.
Configure it
Section titled “Configure it”A remote server takes a url. A local server takes a command, which Stash runs.
[sources.ticketing]kind = "mcp"description = "Incident tickets and their comments"url = "https://tickets.example.com/mcp"auth = { bearer = { env = "TICKETING_MCP_TOKEN" } }
[sources.git]kind = "mcp"description = "The git history of the checkout service"command = "uvx"args = ["mcp-server-git", "--repository", "/home/me/checkout"]| Key | Default | What it does |
|---|---|---|
url | none | A remote server’s MCP endpoint, over Streamable HTTP. |
command | none | The program that runs a local server, over stdin and stdout. |
args | [] | The arguments of command. |
env | {} | The variables of command: text, { from_env }, { file }, or { command }. |
auth | none | For a url: none, bearer, or sigv4. |
headers | {} | For a url: more headers, each from env or file. |
protocol_version | 2025-11-25 | The MCP version that the client asks for. |
Set exactly one of url and command. The command and args that a server’s README
gives for other MCP clients go here unchanged. See mcp for
every rule.
How a local server runs
Section titled “How a local server runs”- Stash starts the program when the mount starts, and stops it when the mount stops. Each source runs its own copy.
- The program gets only a short list of the daemon’s variables, such as
PATH,HOME, and the proxy variables. It doesn’t get the AWS keys or tokens of the daemon. Give it what it needs inenv. - The program runs as your user, so it can read your files. Run only a server you trust.
- If the program exits, the next request starts it again. A call that was in flight isn’t sent again.
- A server that announces
notifications/tools/list_changedgets up to 15 seconds to add its tools after the first list.
Limits
Section titled “Limits”- The tools are the list from when the mount started. A tool that the server adds later shows after the mount starts again.
- A result larger than 32 MiB isn’t kept. A file larger than 25% of
cache_max_bytesisn’t written. The preview still prints. - A server that can’t list its tools fails only its own source. Its
_sources/NAME.mdpage gives the reason. - Stash serves MCP tools only: no resources and no prompts.
- Stash doesn’t do OAuth. For a server that needs it, give a bearer token in a file:
auth = { bearer = { file = "/path/to/token" } }.