You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cavemem/reference/mcp.md
+82-10Lines changed: 82 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,89 @@ title: MCP
4
4
sidebar_position: 2
5
5
---
6
6
7
+
cavemem exposes four tools over an MCP stdio server, plus an opt-in `enrich` tool. The design goal is **progressive disclosure**: hits are compact until the agent asks for more.
7
8
8
-
Progressive disclosure: `search` and `timeline` return compact results; `get_observations` fetches full bodies.
9
+
The recommended workflow is a three-layer pattern:
1.`search` (or `list_sessions` → `timeline`) to get a compact index.
12
+
2. Review IDs.
13
+
3.`get_observations` with the filtered set.
17
14
18
-
`enrich` is off by default. When `enrich.enabled` is `false` the tool is not registered and cavemem makes no network call, ever. When enabled, it searches DuckDuckGo, stores compressed plain-text extracts as observations (tagged `source: web` + URL for provenance), and returns them.
15
+
Following this pattern saves ~10× tokens versus fetching full bodies upfront.
19
16
20
-
---
17
+
## `search`
18
+
19
+
Find observations matching a natural-language query.
Content is expanded to human-readable form by default. Pass `expand: false` to request the compressed form (useful for audit or for agents that understand the caveman dialect directly).
59
+
60
+
## `list_sessions`
61
+
62
+
List recent sessions in reverse chronological order.
63
+
64
+
```json
65
+
{
66
+
"name": "list_sessions",
67
+
"input": { "limit": 20 }
68
+
}
69
+
```
70
+
71
+
Returns: `[ { id, ide, cwd, started_at, ended_at } ]`. Use `id` with `timeline` to navigate within a session.
72
+
73
+
## `enrich` (opt-in)
74
+
75
+
Search the web via DuckDuckGo's HTML endpoint, store plain-text extracts of the top results as observations, and return them. **Off by default**: the tool is only registered when `enrich.enabled` is `true` in settings. When it is off, the tool does not exist and cavemem makes no network call, ever. Queries leave the machine only when the user has enabled the setting **and** the agent explicitly calls the tool.
Each result page is fetched with a 500 KB byte cap and the `enrich.timeoutMs` timeout, stripped to plain text, and truncated to 2000 characters. Extracts are stored through the normal write path (compressed, privacy-redacted) under a dedicated `enrich` session, with `metadata: { source: "web", url, query, note? }` for provenance. `query` and `note` are scrubbed (private tags + secret patterns) before they reach metadata, and source URLs are preserved byte-for-byte. `enrich.maxResults` (default 3, max 5) bounds how many results are fetched and stored. If the search fails or nothing can be fetched, the call returns an error and nothing is stored.
87
+
88
+
Only public hosts are fetched: every URL and every redirect hop (followed manually, capped at 3) must be http(s) to a non-private address. Loopback, RFC1918, link-local (`169.254.0.0/16`, e.g. cloud metadata endpoints), and unique-local targets — including obfuscated numeric forms — are rejected without a request, protecting against SSRF via malicious result links or redirects.
89
+
90
+
## Contract stability
91
+
92
+
Fields may be added. Existing fields will not be removed or renamed within a minor version.
0 commit comments