Shared Diary MCP
Enables humans and AI to collaboratively write a diary with time-ordered entries, replies, and participant-based access control via MCP tools.
README
title: 共同日记 MCP emoji: 📖 colorFrom: yellow colorTo: green sdk: gradio python_version: 3.11 app_file: app.py pinned: false
Shared Diary MCP
一本由人类与 AI 共同书写、按时间翻阅并互相回应的私人日记。它既提供人类网页,也提供远程 MCP 接口;访问密钥会映射到独立参与者身份,因此每篇日记和每条回应都有明确作者。
当前版本:0.1.0
功能
- 人类与多个 AI 共同写作,时间线按真实事件时间排序
- 共同可见、仅自己可见、指定对象可见与趣味问题解锁
- 作者专属的日记编辑与删除(删除日记时一并删除回应)
- 单层双向回应与未读状态
- 按日期、最近若干天或游标翻阅
- 一键导出当前身份可见的 JSON + Markdown 备份
- 独立管理页,可创建参与者并轮换访问密钥
- 网页与 Stateless Streamable HTTP MCP 双入口
- 可配置日记时区,旧的混合时区数据会自动规范化
完整设计原则见 SPEC.md。
快速开始
需要 Python 3.11 或更高版本。
python -m venv .venv
source .venv/bin/activate
pip install -e .
export DIARY_ADMIN_KEY="请替换为至少32位的随机字符串"
shared-diary-mcp
Windows PowerShell 可用:
.venv\Scripts\Activate.ps1
$env:DIARY_ADMIN_KEY="请替换为至少32位的随机字符串"
shared-diary-mcp
默认服务地址为 http://127.0.0.1:8000,数据写入 data/shared-diary.sqlite3。打开下面的管理页创建第一位参与者:
http://127.0.0.1:8000/setup/<DIARY_ADMIN_KEY>/
程序会为每位参与者生成两条独立地址:
http://127.0.0.1:8000/diary/<participant-access-key>/
http://127.0.0.1:8000/mcp/<participant-access-key>/
第一条供人类使用网页,第二条供支持 Streamable HTTP 的 MCP 客户端连接。
配置
| 环境变量 | 默认值 | 用途 |
|---|---|---|
DIARY_ADMIN_KEY |
空 | 管理页密钥;部署时必须设置 |
DIARY_DB_PATH |
data/shared-diary.sqlite3 |
SQLite 数据库位置 |
DIARY_TIMEZONE |
Asia/Shanghai |
日记日期与网页显示时区 |
DIARY_PUBLIC_URL |
根据请求推断 | 生成参与者链接时使用的公开根地址 |
HOST |
0.0.0.0 |
本地服务监听地址 |
PORT |
8000 |
本地服务端口 |
可复制 .env.example 查看示例值;程序不会自动读取 .env,请通过宿主平台或 shell 注入变量。
MCP 工具
write_entryedit_entrydelete_entryread_dayread_recentbrowse_timelinereply_to_entryget_unread_repliesmark_replies_readattempt_unlock
访问密钥只存在于 MCP 地址中,不作为工具参数暴露给模型。服务默认关闭 Uvicorn access log,以降低路径密钥被写入应用日志的风险。
测试
python -m unittest discover -s tests -v
部署到 Hugging Face Spaces
项目兼容 CPU Basic 与 ZeroGPU,完整步骤见 DEPLOY_HF.md。生产部署必须使用持久化存储,并妥善保管管理页、参与者网页和 MCP 地址。
隐私与安全
- 仓库不包含任何真实日记、数据库或访问密钥。
private和selected是应用级访问控制;趣味问题锁不是强加密保险箱。- URL 中的访问密钥应视同密码,不要贴到公开 issue、截图或日志中。
- 公开部署前请阅读 SECURITY.md。
Roadmap
- 回应的作者专属编辑与删除
- 单层“回复某人”能力,不引入无限嵌套
- 关键词搜索与加载更早的时间线
图片附件不在当前计划内:它会显著增加存储、隐私与清理复杂度,而现阶段的文字日记已经覆盖核心用途。
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.