Files
python-sdk/pkg/hanzo-mcp/test_memory_integration.py
T
zeekay 7ff34ba5bf feat(hanzo-tools): v0.10.17 - modular tool packages + computer control
- Add hanzo-tools-computer package for pyautogui Mac automation
- Fix hanzo-tools-agent imports to use new package structure
- Add get_read_only_*_tools() helpers to filesystem/jupyter
- Remove BatchTool (replaced by dag - one tool per capability)
- Remove hanzo-persona dependency (not published yet)
- Simplify pyproject.toml for local development

Packages ready for PyPI:
- hanzo-tools-core
- hanzo-tools-filesystem
- hanzo-tools-shell
- hanzo-tools-browser
- hanzo-tools-memory
- hanzo-tools-todo
- hanzo-tools-reasoning
- hanzo-tools-lsp
- hanzo-tools-refactor
- hanzo-tools-database
- hanzo-tools-agent
- hanzo-tools-jupyter
- hanzo-tools-editor
- hanzo-tools-computer (NEW)
2025-12-26 06:37:28 -08:00

85 lines
2.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Test memory integration in hanzo-mcp."""
import sys
import asyncio
from pathlib import Path
# Add parent to path
sys.path.insert(0, str(Path(__file__).parent))
class Console:
"""Simple console replacement."""
def print(self, text):
print(text)
console = Console()
async def test_memory_integration():
"""Test that memory tools work with local storage."""
console.print("\n[bold cyan]Testing Hanzo MCP Memory Integration[/bold cyan]\n")
# Test importing hanzo-memory
try:
import hanzo_memory
console.print("✅ hanzo-memory package imported successfully")
except ImportError as e:
console.print(f"❌ Failed to import hanzo-memory: {e}")
return
# Test local memory client
try:
from hanzo_memory.db.local_client import LocalMemoryClient
console.print("✅ LocalMemoryClient imported successfully")
# Create client
client = LocalMemoryClient(enable_markdown=True)
await client.initialize()
console.print("✅ LocalMemoryClient initialized with markdown support")
# Check for markdown memories
projects = await client.list_projects()
markdown_project = next((p for p in projects if p.project_id == "markdown_import"), None)
if markdown_project:
memory_count = len([m for m in client.memories.values() if m.get("project_id") == "markdown_import"])
console.print(f"✅ Found {memory_count} memories from markdown files")
else:
console.print("ℹ️ No markdown memories found (first run)")
await client.close()
except Exception as e:
console.print(f"❌ Error with LocalMemoryClient: {e}")
return
# Test MCP tools integration
try:
# Check if memory tools can be imported
from hanzo_tools.memory import memory_tools
console.print("✅ Memory tools module imported")
tool_names = [t.name for t in memory_tools.MEMORY_TOOLS]
console.print(f"✅ Found {len(tool_names)} memory tools: {tool_names[:3]}...")
except ImportError as e:
console.print(f"⚠️ Memory tools not available (expected): {e}")
console.print(" This is OK - memory tools are loaded dynamically when MCP server starts")
console.print("\n[bold green]✅ Memory integration test completed successfully![/bold green]")
console.print(
"\nYour markdown files (LLM.md, CLAUDE.md, etc.) will be automatically loaded into memory when using hanzo-mcp tools."
)
if __name__ == "__main__":
asyncio.run(test_memory_integration())