Add MCP server: expose memwalk as tools for Claude Code / opencode / agents
New `memwalk mcp` subcommand starts a stdio MCP server exposing four tools: ask, standup, status, update. The underlying memba Session is loaded lazily on the first call that needs the model, then reused for the lifetime of the process — first query ~2s, subsequent <500ms. - memwalk/mcp_server.py — Server + tool list/dispatch using mcp SDK - memwalk/cli.py — `memwalk mcp` subcommand wires it up - pyproject.toml — mcp>=1.0.0 dependency - README.md — setup instructions for Claude Code and opencode Verified locally: tools/list returns all 4, tools/call status returns the expected JSON without loading the model. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,55 @@ saved to `~/.memwalk/current.memb` via memba.
|
||||
`memwalk ask` and `memwalk standup` load that state and query it. The model
|
||||
recalls themes, projects, and trajectory across processes and reboots.
|
||||
|
||||
## Use from an agent (MCP)
|
||||
|
||||
memwalk ships an MCP server so Claude Code / opencode / any MCP-aware
|
||||
agent can query your memory as native tools.
|
||||
|
||||
```bash
|
||||
memwalk mcp # starts a stdio MCP server
|
||||
```
|
||||
|
||||
Tools exposed: `ask(question)`, `standup()`, `status()`, `update()`.
|
||||
The Session loads lazily on the first call that needs it, then stays in
|
||||
memory — first call ~2 s, subsequent calls <500 ms.
|
||||
|
||||
### Configure Claude Code
|
||||
|
||||
Easiest way (Claude Code CLI):
|
||||
|
||||
```bash
|
||||
claude mcp add memwalk -- memwalk mcp
|
||||
```
|
||||
|
||||
Or by hand, in `~/.claude/mcp_servers.json` (path may vary by version):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"memwalk": {
|
||||
"command": "memwalk",
|
||||
"args": ["mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Restart Claude Code. Tools appear as `mcp__memwalk__ask`,
|
||||
`mcp__memwalk__standup`, etc.
|
||||
|
||||
### Configure opencode
|
||||
|
||||
opencode uses its own MCP block in `opencode.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"memwalk": { "command": "memwalk", "args": ["mcp"] }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user