weread-shelf
Enables SQL queries on WeRead (微信读书) book data by syncing it into DuckDB, with an MCP server for agent-based analysis and cross-source joins.
README
weread-shelf
微信读书 + DuckDB = 用 SQL 分析你的书架
CLI · SQL · MCP · Skill · 跨源 join 你的其他本地数据
为什么需要这个?
weread CLI 能查书、查笔记、查阅读时长 —— 但不能跨源 join。
你想知道"我最近 30 天加的 AI 书有哪些还没读?" weread 给不了 SQL 答案。
weread-shelf 把 weread 数据塞进 DuckDB,让你能:
-- 完读率按类别统计
SELECT category, COUNT(*), SUM(finishReading) AS read,
ROUND(SUM(finishReading)*100.0/COUNT(*),1) AS pct
FROM shelf
GROUP BY 1 ORDER BY pct DESC;
-- 跨源:join 你机器上其他 db
ATTACH '~/xiaozhi/data/devices.db' AS xz (TYPE SQLITE);
SELECT b.title, b.finishReading, xz.last_active
FROM shelf b
LEFT JOIN xz.devices xz ON xz.user_id = b.bookId;
安装
pip install weread-shelf
# 或本地 clone
git clone https://github.com/flybear16/weread-shelf
cd weread-shelf && pip install -e .
前置:
- weread CLI 已装 (
npm i -g weread-agent-cli) - DuckDB ≥ 1.3(CLI 自带)
4 种使用方式
1. CLI 模板查询(无需写 SQL)
weread-shelf analysis # 全量画像
weread-shelf finish-rate --category # 按类别完读率
weread-shelf recent --days 30 # 最近 30 天加的书
weread-shelf top-authors # 高产作者
weread-shelf categories # 类别饼图(ASCII)
2. 直通 SQL
weread-shelf sql "SELECT * FROM shelf WHERE finishReading=0 LIMIT 5"
weread-shelf sql --file ./my-query.sql
3. MCP Server(Agent 可调)
{
"mcpServers": {
"weread-shelf": {
"command": "weread-shelf-mcp",
"args": []
}
}
}
4. Skill(Hermes / Claude Code / OpenClaw)
npx openskills add flybear16/weread-shelf
命令速查
| 命令 | 作用 |
|---|---|
weread-shelf doctor |
检查 weread CLI + DuckDB + auth |
weread-shelf sync |
拉取最新数据到本地 DuckDB |
weread-shelf analysis |
全量画像 |
weread-shelf sql <query> |
直通 SQL |
weread-shelf join <path> |
Attach 一个外部 db |
weread-shelf export --format parquet/csv/json |
导出 |
License
MIT © flybear16
Security
weread-shelf never sees, stores, or transmits your WeRead API key.
- All authentication is delegated to the local
wereadCLI - Your
wrk-...key lives in~/.weread-cli/config.json(managed byweread config set-key) - weread-shelf only calls the public
wereadcommands (shelf list,doctor, etc.) - No key material is required or read by this project
- The local DuckDB cache at
~/.weread-shelf/cache.duckdbcontains only your book metadata (titles, authors, categories, finish status) — never your key
If you fork this project, you don't need to add a key. Each user runs weread config set-key themselves on their own machine.
Reporting vulnerabilities: open a GitHub issue with [security] prefix, or email flybear16@outlook.com.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.