github doobidoo/mcp-memory-service v8.71.0
v8.71.0 - Memory Management APIs and Graceful Shutdown

latest releases: v10.38.4, v10.38.3, v10.38.2...
3 months ago

Memory Management APIs and Graceful Shutdown

This release addresses GitHub Discussion #331 where users reported orphaned MCP sessions consuming excessive memory.

New Features

Cache Cleanup Functions

  • clear_all_caches() - Clear storage and service caches
  • get_memory_usage() - Get process memory statistics (RSS, VMS, available memory)
  • get_cache_stats() - Get cache hit/miss statistics
  • clear_model_caches() - Clear embedding model caches
  • get_model_cache_stats() - Get model cache statistics

Graceful Shutdown

  • _cleanup_on_shutdown() - Cleanup function for signal handlers
  • Updated shutdown() method with proper cache and connection cleanup
  • Added atexit handler for normal process exit
  • SIGTERM and SIGINT handlers now call cleanup before exit

Memory Management API Endpoints

  • GET /api/memory-stats - Get detailed memory usage (process memory + cache stats + model cache stats)
  • POST /api/clear-caches - Clear all caches manually (returns memory freed)

Documentation

  • New file: docs/troubleshooting/memory-management.md - Comprehensive guide for monitoring and managing memory

Benefits

  • Prevents memory leaks from orphaned sessions
  • Enables proactive memory monitoring and cleanup
  • Graceful resource release on server shutdown
  • Production-ready memory management for long-running deployments

Installation

pip install --upgrade mcp-memory-service

Or with uv:

uv pip install --upgrade mcp-memory-service

Related

  • Fixes: GitHub Discussion #331
  • PR: #331

Full Changelog: v8.70.0...v8.71.0

Don't miss a new mcp-memory-service release

NewReleases is sending notifications on new releases.