memory-forge
Optional integration with n8n for automating workflows and processes based on memory events and context changes.
Enables context memory for ChatGPT and other OpenAI models, with semantic search and session management.
Uses PostgreSQL for persistent storage of conversation contexts, ensuring data durability and reliability.
Leverages Redis for caching and fast retrieval of context data, improving response times.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@memory-forgeretrieve my recent memories"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง Memory Forge - Universal AI Context & Memory System
A production-ready MCP (Model Context Protocol) server for persistent AI memory across Claude, ChatGPT, and any LLM.
๐ฏ What is Memory Forge?
Memory Forge is a complete infrastructure solution that gives AI assistants persistent memory and context awareness. It includes:
MCP Server: TypeScript-based context server following the Model Context Protocol
Multi-Storage: PostgreSQL for persistence + Redis for speed + Qdrant for vector search
Auto-Save: Automatic conversation backup every 30 seconds
Multi-User: Support for unlimited users with isolated contexts
Deploy Anywhere: Local Docker, Railway, Vercel, or Smithery
Related MCP server: mnemory
๐ Quick Start (Under 5 Minutes!)
Option 1: One-Command Setup (Recommended)
curl -sSL https://raw.githubusercontent.com/cpretzinger/memory-forge/main/scripts/setup.sh | bashOption 2: Manual Setup
git clone https://github.com/cpretzinger/memory-forge.git
cd memory-forge
npm install
npm run setup๐ฆ What's Included
memory-forge/
โโโ src/ # TypeScript source code
โ โโโ server.ts # Main MCP server
โ โโโ handlers/ # Request handlers
โ โโโ storage/ # Storage adapters
โ โโโ types/ # TypeScript definitions
โโโ docs/ # Documentation
โ โโโ SERVICES.md # Service architecture
โ โโโ DOCKER.md # Docker setup guide
โ โโโ RAILWAY.md # Railway deployment
โ โโโ SMITHERY.md # Smithery deployment
โโโ scripts/ # Setup & deployment scripts
โ โโโ setup.sh # Universal setup script
โ โโโ deploy.ts # Deployment helper
โ โโโ test.ts # System test script
โโโ config/ # Configuration files
โ โโโ docker-compose.yml
โ โโโ railway.toml
โ โโโ smithery.yml
โโโ examples/ # Example implementations
โโโ .env.example # Environment template
โโโ claude-config.json
๐ ๏ธ Installation
Prerequisites
Node.js 20+
Docker (for local deployment)
2GB RAM minimum
10GB disk space
Step-by-Step Setup
Clone and Install
git clone https://github.com/cpretzinger/memory-forge.git
cd memory-forge
npm installConfigure Environment
cp examples/.env.example .env
# Edit .env with your settings (see Configuration section)Run Setup Script
npm run setup
# This will:
# - Check prerequisites
# - Generate secure passwords
# - Set up databases
# - Configure services
# - Start everythingTest Installation
npm test
# Should show all services as โ
Runningโ๏ธ Configuration
Environment Variables
Create a .env file from the example:
# Project Configuration
PROJECT_NAME=my-ai-assistant
NODE_ENV=production
# Database Credentials (generated by setup script)
POSTGRES_PASSWORD=<auto-generated>
REDIS_PASSWORD=<auto-generated>
QDRANT_API_KEY=<auto-generated>
# MCP Configuration
MCP_AUTH_TOKEN=<auto-generated>
MCP_PORT=3005
# API Keys (optional - add your own)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
# Service URLs (for production)
DATABASE_URL=postgresql://user:pass@host:5432/dbname
REDIS_URL=redis://:password@host:6379
QDRANT_URL=http://host:6333Claude Code Configuration
Add to your Claude desktop config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"memory-forge": {
"command": "node",
"args": ["/path/to/memory-forge/dist/bridge.js"],
"env": {
"MCP_SERVER_URL": "http://localhost:3005/mcp",
"MCP_AUTH_TOKEN": "your-token-here",
"AUTO_SAVE": "true"
}
}
}
}๐ข Deployment Options
Local Docker (Development)
npm run docker:up
# Access at http://localhost:3005Railway (Production)
npm run deploy:railway
# Follow prompts to configureSmithery (Managed MCP)
npm run deploy:smithery
# Or use Smithery CLI:
smithery publish cpretzinger/memory-forgeVercel (Serverless)
npm run deploy:vercel
# Configure environment variables in Vercel dashboard๐ Using with Smithery
Installing from Smithery Registry
Find the server:
smithery search memory-forgeInstall directly into Claude:
smithery install cpretzinger/memory-forgeOr add to your config manually:
{
"mcpServers": {
"memory-forge": {
"command": "npx",
"args": ["-y", "@smithery/memory-forge"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}Publishing Your Own Fork
Create Smithery account:
smithery authConfigure smithery.yml:
name: memory-forge
version: 1.0.0
description: Universal AI memory system
author: yourname
runtime: typescriptPublish:
smithery publish๐ Architecture
Services Overview
Service | Purpose | Port | Technology |
MCP Server | Context API | 3005 | TypeScript/Express |
PostgreSQL | Persistent storage | 5432 | PostgreSQL 16 |
Redis | Cache & sessions | 6379 | Redis 7 |
Qdrant | Vector search | 6333 | Qdrant |
n8n | Automation | 5678 | n8n (optional) |
Data Flow
graph LR
A[Claude/LLM] -->|MCP Protocol| B[MCP Server]
B --> C[Redis Cache]
B --> D[PostgreSQL]
B --> E[Qdrant Vectors]
C -->|Fast Read| B
D -->|Persistent| B
E -->|Semantic Search| B๐ง API Reference
Available Tools
store_context
Store conversation context with auto-save
{
sessionId?: string, // Optional, auto-generated if not provided
userId?: string, // Optional user identifier
context: object, // Required context data
metadata?: object // Optional metadata
}retrieve_context
Retrieve conversation context
{
sessionId?: string, // Optional, gets latest if not provided
userId?: string // Optional user filter
}search_context
Search through all contexts
{
query: string, // Required search query
limit?: number, // Optional result limit (default: 10)
semantic?: boolean // Use vector search (default: false)
}list_sessions
List all available sessions
{
userId?: string, // Optional user filter
limit?: number // Optional limit (default: 10)
}๐งช Testing
Run All Tests
npm testTest Specific Service
npm run test:mcp # Test MCP server
npm run test:storage # Test storage layer
npm run test:e2e # End-to-end testsManual Testing
# Test MCP endpoint
curl -X POST http://localhost:3005/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'๐ Security
Default Security Features
Auto-generated secure passwords (32+ characters)
Bearer token authentication on all endpoints
Isolated user contexts
Encrypted storage for sensitive data
No passwords in logs or error messages
Production Hardening
Use environment-specific
.envfilesEnable HTTPS/TLS in production
Set up firewall rules
Use secrets management (AWS Secrets Manager, etc.)
Enable audit logging
๐ Monitoring
Health Checks
# Check all services
npm run health
# Individual checks
curl http://localhost:3005/healthMetrics
Request latency
Storage usage
Active sessions
Cache hit rate
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
# Install dev dependencies
npm install --save-dev
# Run in development mode
npm run dev
# Run with hot reload
npm run dev:watch๐ License
MIT License - see LICENSE file
๐ Support
Common Issues
Q: Services won't start?
# Reset everything
npm run reset
npm run setupQ: Can't connect to MCP server?
# Check if running
npm run health
# Check logs
docker logs memory-forge-mcpQ: How to upgrade?
git pull
npm install
npm run migrateGet Help
๐ง Email: support@memory-forge.ai
๐ฌ Discord: Join our server
๐ Issues: GitHub Issues
๐ Roadmap
OpenAI function calling support
LangChain integration
Web UI dashboard
Backup/restore tools
Multi-region support
GraphQL API
Built with โค๏ธ by the Memory Forge team
This server cannot be installed
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cpretzinger/memory-forge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server