# Cielara Agent Memory MCP Server

A memory-only slice of the unified Cielara MCP server (`../mcp_server`). It
exposes **only the Agent Memory tools** — ontology and world-model tools are
omitted.

## Tools

| Tool | Type | Description |
|------|------|-------------|
| `search_memories(query, collection?)` | Read | Hybrid search (semantic + BM25 + cue anchors). Returns ranked memories. |
| `ask_memories(question, collection?)` | Read | LLM-grounded Q&A with async polling. Returns answer + source citations. |
| `list_memory_collections()` | Read | List available memory collections. |

## Configuration

| Env var | Required | Purpose |
|---------|----------|---------|
| `MEMORY_API_URL` | yes | Agent Memory API base, e.g. `http://agent-memory:8001` |
| `CIELARA_BACKEND_URL` | no | Only used to ship tool-call audit events to `/api/mcp-audit/`. Audit is skipped when unset. |
| `MCP_SECRET_TOKEN` | http only | Bearer token gate for HTTP transport. Required for a Claude.ai connector. |
| `MEMORY_API_TIMEOUT` | no | Per-request timeout in seconds (default 120). |
| `METRICS_AUTH_TOKEN` | no | When set, `/metrics` requires this bearer token. |
| `AUDIT_ENABLED` | no | `false` to disable audit (default on, but also requires `CIELARA_BACKEND_URL`). |

## Run

```bash
# STDIO (Claude Desktop / Claude Code)
MEMORY_API_URL=http://localhost:8001 python -m memory_mcp

# HTTP behind a TLS-terminating proxy, with auth
MEMORY_API_URL=http://agent-memory:8001 \
MCP_SECRET_TOKEN=<token> \
python -m memory_mcp --transport http --port 8888
```
