Skip to main content

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

Project description

AWS 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

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": "~/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 Examples

# Start Q CLI
q chat

# Start a new session
start_session(description="backendDev")
# or natural language: "Start session a backendDev"

# Chat normally (automatically saved)
# ... have conversations ...

# List sessions
list_sessions()
# or natural language: "show me session list"

# Resume session (loads full context)
resume_session(session_id="backendDev")
# or natural language: "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, roles, or projects
  2. Semantic Search: Use natural language rather than exact keywords
  3. Context Utilization: Use resume_session for complete conversation restoration
  4. Regular Cleanup: Delete unnecessary sessions to maintain performance

Memory Management

# Clean up old sessions
cleanup_old_sessions(days=30, confirm=true)
# or natural language: "remove old sessions"

# Delete specific session
delete_session(session_id="session_name", confirm=true)
# or natural language: "delete session session_name"

๐Ÿ“„ License

MIT License

๐Ÿ”— Links


AWS Q Memory MCP Server (q_mem_mcp_server) - KOR

Amazon Q CLI๋ฅผ ์œ„ํ•œ ๋Œ€ํ™” ๋ฉ”๋ชจ๋ฆฌ ๋ฐ ์„ธ์…˜ ๊ด€๋ฆฌ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” Model Context Protocol (MCP) ์„œ๋ฒ„์ž…๋‹ˆ๋‹ค.

๐ŸŽฏ ์ฃผ์š” ๊ธฐ๋Šฅ

  • ์ž๋™ ๋Œ€ํ™” ์ €์žฅ: Q CLI ๋Œ€ํ™”๋ฅผ ChromaDB์— ์‹ค์‹œ๊ฐ„ ๋™๊ธฐํ™”
  • ์„ธ์…˜ ๊ด€๋ฆฌ: ์ฃผ์ œ/์„ธ์…˜๋ณ„๋กœ ๋Œ€ํ™” ์ •๋ฆฌ
  • ์ปจํ…์ŠคํŠธ ๋ณต์›: ์ด์ „ ๋Œ€ํ™”์˜ ์ „์ฒด ์ปจํ…์ŠคํŠธ์™€ ํ•จ๊ป˜ ์žฌ๊ฐœ
  • ์˜๋ฏธ ๊ฒ€์ƒ‰: ์ž์—ฐ์–ด๋ฅผ ์‚ฌ์šฉํ•œ ๋Œ€ํ™” ๊ธฐ๋ก ๊ฒ€์ƒ‰

๐Ÿš€ ๋น ๋ฅธ ์‹œ์ž‘

1. MCP ์„ค์ •

~/.aws/amazonq/mcp.json์— ์ถ”๊ฐ€:

{
  "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"
      },
      "disabled": false,
      "autoApprove": [
        "start_session",
        "resume_session", 
        "search_memory_by_session_id",
        "get_storage_stats",
        "list_sessions"
      ]
    }
  }
}

2. ์‚ฌ์šฉ ์˜ˆ์‹œ

# Q CLI ์‹œ์ž‘
q chat

# ์ƒˆ ์„ธ์…˜ ์‹œ์ž‘
start_session(description="๋ฐฑ์—”๋“œ๊ฐœ๋ฐœ")
# ๋˜๋Š” ์ž์—ฐ์–ด: "๋ฐฑ์—”๋“œ๊ฐœ๋ฐœ ์„ธ์…˜ ์‹œ์ž‘ํ•ด์ค˜"

# ์ผ๋ฐ˜์ ์œผ๋กœ ๋Œ€ํ™” (์ž๋™ ์ €์žฅ๋จ)
# ... ๋Œ€ํ™” ์ง„ํ–‰ ...

# ์„ธ์…˜ ๋ชฉ๋ก ๋ณด๊ธฐ
list_sessions()
# ๋˜๋Š” ์ž์—ฐ์–ด: "์„ธ์…˜ ๋ชฉ๋ก ๋ณด์—ฌ์ค˜"

# ์„ธ์…˜ ์žฌ๊ฐœ (์ „์ฒด ์ปจํ…์ŠคํŠธ ๋กœ๋“œ)
resume_session(session_id="๋ฐฑ์—”๋“œ๊ฐœ๋ฐœ")
# ๋˜๋Š” ์ž์—ฐ์–ด: "๋ฐฑ์—”๋“œ๊ฐœ๋ฐœ ์„ธ์…˜์œผ๋กœ ์žฌ๊ฐœํ•ด์ค˜"

๐Ÿ› ๏ธ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ช…๋ น์–ด

๋ช…๋ น์–ด ์„ค๋ช…
start_session(description) ์ƒˆ ์„ธ์…˜ ์‹œ์ž‘
list_sessions() ๋ชจ๋“  ์„ธ์…˜ ๋ชฉ๋ก ๋ณด๊ธฐ
resume_session(session_id) ์ „์ฒด ์ปจํ…์ŠคํŠธ์™€ ํ•จ๊ป˜ ์„ธ์…˜ ์žฌ๊ฐœ
search_memory_by_session_id(session_id, query) ์ด์ „ ๋Œ€ํ™” ๊ฒ€์ƒ‰
delete_session(session_id, confirm=true) ์„ธ์…˜ ์‚ญ์ œ
get_storage_stats() ์ €์žฅ์†Œ ์ƒํƒœ ํ™•์ธ

๐Ÿ”ง ๊ธฐ์ˆ  ์Šคํƒ

  • ChromaDB: ๋Œ€ํ™” ์ €์žฅ ๋ฐ ๊ฒ€์ƒ‰์„ ์œ„ํ•œ ๋ฒกํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
  • SQLite WAL: Q CLI ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์‹ค์‹œ๊ฐ„ ๋™๊ธฐํ™”
  • Sentence Transformers: ์˜๋ฏธ ๊ฒ€์ƒ‰ ์ž„๋ฒ ๋”ฉ
  • MCP Protocol: Amazon Q์™€์˜ ํ†ต์‹ 

๐Ÿ“ ๋ฐ์ดํ„ฐ ์ €์žฅ

  • ChromaDB: ~/.Q_mem/chroma_db/
  • ๋™๊ธฐํ™” ์ƒํƒœ: ~/.Q_mem/sync_state.json
  • ๋กœ๊ทธ: ~/.Q_mem/q_mem.log

๐Ÿ”„ ์ž๋™ ๋™๊ธฐํ™” ๊ธฐ๋Šฅ

Q CLI ๋Œ€ํ™”๊ฐ€ ChromaDB์— ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ž๋™ ์ €์žฅ๋ฉ๋‹ˆ๋‹ค:

  • ์‹ค์‹œ๊ฐ„ ๊ฐ์ง€: 2์ดˆ๋งˆ๋‹ค ์ƒˆ๋กœ์šด ๋Œ€ํ™” ํ™•์ธ
  • ๋ถ€๋ถ„ ์‹คํŒจ ์ฒ˜๋ฆฌ: ์ผ๋ถ€ ์‹คํŒจํ•ด๋„ ์„ฑ๊ณตํ•œ ๋Œ€ํ™”๋Š” ์ €์žฅ
  • ์ž๋™ ๋ณต๊ตฌ: ์—ฐ์† ์‹คํŒจ ์‹œ ์ž๋™ ๋ณต๊ตฌ
  • ์ƒํƒœ ๋ณต์›: ์žฌ์‹œ์ž‘ ํ›„ ๋™๊ธฐํ™” ์ƒํƒœ ๋ณต์›

๐Ÿ’ก ์‚ฌ์šฉ ํŒ

  1. ์„ธ์…˜ ์ •๋ฆฌ: ์ฃผ์ œ, ์—ญํ• , ํ”„๋กœ์ ํŠธ๋ณ„๋กœ ๋Œ€ํ™” ๋ถ„๋ฆฌ
  2. ์˜๋ฏธ ๊ฒ€์ƒ‰: ์ •ํ™•ํ•œ ํ‚ค์›Œ๋“œ๋ณด๋‹ค ์ž์—ฐ์–ด ์‚ฌ์šฉ
  3. ์ปจํ…์ŠคํŠธ ํ™œ์šฉ: ์™„์ „ํ•œ ๋Œ€ํ™” ๋ณต์›์„ ์œ„ํ•ด resume_session ์‚ฌ์šฉ
  4. ์ •๊ธฐ ์ •๋ฆฌ: ์„ฑ๋Šฅ ์œ ์ง€๋ฅผ ์œ„ํ•ด ๋ถˆํ•„์š”ํ•œ ์„ธ์…˜ ์‚ญ์ œ

๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ

# ์˜ค๋ž˜๋œ ์„ธ์…˜ ์ •๋ฆฌ
cleanup_old_sessions(days=30, confirm=true)
# ๋˜๋Š” ์ž์—ฐ์–ด: "์˜ค๋ž˜๋œ ์„ธ์…˜ ์‚ญ์ œํ•ด์ค˜"

# ํŠน์ • ์„ธ์…˜ ์‚ญ์ œ
delete_session(session_id="์„ธ์…˜์ด๋ฆ„", confirm=true)
# ๋˜๋Š” ์ž์—ฐ์–ด: "์„ธ์…˜์ด๋ฆ„ ์„ธ์…˜ ์‚ญ์ œํ•ด์ค˜"

๐Ÿ“„ ๋ผ์ด์„ ์Šค

MIT License

๐Ÿ”— ๋งํฌ

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.3.tar.gz (25.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.3-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: q_mem_mcp_server-1.0.3.tar.gz
  • Upload date:
  • Size: 25.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.3.tar.gz
Algorithm Hash digest
SHA256 09bfb95cd553bd102da95ab166a040a1452515a4b708e1750c01602196d3e864
MD5 9d01e09edd6e59cc21f189e5b7d5f4f2
BLAKE2b-256 835fe76a74060b801f4ea96adc874beb8676ab7c2b8691d24de6472cc7e8caa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for q_mem_mcp_server-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee98ce343697838c372c27026cafc320937fd1ba6b6c226cc0efeb09209822d6
MD5 eab15830347333edb119cbc4cc8a6b2c
BLAKE2b-256 991202ecc6640e0aca3a02dda3061ca07c867720a174c382764de2e0fe2cfc98

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