Skip to main content
Glama
BenzyTAi

mcp-thread-persistence-demo

by BenzyTAi

MCP Thread Persistence Demo

A minimal MCP (Model Context Protocol) server that persists chat-thread notes to SQLite, with a real client that exercises it over the actual stdio transport (not just calling the underlying functions directly).

Built as a learning exercise mirroring a real freelance job pattern: "fix/implement MCP tool calls that persist chat thread state to a database, with upsert semantics (create if new, update if existing, no duplicate rows per thread)."

What's here

  • server.py — MCP server exposing three tools:

    • save_note(user_id, thread_id, content) — upsert into SQLite, keyed on (user_id, thread_id). Second call on the same thread updates the existing row instead of creating a duplicate.

    • get_note(user_id, thread_id) — read back the saved note.

    • list_threads(user_id) — list all threads for a user.

  • test_client.py — a real MCP client that connects to server.py over stdio, calls list_tools, then exercises all three tools in sequence (including calling save_note twice on the same thread to verify the upsert doesn't create a duplicate row).

Related MCP server: Claw Memory Bridge

Running it

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

python test_client.py

Notes

Pinned to mcp<2 deliberately: the mcp SDK's 2.x release renamed FastMCP to MCPServer and changed other APIs. Most existing tutorials/codebases in the wild still target the 1.x FastMCP API, so that's what this targets too.

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