Skip to main content

Conversation memory and session management MCP server for Amazon Q CLI with ChromaDB real-time sync

Project description

Q Memory MCP Server (q_mem_mcp_server)

A Model Context Protocol (MCP) server that provides conversation memory and session management for Amazon Q CLI.

🎯 Key Features

  • Automatic Conversation Saving: Real-time sync of Q CLI conversations to ChromaDB
  • Session Management: Organize conversations by topics/sessions
  • Context Restoration: Resume previous conversations with full context memory
  • Semantic Search: Search through conversation history using natural language

🚀 Quick Start (PyPI Installation)

1. MCP Configuration

Add to ~/.aws/amazonq/mcp.json:

{
  "mcpServers": {
    "q-mem": {
      "command": "uvx",
      "args": ["q_mem_mcp_server@latest"],
      "env": {
        "Q_CLI_DB_PATH": "/Users/YOUR_USERNAME/Library/Application Support/amazon-q/data.sqlite3",
        "Q_MEM_VERBOSE": "true"
      },
      "disabled": false,
      "autoApprove": [
        "start_session",
        "resume_session", 
        "search_memory_by_session_id",
        "get_storage_stats",
        "list_sessions"
      ]
    }
  }
}

2. Usage

# Start Q CLI
q chat

# Start a new session
start_session(description="backendDev")
or 
Start session a backendDev  
# Chat normally (automatically saved)
# ... have conversations ...

# List sessions
list_sessions()
or 
show me session list 
# Resume session (loads full context)
resume_session(session_id="backendDev")
or 
resume session a backendDev

🛠️ Available Commands

Command Description
start_session(description) Start a new session
list_sessions() List all sessions
resume_session(session_id) Resume session with full context
search_memory_by_session_id(session_id, query) Search previous conversations
delete_session(session_id, confirm=true) Delete a session
get_storage_stats() Check storage status

🔧 Technology Stack

  • ChromaDB: Vector database for conversation storage and search
  • SQLite WAL: Real-time sync with Q CLI database
  • Sentence Transformers: Semantic search embeddings
  • MCP Protocol: Communication with Amazon Q

📁 Data Storage

  • ChromaDB: ~/.Q_mem/chroma_db/
  • Sync State: ~/.Q_mem/sync_state.json
  • Logs: ~/.Q_mem/q_mem.log

🔄 Auto-Sync Features

Q CLI conversations are automatically saved to ChromaDB in real-time:

  • Real-time Detection: Checks for new conversations every 2 seconds
  • Partial Failure Handling: Saves successful conversations even if some fail
  • Auto Recovery: Automatically recovers from consecutive failures
  • State Restoration: Restores sync state after restart

💡 Usage Tips

  1. Session Organization: Separate conversations by Topics or Role or Anything
  2. Semantic Search: Use natural language rather than exact keywords
  3. Context Utilization: Use resume_session for complete conversation restoration and anytime you can switch session with conversation restoration.
  4. Regular Cleanup: Delete unnecessary sessions with delete_session or delete all session or delete specific id session

Memory Issues

# Clean up old sessions
cleanup_old_sessions(days=30, confirm=true)
or 
remove old session 

📦 Installation Methods

PyPI

{
  "mcpServers": {
    "q-mem": {
      "command": "uvx",
      "args": ["q_mem_mcp_server@latest"],
      "env": {
        "Q_CLI_DB_PATH": "~/Library/Application Support/amazon-q/data.sqlite3",
        "Q_MEM_VERBOSE": "true"
      }
    }
  }
}

📄 License

MIT License

🔗 Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

q_mem_mcp_server-1.0.2.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

q_mem_mcp_server-1.0.2-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file q_mem_mcp_server-1.0.2.tar.gz.

File metadata

  • Download URL: q_mem_mcp_server-1.0.2.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for q_mem_mcp_server-1.0.2.tar.gz
Algorithm Hash digest
SHA256 037b60f6c1cd317624bbcedc3f788cfde7683d1b495d0cb9e5647d82ef0c641a
MD5 b65a091da4aaf90b1b980df02b8fed9f
BLAKE2b-256 24f9f9b202e08b29ea4ae345b25475813efb3a9ee438bfd3eb4158373ce10335

See more details on using hashes here.

File details

Details for the file q_mem_mcp_server-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for q_mem_mcp_server-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2765b960d83471bc366d8d72acba8db2ab0c15bb6487be56dd59112bd9a83a
MD5 980f478e8ba9416882dd85831509cb29
BLAKE2b-256 c7d82a5a2d231d483de52ba14cce87195d2e7623a3e467048a594613ccf6f903

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page