Integration: Claude Code
Coverage status
Section titled “Coverage status”| Path | Status | Notes |
|---|---|---|
| MCP server | ✅ Supported | Claude Code has first-class MCP support via CLAUDE.md |
| Harness | ✅ Supported | ANTHROPIC_BASE_URL proxy for full turn capture |
| Extension | — | Claude Code is a CLI; no browser surface |
Confidence: High. Claude Code’s MCP integration is the primary use case MemStrata was designed around. Both paths are tested on every release.
Setup: MCP path (recommended)
Section titled “Setup: MCP path (recommended)”Claude Code reads MCP server configuration from CLAUDE.md or ~/.claude/settings.json.
1. Start the MemStrata MCP server
memstrata serve --port 80802. Register in Claude Code
Add to your project’s CLAUDE.md or ~/.claude/settings.json:
{ "mcpServers": { "memstrata": { "command": "memstrata", "args": ["mcp"], "env": {} } }}Or use the stdio transport (recommended — no separate port needed):
memstrata mcp --stdioClaude Code will launch MemStrata as a subprocess and communicate via stdin/stdout. This is the cleanest setup — no port to manage.
3. Verify
In a Claude Code session, run:
/mcpYou should see memstrata listed as a connected server with its available tools (context_query, index_status, savings_summary).
Setup: Harness path
Section titled “Setup: Harness path”The harness proxies all Anthropic API calls, compressing context before each request.
1. Start the harness
memstrata serve --port 80802. Set the API base URL
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropicAdd this to your shell profile so Claude Code picks it up automatically.
3. Verify
Run claude and ask: “What are the main modules in this codebase?” The harness log (memstrata logs --tail 10) should show compression stats.
What’s captured
Section titled “What’s captured”| Signal | Captured? | Notes |
|---|---|---|
| Claude Code chat turns | ✅ Yes | Full context compression via MCP or harness |
| Agent mode (multi-turn) | ✅ Yes | Each sub-turn is captured and compressed |
| Tool calls (Bash, Edit, Read) | ✅ Yes | Tool results are included in context accounting |
/compact command | ✅ Yes | MemStrata’s savings are additive with compaction |
| Thinking tokens (extended thinking) | ⚠️ Monitored | Token counts tracked; thinking blocks not compressed (they’re generated, not input) |
| File reads from the AI | ✅ Yes | MemStrata intercepts Read tool context before it’s sent |
MCP tools exposed
Section titled “MCP tools exposed”MemStrata exposes three tools to Claude Code via MCP:
| Tool | Description |
|---|---|
context_query | Returns a compressed context slice for a given query. Claude Code calls this when it needs codebase context. |
index_status | Returns the current index state (file count, last updated, coverage). |
savings_summary | Returns the session’s token savings and dollar estimate so far. |
Troubleshooting
Section titled “Troubleshooting”memstrata not showing in /mcp
Check that the MCP config is in the right file and that memstrata mcp --stdio runs without error.
Harness returns 502 Bad Gateway
The harness is running but can’t reach Anthropic. Check ANTHROPIC_API_KEY is set and that https://api.anthropic.com is reachable.
Context feels wrong or hallucinated
Run memstrata status to verify the project index is fresh. If the last indexed time is stale, run memstrata index.