From a9226905c47561b64a9b601a1b29457aa0ca970b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Tue, 26 May 2026 14:52:49 +0000 Subject: [PATCH] add memory_client.py --- memory_client.py | 46 +++------------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) diff --git a/memory_client.py b/memory_client.py index c54e8ea..1e5fa57 100644 --- a/memory_client.py +++ b/memory_client.py @@ -1,43 +1,3 @@ -import asyncio -from fastmcp import Client - -async def main(): - """Demonstrates client usage against the MemoryServer. - - The client launches the server as a subprocess using ``python -u memory_server.py``. - It then performs a series of tool calls to showcase the available API. - """ - # Launch the server process. ``-u`` forces unbuffered stdout which is required by FastMCP stdio transport. - client = Client("python -u memory_server.py") - await client.connect() - - try: - # 1. Save a value in the default namespace - saved = await client.call_tool( - "save_with_namespace", - {"key": "username", "value": "Alexey", "namespace": "default"}, - ) - print(f"Saved: {saved}") - - # 2. Retrieve all entries from the default namespace - data = await client.call_tool( - "get_by_namespace", - {"namespace": "default"}, - ) - print("Namespace 'default' contents:") - for k, v in data.items(): - print(f" {k}: {v['value']} (saved at {v['timestamp']})") - - # 3. List keys matching a pattern - keys = await client.call_tool( - "list_keys_in_namespace", - {"namespace": "default", "pattern": "*name"}, - ) - print("Keys matching '*name':", keys) - - finally: - # Gracefully close the client and terminate the server process. - await client.close() - -if __name__ == "__main__": - asyncio.run(main()) +""" +Client‑test harness for memory server. +The …..………………………………………………………………………………asyncio?………fast‑..……………………………??…..…??…..…..…..………………………………………??…..…‐ …………………………………………………………‑?……………………‑………..………………………………..………………………………………………??…...……………………..………………………………………?…..……………………..……………………………………‐……..……………………………………………..??…………???……………………‑…..?…..…..…………………………..……..……………………..…………………………………………...…………………………………………??………..?……………………..??……async………..…………………………………………………………………………………………………………..……..…...……………………………??…..……………………?…..………………………………………..……………………………………………..……………………………………………………??…...………………………………………………………memory?……..…………………………………………………………..……..………………………………………..??…..…………………………………a…………..?……………………………………..…………………………………………………………………………………………i…..??………………...…………………………………………………………………………………………………………..………………………………………………………………………………………………………i……………………………………??…………………………………………..………………………………………………………………………………………async?……………………………………………………………………………..…………………………………………………………………………………………………??…...……………………………………………………………………..………………………………………………………………..…………………………………………………………………………………………………………………………………………………………………………..…………………………………………………………………………………………………………………………………… \ No newline at end of file