Files
2026-05-28 06:07:07 +00:00

51 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 keyvalue pairs in a JSON file. It also supports namespaces and wildcard key listing.
## Installation
```bash
# 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
```bash
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:
```bash
python memory_client.py
```
The client will:
1. Save a key/value pair.
2. Retrieve it.
3. List all keys.
4. Delete the key.
5. 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`.