Stash
Stash — persistent memory layer for AI agents. Episodes, facts, and working context stored in Postgres. MCP server included. Self-hosted, single binary, no cloud required.
What is Stash?
Stash is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to stash — persistent memory layer for ai agents. episodes, facts, and working context stored in postgres. mcp server included. self-hosted, single binary, no cloud required.
Stash — persistent memory layer for AI agents. Episodes, facts, and working context stored in Postgres. MCP server included. Self-hosted, single binary, no cloud required.
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Stash — persistent memory layer for AI agents. Episodes, fac
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx stashConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Stash
Stash is a self-hosted, persistent memory layer for AI agents backed by PostgreSQL and exposed as an MCP server over HTTP/SSE. It stores episodes, facts, relationships, patterns, contradictions, and goal state across agent sessions using a 9-stage consolidation pipeline, giving agents durable long-term context without relying on any external cloud service. Developers building multi-session agentic workflows who need agents to remember past interactions, track goals, and recall structured facts can run Stash as a single binary or via Docker and connect any MCP-compatible client to its SSE endpoint.
Prerequisites
- Docker and Docker Compose (recommended) or a Go 1.21+ toolchain for building from source
- A PostgreSQL database instance (included in the Docker Compose setup)
- An LLM provider API key compatible with the OpenAI API (e.g. OpenAI, Atlascloud, DeepSeek) for embedding and reasoning
- An MCP-compatible client such as Claude Desktop, Cursor, or Windsurf
Clone the repository and copy the env file
Clone the Stash repository and copy the example environment file so you can fill in your API credentials and model preferences.
git clone https://github.com/alash3al/stash.git
cd stash
cp .env.example .envConfigure environment variables
Edit the .env file and set your LLM provider credentials and model choices. STASH_OPENAI_API_KEY is required; the rest have sensible defaults.
# .env
STASH_OPENAI_API_KEY=your_api_key_here
STASH_OPENAI_BASE_URL=https://api.openai.com/v1
STASH_EMBEDDING_MODEL=text-embedding-3-small
STASH_REASONER_MODEL=gpt-4o
STASH_VECTOR_DIM=1536Start Stash with Docker Compose
Bring up the Stash server and its Postgres dependency. The MCP/SSE endpoint will be available at http://localhost:8080/sse once the containers are healthy.
docker compose up -dAdd the MCP server to your client config
Stash runs as an SSE-based remote MCP server. Point your MCP client at the SSE URL — no local command or binary is needed in the client config.
{
"mcpServers": {
"stash": {
"url": "http://localhost:8080/sse"
}
}
}Verify the three core tools are available
After connecting, the MCP client should expose three tools: init (start a session), remember (store an observation), and recall (retrieve relevant context). Ask the agent to recall something to confirm the connection.
Stash Examples
Client configuration
claude_desktop_config.json entry for Stash using its SSE endpoint. No local command is required because Stash runs as a remote HTTP server.
{
"mcpServers": {
"stash": {
"url": "http://localhost:8080/sse"
}
}
}Prompts to try
Example prompts that exercise the memory and recall capabilities of the Stash MCP server.
- "Remember that the project deadline for Acme Corp is June 30 and the main contact is Sarah."
- "What do you remember about my current projects and their deadlines?"
- "Store the fact that we decided to use PostgreSQL instead of MongoDB for the user service."
- "Recall everything you know about the Acme Corp project and summarize the current status."
- "What goals have we tracked so far in this project?"Troubleshooting Stash
SSE endpoint returns connection refused
Ensure the Docker containers are running with 'docker compose ps'. Check logs with 'docker compose logs stash' to see if the Postgres connection succeeded and the server started on port 8080.
Embedding or reasoning calls fail with API errors
Verify STASH_OPENAI_API_KEY is correct and that STASH_OPENAI_BASE_URL matches your provider's endpoint. If using a provider other than OpenAI, confirm the model names in STASH_EMBEDDING_MODEL and STASH_REASONER_MODEL are valid for that provider.
Recalled memories are missing or incomplete
The 9-stage consolidation pipeline runs asynchronously. Wait a moment after storing observations before recalling. If the issue persists, check Postgres storage with 'docker compose logs db' to ensure writes are committed.
Frequently Asked Questions about Stash
What is Stash?
Stash is a Model Context Protocol (MCP) server that stash — persistent memory layer for ai agents. episodes, facts, and working context stored in postgres. mcp server included. self-hosted, single binary, no cloud required. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Stash?
Follow the installation instructions on the Stash GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Stash?
Stash works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Stash free to use?
Yes, Stash is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
Stash Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to Stash? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Stash in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Stash?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.