Skip to main content
Glama
BenzyTAi

mcp-thread-persistence-demo

by BenzyTAi

MCP Thread Persistence Demo

SQLite にチャットスレッドのメモを永続化する最小限の MCP (Model Context Protocol) サーバーで、実際の stdio トランスポート経由でそれを実行する本物のクライアントを備えています(基盤となる関数を直接呼び出すだけではありません)。

実際のフリーランス案件のパターンを反映した学習用の演習として構築されています。「チャットスレッドの状態をデータベースに永続化する MCP ツール呼び出しを修正・実装する。upsert セマンティクス(新規なら作成、既存なら更新、スレッドごとに重複行なし)を備える」

内容

  • server.py — 3つのツールを公開する MCP サーバー:

    • save_note(user_id, thread_id, content) — SQLite に upsert し、(user_id, thread_id) をキーとします。同じスレッドへの2回目の呼び出しは、重複を作成せず既存の行を更新します。

    • get_note(user_id, thread_id) — 保存されたメモを読み戻します。

    • list_threads(user_id) — ユーザーのすべてのスレッドを一覧表示します。

  • test_client.py — stdio 経由で server.py に接続し、list_tools を呼び出してから、3つのツールすべてを順番に実行する本物の MCP クライアントです(同じスレッドで save_note を2回呼び出して、upsert が重複行を作成しないことを検証する処理を含みます)。

Related MCP server: Claw Memory Bridge

実行方法

python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

python test_client.py

注記

意図的に mcp<2 に固定しています。mcp SDK の 2.x リリースでは FastMCPMCPServer に改名され、他の API も変更されました。世の中の既存のチュートリアルやコードベースのほとんどは今でも 1.x の FastMCP API を対象としているため、これもそれを対象としています。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides persistent memory management with SQLite, enabling storage and retrieval of conversational context with metadata via MCP tools and REST API.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides a shared memory bridge for AI agents (QClaw, Claude Code, Codex) allowing them to store, search, and retrieve notes, decisions, and conclusions via MCP tools, using local SQLite with optional TencentDB integration.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A local notes app that enables AI tools to manage notes via MCP (list, get, create, update, delete) using the same SQLite database as the GUI.
    16
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables MCP-capable agents to safely and persistently participate in technocore.chat rooms and notes with local did:key identity signing, an append-only activity ledger, duplicate post protection, and injection-hardened reads.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BenzyTAi/mcp-thread-persistence-demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server