Add MCP server for Claude Code memory integration
- Create stdio MCP server wrapping core memory functions (query, show, list, children, add, link) - Add CLAUDE.md with memory-querying instructions for Claude - Register MCP server in .mcp.json - Document MCP setup and tools in USAGE.md
This commit is contained in:
41
USAGE.md
41
USAGE.md
@@ -260,3 +260,44 @@ The web server exposes these endpoints under `/api`:
|
||||
| `DELETE` | `/api/edges/:id` | Delete edge |
|
||||
| `GET` | `/api/graph` | Get full graph (nodes + edges) for visualization |
|
||||
| `POST` | `/api/search` | Search. Body: `{ text, options?: { kind?, tags?, limit?, includeStale? } }` |
|
||||
|
||||
---
|
||||
|
||||
## MCP Server (Claude Code Integration)
|
||||
|
||||
Cortex includes an MCP (Model Context Protocol) server that exposes memory tools directly to Claude Code.
|
||||
|
||||
### Setup
|
||||
|
||||
1. Build the project: `npm run build`
|
||||
2. Ensure `.mcp.json` exists in the project root:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"memory": {
|
||||
"command": "node",
|
||||
"args": ["./dist/mcp/index.js"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Restart Claude Code — the memory tools will appear automatically.
|
||||
|
||||
### MCP Tools
|
||||
|
||||
| Tool | Description | Parameters |
|
||||
|---|---|---|
|
||||
| `memory_query` | Hybrid search (BM25 + vector + freshness) | `text`, `kind?`, `limit?` |
|
||||
| `memory_show` | Show node by ID or prefix with connections | `id` |
|
||||
| `memory_list` | List nodes with filters | `kind?`, `status?`, `tags?`, `limit?` |
|
||||
| `memory_children` | List children of a node | `id`, `kind?` |
|
||||
| `memory_add` | Add a new node | `kind`, `title`, `content?`, `tags?`, `status?`, `sections?` |
|
||||
| `memory_link` | Create an edge between nodes | `fromId`, `toId`, `type` |
|
||||
|
||||
### Manual Testing
|
||||
|
||||
```bash
|
||||
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}' | node dist/mcp/index.js
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user