Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,13 @@ Three-layer model — safe read-only tools run silently; everything else asks:

Full MCP client, both transports:

- **stdio** — local servers, configured in `.klaatai/mcp.json`, built-in presets (filesystem, GitHub, Postgres, Puppeteer, Brave Search, Fetch, …)
- **stdio** — local servers, configured in `.klaatai/mcp.json`, built-in presets (filesystem, GitHub, Postgres, Puppeteer, Brave Search, Fetch, Agent Memory, …)
- **Streamable HTTP** — remote servers via `"url"` config or `/mcp add <url>`; SSE and JSON responses, session management, and **OAuth 2.1** (discovery + dynamic client registration + PKCE browser flow) when the server requires auth — tokens cached in `~/.klaatai/mcp-oauth.json`

Manage live with `/mcp`.

**Persistent memory across sessions.** `/mcp enable agentmemory` wires up [agentmemory](https://github.com/rohitg00/agentmemory), a local memory server that remembers architectural decisions, project conventions, and debugging findings between sessions. It complements the built-in `/memory` distillation rather than replacing it. Start the server with `npx @agentmemory/agentmemory start`, then either enable the preset above or run `agentmemory connect klaatcode --with-hooks`, which additionally installs lifecycle hooks into `~/.klaatai/hooks.json` for automatic capture. Everything is opt-in, and both the hooks and the MCP tools fail open when the server isn't running.

### Git Integration

```
Expand Down Expand Up @@ -324,7 +326,7 @@ Run shell commands on agent lifecycle events. Hooks receive a JSON payload on st
}
```

Events: `before_message` · `after_message` · `before_tool` · `after_tool`
Events: `session_start` · `before_message` · `after_message` · `before_tool` · `after_tool` · `session_end`

### Project Rules

Expand Down
30 changes: 30 additions & 0 deletions src/mcp/presets.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, expect, test } from "bun:test";
import { MCP_PRESETS, getMCPPreset } from "./presets.js";

describe("MCP presets", () => {
test("every preset has a unique id and a runnable config", () => {
const ids = MCP_PRESETS.map(p => p.id);
expect(new Set(ids).size).toBe(ids.length);
for (const preset of MCP_PRESETS) {
expect(preset.name.length).toBeGreaterThan(0);
expect(preset.description.length).toBeGreaterThan(0);
expect(preset.config.command || preset.config.url).toBeTruthy();
}
});

test("getMCPPreset resolves case-insensitively", () => {
expect(getMCPPreset("AgentMemory")?.id).toBe("agentmemory");
expect(getMCPPreset("nope")).toBeUndefined();
});

test("agentmemory preset spawns the published MCP shim via npx", () => {
const preset = getMCPPreset("agentmemory");
expect(preset).toBeDefined();
expect(preset!.config.command).toBe("npx");
expect(preset!.config.args).toEqual(["-y", "@agentmemory/mcp"]);
// Env is read from the shell when the server spawns, not baked in at
// enable-time — same convention as the GITHUB_TOKEN / DATABASE_URL presets.
expect(preset!.config.env).toBeUndefined();
expect(preset!.envVars).toContain("AGENTMEMORY_URL");
});
});
11 changes: 11 additions & 0 deletions src/mcp/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ export const MCP_PRESETS: MCPPreset[] = [
description: "SQLite access via MCP",
},
},
{
id: "agentmemory",
name: "Agent Memory",
description: "Persistent memory across sessions — recall past decisions, conventions, and debugging findings",
envVars: ["AGENTMEMORY_URL", "AGENTMEMORY_SECRET"],
config: {
command: "npx",
args: ["-y", "@agentmemory/mcp"],
description: "Persistent agent memory via MCP — needs a local server (npx @agentmemory/agentmemory start); AGENTMEMORY_URL defaults to http://localhost:3111",
},
},
];

/** Look up a preset by id (case-insensitive). */
Expand Down
Loading