Stash

v1.0.0Knowledge & Memorystable

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.

aiai-agentsai-memorymemory
Share:
698
Stars
0
Downloads
0
Weekly
0/5

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

Persistent agent memory in Postgres
Episode and fact storage
Self-hosted single-binary deployment
alash3al

Maintainer

LicenseApache-2.0
Languagego
Versionv1.0.0
UpdatedMay 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx stash

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 .env
2

Configure 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=1536
3

Start 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 -d
4

Add 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"
    }
  }
}
5

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.

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.

Quick Config Preview

{ "mcpServers": { "stash": { "command": "npx", "args": ["-y", "stash"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides