alaya-mcp — Claude Code MCP server: what it does, how to install
Local memory engine for AI coding agents that builds a knowledge graph in SQLite and prunes stale memories using cognitive decay.
claude mcp add --env ALAYA_LLM_API_KEY=<ALAYA_LLM_API_KEY> --env ALAYA_LLM_API_URL=<ALAYA_LLM_API_URL> --env ALAYA_LLM_MODEL=<ALAYA_LLM_MODEL> --env ALAYA_DB=<ALAYA_DB> --transport stdio alaya-mcp -- npx -y alaya-mcpWhat alaya-mcp does
alaya-mcp runs an embeddable Rust memory core inside a local SQLite file at ~/.alaya/memory.db. It captures conversation episodes and maps extracted entities into an associative graph.
Memory handling mimics biological principles. Retrieved items form stronger associations through Hebbian rules, while unaccessed entries decay under Bjork dual-strength logic. The tool exposes operations like remember, recall, and neighbors.
External LLM credentials remain optional. When vector embeddings are missing, the engine falls back to BM25 search and lets the agent handle extraction.
What it helps with
- retrieve relevant past facts without sending full conversation transcripts
- organize assistant context into an associative SQLite graph
- prune stale details automatically with dual-strength decay
- inspect relationships between concepts using neighbors
Example prompts for the agent
- Recall our previous decisions regarding authentication architecture via alaya.
- Save this discussion into alaya and update concept links.
- Run the alaya lifecycle routine to maintain memory weights.
How to install alaya-mcp
Platform CLI
claude mcp add --env ALAYA_LLM_API_KEY=<ALAYA_LLM_API_KEY> --env ALAYA_LLM_API_URL=<ALAYA_LLM_API_URL> --env ALAYA_LLM_MODEL=<ALAYA_LLM_MODEL> --env ALAYA_DB=<ALAYA_DB> --transport stdio alaya-mcp -- npx -y alaya-mcpReplace <…> with your own values
Platform CLI
codex mcp add alaya-mcp --env ALAYA_LLM_API_KEY=<ALAYA_LLM_API_KEY> --env ALAYA_LLM_API_URL=<ALAYA_LLM_API_URL> --env ALAYA_LLM_MODEL=<ALAYA_LLM_MODEL> --env ALAYA_DB=<ALAYA_DB> -- npx -y alaya-mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"alaya-mcp": {
"command": "npx",
"args": [
"-y",
"alaya-mcp"
],
"env": {
"ALAYA_LLM_API_KEY": "<ALAYA_LLM_API_KEY>",
"ALAYA_LLM_API_URL": "<ALAYA_LLM_API_URL>",
"ALAYA_LLM_MODEL": "<ALAYA_LLM_MODEL>",
"ALAYA_DB": "<ALAYA_DB>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"alaya-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"alaya-mcp"
],
"env": {
"ALAYA_LLM_API_KEY": "<ALAYA_LLM_API_KEY>",
"ALAYA_LLM_API_URL": "<ALAYA_LLM_API_URL>",
"ALAYA_LLM_MODEL": "<ALAYA_LLM_MODEL>",
"ALAYA_DB": "<ALAYA_DB>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e ALAYA_LLM_API_KEY=<ALAYA_LLM_API_KEY> -e ALAYA_LLM_API_URL=<ALAYA_LLM_API_URL> -e ALAYA_LLM_MODEL=<ALAYA_LLM_MODEL> -e ALAYA_DB=<ALAYA_DB> alaya-mcp npx -y alaya-mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about alaya-mcp
How to install alaya-mcp in Claude Code?
Run this command in your terminal: claude mcp add alaya-mcp -e ALAYA_LLM_API_KEY=<ALAYA_LLM_API_KEY> -- npx -y alaya-mcp. Replace <ALAYA_LLM_API_KEY> with your secret key.
What does alaya-mcp do?
It provides a structured local memory store for assistants. Conversations turn into graph entities with cognitive forgetting rather than flat files.
Are ALAYA_LLM environment variables required?
Those parameters are optional. Without external endpoints, the server runs BM25 text retrieval and relies on the client agent for fact extraction.