Add README.md
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# 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
|
||||
```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`.
|
||||
Reference in New Issue
Block a user