Sonjuane/mem0-mcp-server
If you are the rightful owner of mem0-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Mem0 MCP Server is a Node.js implementation designed for HTTP-only operation, providing a simplified deployment and integration experience for managing model context protocols.
Mem0 MCP Server - Node.js (HTTP-Only)
A Node.js implementation of the Mem0 MCP (Model Context Protocol) server with HTTP-only operation for simplified deployment and integration.
This was based on this repo coleam00/mcp-mem0.git
Features
- HTTP-Only Operation: Simplified server that runs exclusively via HTTP API
- Workspace Integration: Automatically stores memories in your active project directory
- RESTful API: Easy integration with web applications, VSCode extensions, and MCP clients
- Local File Storage: Stores memories in a
.Mem0-Files
directory in your workspace root - MCP Tools: Provides
save_memory
,get_all_memories
, andsearch_memories
tools - Authentication: Token-based authentication for secure API access
- Rate Limiting: Built-in protection against API abuse
- Configurable Storage: Plugin architecture supports multiple storage backends
- ESM Modules: Modern Node.js implementation using ES modules
- Docker Support: Containerized deployment option
Quick Start
-
Install dependencies:
npm install
-
Configure environment:
cp .env.example .env # Edit .env with your configuration
-
Run the server:
# Start the HTTP server (default port 8484) npm start # Start with specific workspace (recommended) npm run start:workspace /path/to/your/project # Start in development mode with auto-restart npm run dev
-
Verify it's working:
# Check server status curl http://localhost:8484/ # Or open in browser: http://localhost:8484
-
Use the HTTP API:
# Save a memory curl -X POST http://localhost:8484/api/memory/save \ -H "Content-Type: application/json" \ -H "Authorization: Bearer 550EA5B7-4C7B-4B17-9BF7-5A6B6D232FA2" \ -d '{"text": "Your memory here", "userId": "vscode-user"}' # Search memories curl "http://localhost:8484/api/memory/search?query=memory&userId=vscode-user" \ -H "Authorization: Bearer 550EA5B7-4C7B-4B17-9BF7-5A6B6D232FA2"
Configuration
The server is configured via environment variables. Copy .env.example
to .env
and configure:
Basic Configuration
HOST
: Host to bind to (default:0.0.0.0
)PORT
: Port to listen on (default:8484
)STORAGE_PROVIDER
: Storage backend (local
orpostgresql
) - currently onlylocal
is implementedLOCAL_STORAGE_DIR
: Directory for local storage (default:.Mem0-Files
)PROJECT_DIR
: Workspace directory where memories will be stored (auto-detected or set explicitly)
HTTP Server Configuration (Always Enabled)
HTTP_SERVER_ENABLED
: Enable HTTP API server (true
orfalse
, default:false
)HTTP_SERVER_PORT
: HTTP server port (default:3000
)HTTP_SERVER_HOST
: HTTP server host (default:0.0.0.0
)API_TOKEN
: Authentication token for HTTP API (required when HTTP server is enabled)CORS_ORIGINS
: Allowed CORS origins (default:http://localhost:*,https://localhost:*
)RATE_LIMIT_WINDOW_MS
: Rate limiting window in milliseconds (default:900000
- 15 minutes)RATE_LIMIT_MAX_REQUESTS
: Maximum requests per window (default:100
)
LLM Configuration (for future Mem0 integration)
LLM_PROVIDER
: LLM provider (openai
,openrouter
, orollama
)LLM_API_KEY
: API key for your LLM providerLLM_CHOICE
: Model to use (e.g.,gpt-4o-mini
)EMBEDDING_MODEL_CHOICE
: Embedding model (e.g.,text-embedding-3-small
)
MCP Client Configuration
VS Code with Roo Code Extension
To use this MCP server with VS Code and the Roo Code extension:
Setup Steps:
- Install the Roo Code extension in VS Code from the marketplace
- Generate configuration by running:
npm run config
(this will show the exact paths) - Open VS Code Settings (Cmd/Ctrl + ,)
- Search for "roo" to find Roo Code settings
- Find "MCP Servers" configuration in the Roo Code settings
- Copy and paste the generated configuration from step 2
Configuration Examples:
Option 1: Stdio Transport (Direct Process Communication) Add this configuration to your Roo Code MCP servers settings:
{
"mem0-nodejs": {
"command": "node",
"args": ["/absolute/path/to/mem0_mcp_server_nodejs/src/main.js"],
"env": {
"TRANSPORT": "stdio",
"STORAGE_PROVIDER": "local",
"LOCAL_STORAGE_DIR": ".Mem0-Files",
"DEFAULT_USER_ID": "vscode-user",
"DEBUG": "false"
}
}
}
Option 2: SSE Transport (HTTP-based Communication) First, start the server with SSE transport:
TRANSPORT=sse HTTP_SERVER_ENABLED=true npm start
Then add this configuration to your Roo Code MCP servers settings:
{
"mcpServers": {
"mem0-sse": {
"transport": "sse",
"url": "http://localhost:8484/sse",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN_HERE"
},
"description": "Mem0 MCP Server via SSE transport"
}
}
}
Usage in VS Code:
Once configured, you can use the memory tools in Roo Code:
- Save memories: Use the
save_memory
tool to store information about your project, coding patterns, or decisions - Retrieve memories: Use
get_all_memories
to see all stored information - Search memories: Use
search_memories
to find specific information
Example Usage:
@mem0-nodejs save_memory "This project uses ESM modules and stores data in .Mem0-Files directory"
@mem0-nodejs search_memories "ESM modules"
@mem0-nodejs get_all_memories
Important Notes:
- Replace
/absolute/path/to/mem0_mcp_server_nodejs/
with the actual absolute path to your project - The server will create a
.Mem0-Files
directory in the project root - Each VS Code workspace can have its own memory storage
- Memories are isolated by the
DEFAULT_USER_ID
setting - You can find the exact path using
pwd
command in your project directory
VS Code with HTTP API (Recommended)
For the easiest setup with VS Code and Roo Code, use the HTTP API which eliminates the need for absolute file paths:
š
Quick Setup:
-
Start the HTTP server:
API_TOKEN=your-secure-token HTTP_SERVER_ENABLED=true npm start
-
Configure Roo Code in VS Code settings:
{ "mem0-http": { "transport": "sse", "url": "http://localhost:3000", "headers": { "Authorization": "Bearer your-secure-token" } } }
-
Use in VS Code:
@mem0-http save_memory "This project uses React with TypeScript" @mem0-http search_memories "React"
š Documentation:
- - Step-by-step instructions
- - Commands and troubleshooting
- - Complete API documentation
Claude Desktop (stdio)
Add this to your Claude Desktop configuration:
{
"mcpServers": {
"mem0-nodejs": {
"command": "node",
"args": ["path/to/mem0_mcp_server_nodejs/src/main.js"],
"env": {
"TRANSPORT": "stdio",
"STORAGE_PROVIDER": "local",
"LOCAL_STORAGE_DIR": ".Mem0-Files"
}
}
}
}
Available Tools
save_memory
Store information in long-term memory.
Parameters:
text
(required): Content to storeuserId
(optional): User identifier (defaults to configured user)
get_all_memories
Retrieve all stored memories for a user.
Parameters:
userId
(optional): User identifierlimit
(optional): Maximum number of memories to return (default: 50)
search_memories
Search memories using text-based search.
Parameters:
query
(required): Search queryuserId
(optional): User identifierlimit
(optional): Maximum results to return (default: 3)
Local Storage Structure
The local storage provider creates the following structure:
.Mem0-Files/
āāā users/
ā āāā [userId]/
ā āāā [memoryId1].json
ā āāā [memoryId2].json
ā āāā ...
āāā index/
āāā [userId].json
Each memory file contains:
{
"id": "uuid",
"userId": "user",
"memory": "memory content",
"metadata": {
"originalText": "original input",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
}
Development
Running in Development Mode
npm run dev
Testing
npm test
Linting
npm run lint
Docker
Build Image
npm run docker:build
Run Container
npm run docker:run
Project Status
This is an early implementation with the following status:
ā Implemented
- Basic MCP server setup
- Local file storage provider
- Core MCP tools (save, get, search)
- Project structure and configuration
- Basic text-based search
- HTTP API server with Express.js
- Token-based authentication
- Rate limiting and security
- Dual transport support (stdio + HTTP)
- Comprehensive API documentation
- VS Code integration via HTTP
š§ In Progress
- Enhanced Mem0 integration
- Semantic search with embeddings
- PostgreSQL storage provider
- SSE transport support (HTTP server ready, SSE endpoint pending)
š Planned
- Full LLM integration for memory processing
- Advanced search algorithms
- Memory analytics and management
- Web-based memory browser
Development Notes
For development documentation, implementation details, and project planning files, see the folder.
Contributing
This project is in active development. Contributions are welcome!
License
MIT License