# 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 ```bash pip install -r requirements.txt ``` ## Running the Server ```bash python memory_server.py ``` The server will start listening via **stdio** transport. ## Running the Client Demo ```bash 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.