mem0-open-mcp 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/PKG-INFO +1 -1
  2. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/pyproject.toml +1 -1
  3. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/cli.py +65 -26
  4. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/config/loader.py +2 -3
  5. mem0_open_mcp-0.1.9/uv.lock +3191 -0
  6. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/.env.example +0 -0
  7. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/.github/workflows/publish.yml +0 -0
  8. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/.gitignore +0 -0
  9. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/Dockerfile +0 -0
  10. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/README.md +0 -0
  11. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/docker-compose.yaml +0 -0
  12. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/examples/ollama-config.yaml +0 -0
  13. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/mem0-open-mcp.example.yaml +0 -0
  14. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/__init__.py +0 -0
  15. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/api/__init__.py +0 -0
  16. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/api/routes.py +0 -0
  17. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/config/__init__.py +0 -0
  18. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/config/schema.py +0 -0
  19. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/mcp/__init__.py +0 -0
  20. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/mcp/server.py +0 -0
  21. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/server.py +0 -0
  22. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/src/mem0_server/utils/__init__.py +0 -0
  23. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/tests/test_api.py +0 -0
  24. {mem0_open_mcp-0.1.7 → mem0_open_mcp-0.1.9}/tests/test_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mem0-open-mcp
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Open-source MCP server for mem0 - local LLMs, self-hosted, Docker-free
5
5
  Author: Alex
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mem0-open-mcp"
3
- version = "0.1.7"
3
+ version = "0.1.9"
4
4
  description = "Open-source MCP server for mem0 - local LLMs, self-hosted, Docker-free"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -199,11 +199,14 @@ def _run_connectivity_tests(config: Mem0ServerConfig) -> bool:
199
199
  def _run_memory_tests(config: Mem0ServerConfig) -> bool:
200
200
  """Run actual mem0 memory add/search tests."""
201
201
  import os
202
+ import time
202
203
  import uuid
203
204
  console.print("[bold]Running memory tests...[/bold]\n")
204
205
 
205
206
  test_user_id = f"__test_user_{uuid.uuid4().hex[:8]}"
206
- test_memory_text = "This is a test memory for connectivity verification."
207
+ test_memory_text = "My name is TestUser and I prefer dark mode. I work as a software engineer."
208
+ max_retries = 20
209
+ retry_interval = 0.5
207
210
 
208
211
  try:
209
212
  console.print(" [dim]Initializing mem0 client...[/dim]", end=" ")
@@ -217,27 +220,34 @@ def _run_memory_tests(config: Mem0ServerConfig) -> bool:
217
220
  console.print(" [dim]1. Adding test memory...[/dim]", end=" ")
218
221
  add_result = memory.add(test_memory_text, user_id=test_user_id)
219
222
  memory_id = None
220
- if add_result and add_result.get("results"):
223
+ if add_result and add_result.get("results") and len(add_result["results"]) > 0:
221
224
  first_result = add_result["results"][0]
222
225
  memory_id = first_result.get("id") if first_result else None
223
226
  if memory_id:
224
227
  console.print(f"[green]✓ Added (id: {memory_id[:8]}...)[/green]")
225
228
  else:
226
- console.print("[green] Added[/green]")
229
+ console.print("[yellow] No memory extracted by LLM[/yellow]")
227
230
  else:
228
- console.print("[green] Added[/green]")
231
+ console.print("[yellow] No memory extracted by LLM[/yellow]")
232
+ console.print(f" [dim]add_result: {add_result}[/dim]")
229
233
 
230
- # 2. List memories
234
+ # 2. List memories (with retry)
231
235
  console.print(" [dim]2. Listing memories...[/dim]", end=" ")
232
- list_result = memory.get_all(user_id=test_user_id)
233
- if list_result and list_result.get("results"):
234
- stored_count = len(list_result["results"])
236
+ stored_count = 0
237
+ for attempt in range(max_retries):
238
+ list_result = memory.get_all(user_id=test_user_id)
239
+ if list_result and list_result.get("results"):
240
+ stored_count = len(list_result["results"])
241
+ if not memory_id and stored_count > 0:
242
+ memory_id = list_result["results"][0].get("id")
243
+ break
244
+ if attempt < max_retries - 1:
245
+ time.sleep(retry_interval)
246
+
247
+ if stored_count > 0:
235
248
  console.print(f"[green]✓ Found {stored_count} memory(s)[/green]")
236
- # Get memory_id from list if not captured from add
237
- if not memory_id and stored_count > 0:
238
- memory_id = list_result["results"][0].get("id")
239
249
  else:
240
- console.print("[red]✗ Memory not stored[/red]")
250
+ console.print(f"[red]✗ Memory not stored (waited 10s)[/red]")
241
251
  return False
242
252
 
243
253
  # 3. Search memories
@@ -248,21 +258,46 @@ def _run_memory_tests(config: Mem0ServerConfig) -> bool:
248
258
  else:
249
259
  console.print("[yellow]⚠ No search results (indexing may be delayed)[/yellow]")
250
260
 
251
- # 4. Delete single memory
261
+ # 4. Delete single memory (with retry verification)
252
262
  console.print(" [dim]4. Deleting single memory...[/dim]", end=" ")
253
263
  if memory_id:
254
- delete_result = memory.delete(memory_id)
255
- if delete_result and delete_result.get("message"):
264
+ memory.delete(memory_id)
265
+ # Verify deletion
266
+ deleted = False
267
+ for attempt in range(max_retries):
268
+ list_result = memory.get_all(user_id=test_user_id)
269
+ results = list_result.get("results", []) if list_result else []
270
+ if not any(m.get("id") == memory_id for m in results):
271
+ deleted = True
272
+ break
273
+ if attempt < max_retries - 1:
274
+ time.sleep(retry_interval)
275
+
276
+ if deleted:
256
277
  console.print(f"[green]✓ Deleted (id: {memory_id[:8]}...)[/green]")
257
278
  else:
258
- console.print("[green] Deleted[/green]")
279
+ console.print("[yellow] Delete called but not confirmed after 10s[/yellow]")
259
280
  else:
260
281
  console.print("[yellow]⚠ Skipped (no memory_id)[/yellow]")
261
282
 
262
- # 5. Cleanup remaining test data
283
+ # 5. Cleanup remaining test data (with retry verification)
263
284
  console.print(" [dim]5. Cleaning up test data...[/dim]", end=" ")
264
285
  memory.delete_all(user_id=test_user_id)
265
- console.print("[green]✓ Cleaned[/green]")
286
+ # Verify cleanup
287
+ cleaned = False
288
+ for attempt in range(max_retries):
289
+ list_result = memory.get_all(user_id=test_user_id)
290
+ results = list_result.get("results", []) if list_result else []
291
+ if len(results) == 0:
292
+ cleaned = True
293
+ break
294
+ if attempt < max_retries - 1:
295
+ time.sleep(retry_interval)
296
+
297
+ if cleaned:
298
+ console.print("[green]✓ Cleaned[/green]")
299
+ else:
300
+ console.print(f"[yellow]⚠ Cleanup called but not confirmed after {max_retries}s[/yellow]")
266
301
 
267
302
  console.print()
268
303
  console.print("[bold green]All memory tests passed![/bold green]\n")
@@ -731,11 +766,11 @@ def status(
731
766
  @app.command()
732
767
  def init(
733
768
  path: Annotated[
734
- Path,
769
+ Path | None,
735
770
  typer.Argument(
736
- help="Path to create configuration file.",
771
+ help="Path to create configuration file. Defaults to ~/.config/mem0-open-mcp.yaml",
737
772
  ),
738
- ] = Path("mem0-open-mcp.yaml"),
773
+ ] = None,
739
774
  force: Annotated[
740
775
  bool,
741
776
  typer.Option("--force", "-f", help="Overwrite existing file."),
@@ -748,15 +783,19 @@ def init(
748
783
  mem0-open-mcp init ./config.yaml
749
784
  mem0-open-mcp init --force
750
785
  """
751
- if path.exists() and not force:
752
- console.print(f"[red]File already exists: {path}[/red]")
786
+ default_path = Path.home() / ".mem0-open-mcp.yaml"
787
+ target_path = path if path else default_path
788
+
789
+ if target_path.exists() and not force:
790
+ console.print(f"[red]File already exists: {target_path}[/red]")
753
791
  console.print("[dim]Use --force to overwrite[/dim]")
754
792
  raise typer.Exit(1)
755
793
 
756
- saved_path = ConfigLoader.create_default_config_file(path)
757
- console.print(f"[green]✓[/green] Created default configuration: [cyan]{saved_path}[/cyan]")
794
+ saved_path = ConfigLoader.create_default_config_file(target_path)
795
+ console.print(f"[green]✓[/green] Created configuration file:")
796
+ console.print(f" [cyan]{saved_path.absolute()}[/cyan]")
758
797
  console.print("\n[dim]Edit the file to customize your settings, then run:[/dim]")
759
- console.print(f" [bold]mem0-open-mcp serve --config {saved_path}[/bold]")
798
+ console.print(" [bold]mem0-open-mcp serve[/bold]")
760
799
 
761
800
 
762
801
  if __name__ == "__main__":
@@ -28,13 +28,12 @@ class ConfigLoader:
28
28
  """Load and save mem0-server configuration from various sources."""
29
29
 
30
30
  DEFAULT_CONFIG_PATHS = [
31
+ Path.home() / ".mem0-open-mcp.yaml",
31
32
  Path("mem0-open-mcp.yaml"),
32
33
  Path("mem0-open-mcp.yml"),
33
34
  Path("mem0-open-mcp.json"),
34
- Path("mem0-open-mcp.yaml"),
35
- Path("mem0-server.yml"),
36
35
  Path.home() / ".config" / "mem0-open-mcp" / "config.yaml",
37
- Path.home() / ".mem0-open-mcp.yaml",
36
+ Path("mem0-server.yml"),
38
37
  ]
39
38
 
40
39
  def __init__(self, config_path: Path | str | None = None):