Memobase MCP
The Model Context Protocol (MCP) is revolutionizing how AI agents interact with external systems and data sources. In this tutorial, we’ll explore how to integrate Memobase with MCP to give your AI agents persistent, long-term memory capabilities.
Memobase MCP server enables AI agents to store, retrieve, and search memories using semantic search, making your agents truly stateful and context-aware across conversations.
What is MCP?
The Model Context Protocol is an open standard that enables AI assistants to securely connect to external data sources and tools. Instead of being limited to their training data, AI agents can now access real-time information, execute functions, and maintain persistent state through MCP servers.
Why Memobase + MCP?
Traditional AI conversations are stateless - each interaction starts fresh without memory of previous exchanges. Memobase MCP changes this by providing:
- Persistent Memory: Store conversation history and user preferences across sessions
- Semantic Search: Find relevant context using natural language queries
- User Profiles: Build comprehensive understanding of users over time
- Cross-Platform: Works with any MCP-compatible client (Claude Desktop, Cursor, Windsurf, etc.)
Setup
Prerequisites
- Python 3.11+
- A Memobase backend (local or cloud)
Get Your Memobase Credentials
You’ll need:
- Project URL:
http://localhost:8019
(local) orhttps://api.memobase.dev
(cloud) - API Key:
secret
(local) orsk-proj-xxxxxx
(cloud)
Get free cloud credits at Memobase Dashboard or deploy locally.
Installation Options
Option 1: Using uv (Recommended)
Option 2: Using Docker
Environment Configuration
Configure your .env
file:
Running the MCP Server
Using uv
Using Docker
The server will start on http://localhost:8050
and provide an SSE endpoint at /sse
.
Integration with MCP Clients
Cursor Configuration
Add this to your .cursor/mcp.json
:
Windsurf Configuration
For Windsurf, use serverUrl
instead:
Claude Desktop Configuration
For stdio transport with Claude Desktop:
Available Tools
The Memobase MCP server provides three powerful tools:
1. save_memory
Store any information in long-term memory with semantic indexing.
Use cases:
- Store user preferences
- Remember important facts from conversations
- Save project details and requirements
2. search_memories
Find relevant context using natural language queries.
Parameters:
query
: Natural language search querymax_length
: Maximum content length (default: 1000)
3. get_user_profiles
Retrieve complete user profiles with organized topics and subtopics.
Returns structured information about the user organized by topics.
Code Breakdown
Let’s examine the core implementation:
Server Setup
Memory Storage Tool
Memory Search Tool
User Profile Tool
This tool retrieves structured user profiles that Memobase automatically generates from conversation history. The profiles are organized by topics and subtopics, providing a comprehensive overview of what the system knows about the user.
Key features:
- Automatic Organization: Memobase intelligently categorizes information into topics
- Structured Output: Returns formatted profiles with clear descriptions
- Comprehensive View: Provides a complete picture of stored user information
Real-World Example
Here’s how the Memobase MCP transforms AI interactions:
Without Memory:
With Memobase MCP:
Best Practices
- Error Handling: Always wrap MCP tools in try-catch blocks
- Memory Efficiency: Use appropriate
max_length
parameters for searches - User Privacy: Implement proper user isolation for multi-user scenarios
- Performance: Use async operations for better concurrency
- Monitoring: Add logging for debugging and monitoring
Conclusion
The Memobase MCP server bridges the gap between stateless AI interactions and truly intelligent, context-aware agents. By providing persistent memory capabilities through the standardized MCP protocol, you can build AI applications that learn and remember across conversations.
Whether you’re building customer service bots, personal assistants, or complex AI workflows, the combination of Memobase and MCP provides the foundation for more intelligent and personalized AI experiences.
Get started today by deploying your own Memobase MCP server and transforming your AI agents from forgetful assistants into intelligent, memory-enabled companions.
For more advanced configurations and examples, check out the Full Code and explore the Memobase documentation.