main
Memory MCP Server
Overview
This project implements a simple Memory MCP (Memory Control Protocol) server using fastmcp. The server provides a set of tools for storing, retrieving, and managing key‑value pairs in a JSON file. It also supports namespaces and wildcard key listing.
Installation
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows use .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Running the Server
python memory_server.py
The server runs with a stdio transport and will start listening for tool calls.
Running the Client Example
In a separate terminal (with the same virtual environment activated) run:
python memory_client.py
The client will:
- Save a key/value pair.
- Retrieve it.
- List all keys.
- Delete the key.
- Demonstrate namespace usage.
Output Example
save result: True
get result: {'key': 'foo', 'value': {'bar': 1}, 'timestamp': 1701234567.890}
list_keys result: ['foo']
delete result: True
get_by_namespace result: [{'key': 'ns1:baz', 'value': 'qux', 'timestamp': 1701234568.123}]
Persistence
All data is stored in memory_data.json in the same directory as the server. Each entry contains the key, value, and a Unix timestamp.
Dependencies
- fastmcp
- pydantic
- python-dotenv
All dependencies are specified in requirements.txt.
Description
Languages
Python
100%