mcp-thread-persistence-demo
MCP Thread Persistence Demo
SQLite에 채팅 스레드 메모를 저장하는 최소한의 MCP(Model Context Protocol) 서버로, 단순히 내부 함수를 직접 호출하는 것이 아니라 실제 stdio 전송을 통해 이 서버를 동작시키는 실제 클라이언트도 포함합니다.
실제 프리랜스 작업 패턴을 본뜬 학습용 예제입니다: "MCP 도구 호출을 수정/구현하여 채팅 스레드 상태를 데이터베이스에 저장하되, upsert 의미(새 항목이면 생성, 기존 항목이면 업데이트, 스레드당 중복 행 없음)를 적용하십시오."
포함 내용
server.py— MCP 서버로 세 가지 도구를 노출합니다:save_note(user_id, thread_id, content)—(user_id, thread_id)를 키로 하여 SQLite에 upsert합니다. 같은 스레드에 두 번째 호출하면 중복 행을 만들지 않고 기존 행을 업데이트합니다.get_note(user_id, thread_id)— 저장된 메모를 다시 읽어옵니다.list_threads(user_id)— 사용자의 모든 스레드를 나열합니다.
test_client.py— stdio를 통해server.py에 연결하는 실제 MCP 클라이언트로,list_tools를 호출한 다음 세 도구를 순서대로 실행합니다(같은 스레드에서save_note를 두 번 호출하여 upsert가 중복 행을 만들지 않는지 확인하는 것을 포함).
Related MCP server: teamshare-server
실행
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python test_client.py참고
의도적으로 mcp<2로 고정했습니다. mcp SDK의 2.x 릴리스에서는 FastMCP가 MCPServer로 이름이 바뀌고 다른 API도 변경되었습니다. 현재 실제로 존재하는 대부분의 튜토리얼/코드베이스는 여전히 1.x FastMCP API를 대상으로 하므로, 이 프로젝트도 그것을 대상으로 합니다.
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
MCP-native notes and memory for ChatGPT, Claude, and other AI tools.
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Persistent memory shared across Claude, ChatGPT, Grok and other MCP clients.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables adding, getting, and listing notes through MCP, with state persisted to a JSON file in the home directory.MIT
- FlicenseNot gradedqualityBmaintenanceEnables coding agents on a team to publish short context notes that are automatically surfaced at the start of every teammate's next session, with read receipts and SQLite-backed persistent storage over MCP.-
- AlicenseAqualityBmaintenanceEnables MCP-compatible agents to remember, recall, link, and forget durable notes across devices, with local SQLite storage and optional libSQL/Turso sync.429 PyPI1MIT
- AlicenseNot gradedqualityCmaintenanceEnables creating, retrieving, updating, deleting, and listing notes through a simple MCP interface, with configurable note storage.MIT