Skip to main content
Glama
akaiserg

MCP Memory Tracker

by akaiserg

save_memory

Store conversation memories in a vector database for persistent recall across sessions, enabling AI assistants to maintain context and reference past interactions.

Instructions

Save a memory to the vector store.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoryYes

Implementation Reference

  • server.py:24-36 (handler)
    The main handler function for the 'save_memory' tool. It creates or retrieves a vector store named 'memories', writes the input memory to a temporary file, uploads it to the vector store using OpenAI's API, and returns a success status with the vector store ID.
    @mcp.tool() def save_memory(memory: str): """Save a memory to the vector store.""" vector_store = get_or_create_vector_store() with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".txt") as f: f.write(memory) f.flush() client.vector_stores.files.upload_and_poll( vector_store_id=vector_store.id, file=open(f.name, "rb"), ) return {"status": "saved", "vector store id": vector_store.id}
  • server.py:24-24 (registration)
    The @mcp.tool() decorator registers the save_memory function as an MCP tool.
    @mcp.tool()
  • Helper function to get an existing vector store named 'memories' or create a new one if it doesn't exist. Used by save_memory.
    def get_or_create_vector_store(): stores = client.vector_stores.list() for store in stores: if store.name == VECTOR_STORE_NAME: return store return client.vector_stores.create(name=VECTOR_STORE_NAME)
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/akaiserg/mcp-memory-tracker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server