MemoryGraph Setup for Windsurf
Walks through installing MemoryGraph and configuring it as an MCP server in Windsurf for persistent AI memory.
What this file does
Walks through installing MemoryGraph and configuring it as an MCP server in Windsurf for persistent AI memory.
When to use it
- Setting up persistent memory for Windsurf AI for the first time
- Switching from local SQLite to cloud-backed memory
- Configuring project-specific memory databases
- Troubleshooting MCP server connection issues in Windsurf
Assumes this stack
MemoryGraph Setup for Windsurf
Get persistent memory working in Windsurf in under 2 minutes.
Prerequisites
- Windsurf IDE (latest version)
- Python 3.10+
- pipx installed (
pip install --user pipx && pipx ensurepath)
Choose Your Backend
MemoryGraph supports two backend options:
| Feature | Local (SQLite) | Cloud |
|---|---|---|
| Setup | Zero-config | API key required |
| Data Location | ~/.memorygraph/ | memorygraph.dev |
| Multi-device | No | Yes |
| Team sharing | No | Yes |
| Offline | Yes | No |
| Cost | Free | Free tier available |
New users: We recommend starting with Cloud for multi-device sync, or Local for single-machine use.
Quick Start (Local Backend)
1. Install MemoryGraph
pipx install memorygraphMCP
Verify installation:
memorygraph --version
2. Configure Windsurf
Option A: Via Settings UI
- Open Windsurf Settings (
Cmd/Ctrl + ,) - Search for "MCP" or navigate to Extensions > MCP Servers
- Click Add MCP Server
- Configure:
- Name:
memorygraph - Command:
memorygraph - Transport:
stdio
- Name:
Option B: Via Configuration File
Windsurf uses a similar configuration format to other MCP clients. Create or edit your MCP configuration:
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": [],
"env": {}
}
}
}
Location varies by OS:
- macOS:
~/Library/Application Support/Windsurf/mcp.json - Linux:
~/.config/Windsurf/mcp.json - Windows:
%APPDATA%\Windsurf\mcp.json
3. Restart Windsurf
Close and reopen Windsurf to load the MCP server.
4. Verify Connection
In Windsurf's AI chat, ask:
What memory tools do you have available?
You should see MemoryGraph tools listed.
First Memory
Store your first memory:
Store this for later: Use pnpm instead of npm for this monorepo
Retrieve it later:
What package manager should I use for this project?
Quick Start (Cloud Backend)
Cloud backend syncs memories across all your devices and enables team collaboration.
1. Get Your API Key
- Sign up at app.memorygraph.dev
- Copy your API key (starts with
mg_)
2. Install MemoryGraph
pipx install memorygraphMCP
3. Configure Windsurf with Cloud Backend
Create or edit your MCP configuration file:
macOS: ~/Library/Application Support/Windsurf/mcp.json
Linux: ~/.config/Windsurf/mcp.json
Windows: %APPDATA%\Windsurf\mcp.json
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": ["--backend", "cloud"],
"env": {
"MEMORYGRAPH_API_KEY": "mg_your_api_key_here"
}
}
}
}
4. Restart Windsurf and Verify
- Close and reopen Windsurf
- Ask in AI chat: "What memory tools do you have available?"
Migrating from Local to Cloud
Already using local SQLite and want to switch to cloud?
Step 1: Export Local Memories
# Export all memories to JSON
memorygraph export --output memories-backup.json
Step 2: Import to Cloud
# Set your cloud API key
export MEMORYGRAPH_API_KEY=mg_your_key_here
# Import to cloud backend
memorygraph import --backend cloud --input memories-backup.json
Step 3: Update Windsurf Configuration
Update your mcp.json to use cloud backend:
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": ["--backend", "cloud"],
"env": {
"MEMORYGRAPH_API_KEY": "mg_your_api_key_here"
}
}
}
}
Step 4: Restart Windsurf
Close and reopen Windsurf to apply the new configuration.
See CLOUD_BACKEND.md for detailed migration options and troubleshooting.
Configuration Options
Extended Mode (Pattern Recognition)
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": ["--profile", "extended"]
}
}
}
Custom Database Location
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"env": {
"MEMORY_SQLITE_PATH": "/path/to/your/memory.db"
}
}
}
}
Project-Specific Memory
Create .windsurf/mcp.json in your project root:
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"env": {
"MEMORY_SQLITE_PATH": "./.windsurf/memory.db"
}
}
}
}
Troubleshooting
Server Not Connecting
-
Check that memorygraph is installed and in PATH:
which memorygraph memorygraph --version -
If not found, ensure pipx bin is in your PATH:
pipx ensurepath # Restart terminal -
Use full path in configuration:
{ "command": "/Users/yourname/.local/bin/memorygraph" }
MCP Tools Not Appearing
- Verify MCP server status in Windsurf settings
- Check for error messages in the server logs
- Restart Windsurf completely (not just reload)
Test Server Manually
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}' | memorygraph
You should see a JSON response with capabilities.
SSE Transport (If Required)
If Windsurf requires SSE transport instead of stdio, you may need to run MemoryGraph with an SSE wrapper. Check Windsurf documentation for current requirements.
Tips for Windsurf Users
- Leverage Windsurf's features - Combine MemoryGraph with Windsurf's code understanding
- Store architectural decisions - Remember why you made certain choices
- Track what works - Store successful patterns for future reference
- Query before coding - Check if you've solved similar problems
Recommended: Memory Protocol
Add this to .windsurfrules or your project's rules file for automatic memory usage:
## Memory Protocol
### REQUIRED: Before Starting Work
You MUST use `recall_memories` before any task. Query by project, tech, or task type.
### REQUIRED: Automatic Storage Triggers
Store memories on ANY of:
- **Git commit** → what was fixed/added
- **Bug fix** → problem + solution
- **Version release** → summarize changes
- **Architecture decision** → choice + rationale
- **Pattern discovered** → reusable approach
### Timing Mode (default: on-commit)
`memory_mode: immediate | on-commit | session-end`
### Memory Fields
- **Type**: solution | problem | code_pattern | fix | error | workflow
- **Title**: Specific, searchable (not generic)
- **Content**: Accomplishment, decisions, patterns
- **Tags**: project, tech, category (REQUIRED)
- **Importance**: 0.8+ critical, 0.5-0.7 standard, 0.3-0.4 minor
- **Relationships**: Link related memories when they exist
Do NOT wait to be asked. Memory storage is automatic.
File locations:
- Project-specific:
.windsurfrulesin project root - Global: Windsurf Settings > AI Rules
Windsurf-Specific Features
Windsurf has a rich feature set. MemoryGraph complements these by:
- Persisting context - Remember discussions across sessions
- Tracking solutions - Know what worked in past projects
- Building relationships - Connect problems to their solutions
Next Steps
Works with: Windsurf (all versions with MCP support) Transport: stdio (SSE may be supported) Profiles: core (9 tools), extended (11 tools)
What's inside
5 setup sections, 2 backend options, 4 configuration examples, 1 troubleshooting section, 1 memory protocol template
Change this for your project
- Replace
mg_your_api_key_herewith your actual MemoryGraph API key - Replace
/Users/yourname/.local/bin/memorygraphwith the full path to your memorygraph binary - Replace
/path/to/your/memory.dbwith your desired database location
Where it goes
A standard operating procedure. Keep where the team or agent running the process will find it.
Worth borrowing
- Define a memory protocol as a rules file to automate memory storage triggers
- Provide both UI and config-file methods for setting up MCP servers
Related Documents
Comprehensive AI Assistant Tools Reference
Lists 80+ tools with MCP server associations, bulk support, parallel capability, resource impact, and execution type for AI agent workflows.
iOS Deployment Guide
Walks through setting up an iOS development environment, building a Tauri app for iOS, and publishing to the App Store or alternative channels.
How to Add Resources to Your FastMCP Server
Teaches how to add static and dynamic MCP resources to a FastMCP server, with six ready-to-copy examples for a GitHub crawler.
PCI Compliance Guide
Explains PCI DSS compliance via tokenization, lists forbidden and allowed data, and provides code examples for BigCommerce and Stripe.