Files
task-69f8e929da860fb4533faa2a/README.md
T
2026-06-02 07:05:45 +00:00

1.4 KiB
Raw Blame History

MCP Memory Server

This repository contains a simple MCP (Model Context Protocol) server that provides a persistent key/value store with optional namespace support. The server is built with FastMCP and exposes tools that can be called by other agents or CLI utilities.

Features

  • Basic CRUD operations: save, get, delete, list_keys.
  • Namespace support: save_with_namespace, get_by_namespace, etc.
  • Data is persisted to memory_data.json with timestamps.
  • Simple client demo (memory_client.py).

Installation

pip install -r requirements.txt

Running the Server

python memory_server.py

The server will start listening via stdio transport.

Running the Client Demo

python memory_client.py

You should see output similar to:

Сохранено: True
Данные namespace 'default':
  default:username: Алексей
Ключи с 'name': ['default:username']

How It Works

  • The server uses a JSON file (memory_data.json) to store data. Each entry is a mapping of namespace:key to a dictionary containing value and timestamp.
  • All tools are registered with @mcp.tool() and can be invoked by any MCP client.
  • The client uses fastmcp.Client to connect via stdio and call the tools.

Extending

You can add more tools or modify the storage backend (e.g., switch to a database) by extending the MemoryServer class.