Comprehensive testing infrastructure for the MCP Memory Server.
This test suite ensures the MCP Memory Server works correctly across all features and versions. Tests are organized into three categories:
- Static Tests - File existence, type definitions, method signatures
- Runtime Tests - Server startup, tool availability, JSON-RPC protocol
- Manual Tests - Interactive feature testing with Claude Desktop
# 1. Static checks (fast, no dependencies)
./tests/test-v1.5.0-simple.sh
# 2. Runtime checks (requires Redis + API keys)
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-runtime.js- Redis: Running on
localhost:6379 - Node.js: v18 or higher
- API Keys: Set as environment variables (can use dummy keys for basic tests)
- Built Package: Run
npm run buildfirst
Purpose: Quick static validation checks
What it tests:
- File existence (tool files, types, memory-store)
- Method signatures in MemoryStore
- Type definitions and schemas
- Redis key patterns
- Build artifacts and version numbers
- TypeScript compilation
Run:
chmod +x tests/test-v1.5.0-simple.sh
./tests/test-v1.5.0-simple.shDuration: ~5 seconds
Requirements: None (just source files)
Purpose: Runtime server and protocol tests
What it tests:
- Server startup without crashes
- Redis connection
- MemoryStore initialization
- JSON-RPC protocol (initialize, tools/list)
- Tool availability (all 27 tools)
- v1.5.0 specific tools present
Run:
# With dummy API keys (recommended)
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-runtime.js
# Or with real keys
node tests/test-runtime.jsDuration: ~15 seconds
Requirements: Redis running
Purpose: Full integration tests with real Redis operations
What it tests:
- Memory CRUD operations
- Version history creation and rollback
- Template creation and instantiation
- Category assignment and queries
- Advanced search (fuzzy, regex, category filtering)
- Global vs workspace scopes
- Relationship preservation
Run:
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-v1.5.0.jsDuration: ~30 seconds
Requirements:
- Redis running
- OPENAI_API_KEY for embeddings (can use dummy for basic tests)
Purpose: Interactive testing checklist for Claude Desktop integration
What it tests:
- End-to-end feature workflows
- UI/UX with Claude Desktop
- Edge cases and error handling
- Real-world usage patterns
How to use:
- Configure Claude Desktop with MCP server
- Open checklist in
test-v1.5.0-manual.md - Follow step-by-step instructions
- Verify expected outputs
- Mark items as complete
Duration: 30-60 minutes
Requirements:
- Claude Desktop configured
- MCP server running
- Redis running
- Real API keys
Purpose: Tests v1.4.0 relationship features (graph traversal, linking)
Run:
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-relationships.jsPurpose: Tests MCP resource endpoints
Run:
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-resource.jsPurpose: Utility to inspect Redis memory data
Run:
node tests/view-memories.jsUse cases:
- Debug stored memories
- Verify indexes
- Inspect version history
- Check category assignments
CRITICAL: Follow this workflow before publishing to npm
- Create feature branch:
feature/{TIMESTAMP}-{DESCRIPTION} - Store implementation plan in recall-dev MCP
- Implement features
- Update types and schemas
- Add new tools/resources
- Update CHANGELOG.md
- Update README.md
# Run static checks
./tests/test-v1.5.0-simple.sh- All file existence checks pass
- All method signatures present
- TypeScript compiles without errors
- Bundle size reasonable (<200KB)
# Clean build
rm -rf dist/
npm run build
# Verify output
ls -lh dist/index.js
head -1 dist/index.js # Check shebang- Build succeeds
- dist/index.js exists
- Shebang present (#!/usr/bin/env node)
# Start Redis if not running
redis-server
# Run runtime tests
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-runtime.js- Server starts without crashes
- All tools available
- JSON-RPC protocol works
# Run full integration tests
ANTHROPIC_API_KEY="test-key" OPENAI_API_KEY="test-key" node tests/test-v1.5.0.js- All CRUD operations work
- New features work correctly
- Backward compatibility maintained
- Indexes update correctly
- Follow
test-v1.5.0-manual.mdchecklist - Test with Claude Desktop
- Verify all edge cases
- Document any issues found
- All tests passing
- Version bumped in package.json
- Version bumped in src/index.ts
- CHANGELOG.md updated
- README.md updated
- Commit message descriptive
# Only after ALL tests pass
git push origin feature-branch
# Create and merge PR
git checkout main
git pull
npm publish- Create GitHub release with tag
- Update recall-dev with learnings
- Test npm install works:
npx -y @joseairosa/recall
See TEST-RESULTS-v1.5.0.md for complete results.
Summary:
- ✅ 16 static checks passed
- ✅ 19 runtime checks passed
- ✅ All 8 new tools present
⚠️ 1 known issue (ANTHROPIC_API_KEY requirement - pre-existing)
Severity: Medium
Impact: Server cannot start without ANTHROPIC_API_KEY environment variable
Root Cause: ConversationAnalyzer instantiated at module load time in context-tools.ts
Workaround:
export ANTHROPIC_API_KEY="test-key"
# or
ANTHROPIC_API_KEY="test-key" node dist/index.jsStatus: Pre-existing bug (not caused by v1.5.0), can be fixed in future version
Proposed Fix: Lazy-load ConversationAnalyzer only when analyze_and_remember is called
# Check if Redis is running
redis-cli ping
# Should return: PONG
# If not running, start Redis
redis-server# Use dummy key for basic tests
export ANTHROPIC_API_KEY="test-key"
export OPENAI_API_KEY="test-key"
# Or use real keys for full testing
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."# Rebuild the project
npm run build
# Check dist/index.js exists
ls -lh dist/index.js# Check Node version (requires v18+)
node --version
# Check for Redis conflicts
lsof -i :6379
# Check logs in test output
# Look for stack traces in stderr# Connect to Redis
redis-cli
# List all keys
KEYS *
# View a memory
HGETALL ws:default:memory:{id}
# View version history
ZRANGE ws:default:memory:{id}:versions 0 -1
# View categories
SMEMBERS ws:default:categories:all
# View templates
SMEMBERS ws:default:templates:all- Add to test-v1.5.0.js (or create test-v1.x.x.js for new version):
// Example: Testing new feature
async function testNewFeature() {
log('\n=== Testing New Feature ===', 'blue');
try {
// Your test code here
passed++;
log('✓ New feature works', 'green');
} catch (error) {
failed++;
log(`✗ New feature failed: ${error.message}`, 'red');
}
}- Add to manual checklist in test-v1.5.0-manual.md:
### New Feature
- [ ] Test basic usage
- [ ] Test edge cases
- [ ] Test error handling
- [ ] Verify Redis data- Add to static checks in test-v1.5.0-simple.sh:
test_command "New method exists" \
"grep -q 'async newMethod' src/redis/memory-store.ts && echo 'found'" \
"found"Add to existing test files to ensure old features still work with new changes.
Planned for v1.6.0+:
# .github/workflows/test.yml
name: Test Suite
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm install
- run: npm run build
- run: ./tests/test-v1.5.0-simple.sh
- run: ANTHROPIC_API_KEY="test" node tests/test-runtime.jsMaintainer: José Airosa
Issues: File in GitHub at https://github.com/joseairosa/recall/issues
Test Failures: Include:
- Test file name
- Error message
- Full output
- Environment (OS, Node version, Redis version)
Last Updated: 2025-10-03 Version: 1.5.0