Skip to main content
Glama
hardcover-mcp

hardcover-mcp

by muhyousri

hardcover-mcp

⚠️ Beta v0.1.0 — 这是早期版本。API 接口范围、工具名称和查询结构可能会发生变化。请通过 GitHub Issues 报告问题和反馈。

一个面向 Hardcover API 的 Model Context Protocol (MCP) 服务器。Hardcover 是图书追踪平台,其网站、iOS 和 Android 应用都使用同一个 GraphQL API。

将任何兼容 MCP 的 AI 助手(Claude Desktop、Cursor、Kiro 或任何 MCP 客户端)直接连接到你的 Hardcover 藏书、阅读历史、阅读目标和完整的 Hardcover 图书目录。


目录


Related MCP server: hardcover-mcp

功能

  • 🔍 搜索 — 图书、作者、系列、用户、书单、角色、出版方和阅读提示

  • 📚 浏览你的藏书 — 所有状态、筛选视图和分页结果

  • 📖 阅读进度 — 当前正在阅读的图书及页码级进度

  • 📊 阅读统计 — 本月、今年和所有时间读过的图书,包含平均评分

  • 🎯 阅读目标 — 所有目标的进度、目标值、当前状态和日期

  • 🗓️ 按日期范围找书 — 列出你在两个日期之间读过的每一本书

  • 📓 阅读日志 — 每本书的阅读会话历史

  • 👤 用户主页 — 你的个人资料及他人公开资料

  • 📋 书单 — 查看任意 Hardcover 书单及其中的图书

  • 🏃 动态流 — 你的近期动态和单本书上的社区动态

  • 🔖 版本 — 通过书名、ID 或 ISBN-10/13 查询版本

  • ✍️ 作者 — 作者主页与创作书目

  • 📚 系列 — 有序、去重后的图书列表


工具参考

身份

工具

说明

get_me

当前登录用户的资料:用户 ID、用户名、姓名、简介、所在地、藏书数量、关注者数、标识、Pro 状态

搜索

工具

参数

说明

search

query, query_type?, per_page?, page?

搜索图书、作者、系列、用户、书单、角色、出版社或阅读提示词

图书

工具

参数

说明

get_book_by_id

id

按 Hardcover ID 获取完整图书详情

get_book_by_slug

slug

按 URL 别名获取完整图书详情(例如 the-name-of-the-wind)

get_editions_by_title

title

获取所有与精确书名匹配的版本

get_edition_by_id

id

获取单个版本详情

get_editions_by_isbn

isbn

按 ISBN-10 或 ISBN-13 查询版本(仅数字)

作者

工具

参数

说明

get_author_by_id

id

按 ID 获取作者资料

get_author_by_slug

slug

按 URL 别名获取作者资料(例如 brandon-sanderson)

get_author_books

author_id, limit?, offset?

获取某作者的全部图书,按热度排序

系列

工具

参数

说明

get_series_by_id

id

系列元数据:名称、描述、图书数量

get_books_in_series

series_id

有序、去重后的图书列表 — 排除不完整的小册子和合集

我的藏书

工具

参数

说明

get_my_library

limit?, offset?

获取完整藏书(所有状态,支持分页)

get_library_by_status

status_id, limit?, offset?

按阅读状态筛选藏书

get_reading_progress

—

当前正在阅读的图书及页码进度

get_user_book

book_id

你与某本书的关系:状态、评分、书评、阅读会话

get_my_reading_journal

book_id

某本书的阅读日志与阅读历史

状态 ID: 1 想读 · 2 正在阅读 · 3 已读 · 4 暂停 · 5 未读完 · 6 忽略

阅读统计

工具

参数

说明

get_reading_stats

user_id, since?

全部时间的数量 + 平均评分,以及指定日期(YYYY-MM-DD)之后的数量。用 since=2026-01-01 查看今年的数据,since=2026-08-01 查看本月的数据

get_books_read_between

user_id, since, until, limit?, offset?

获取两个日期之间读完的图书,按最近阅读优先排序

目标

工具

参数

说明

get_my_goals

—

获取全部阅读目标,包括进度、目标值、状态和日期

动态

工具

参数

说明

get_my_activity

user_id, limit?, offset?

你的动态流(添加图书、评分、书评、目标、书单)

get_book_activities

book_id, limit?, offset?

某本书上的社区动态

其他用户

工具

参数

说明

get_user_by_username

username

查找公开用户资料

get_user_library

user_id, status_id, limit?, offset?

他人按阅读状态筛选的书库

书单

工具

参数

说明

get_list_by_id

id

查看书单详情及其中的图书(最多 50 本)


环境要求


安装

使用 uv(推荐)

git clone https://github.com/YOUR_USERNAME/hardcover-mcp
cd hardcover-mcp
uv sync

使用 pip

git clone https://github.com/YOUR_USERNAME/hardcover-mcp
cd hardcover-mcp
pip install -e .

通过 PyPI(发布后)

uv pip install hardcover-mcp
# or
pip install hardcover-mcp

配置

将 .env.example 复制为 .env 并添加你的 API 密钥:

cp .env.example .env
HARDCOVER_API_KEY=your_api_key_here

请保管好你的令牌。 个人访问令牌可访问你的 Hardcover 账户,切勿提交到版本控制,也不要公开或嵌入到客户端代码中。


使用方法

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows):

{
  "mcpServers": {
    "hardcover": {
      "command": "uv",
      "args": [
        "run",
        "--with-editable",
        "/path/to/hardcover-mcp",
        "hardcover-mcp"
      ],
      "env": {
        "HARDCOVER_API_KEY": "your_api_key_here"
      }
    }
  }
}

或者,如果通过 pip/uv 安装在虚拟环境中:

{
  "mcpServers": {
    "hardcover": {
      "command": "/path/to/venv/bin/hardcover-mcp",
      "env": {
        "HARDCOVER_API_KEY": "your_api_key_here"
      }
    }
  }
}

Kiro CLI

添加到 ~/.kiro/settings/mcp.json:

{
  "mcpServers": {
    "hardcover": {
      "command": "/path/to/uv",
      "args": [
        "run",
        "--with-editable",
        "/path/to/hardcover-mcp",
        "hardcover-mcp"
      ],
      "env": {
        "HARDCOVER_API_KEY": "your_api_key_here"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

其他 MCP 客户端

将你的客户端指向 hardcover-mcp 入口(或 python -m hardcover.server),并在环境中设置 HARDCOVER_API_KEY。该服务器通过 stdio 通信,兼容任何 MCP 1.0 及以上客户端。


速率限制与 API 政策

在使用本服务器开发前,请务必阅读。 Hardcover API 是免费的,但存在硬性限制。意外触发限制可能会影响你的工作流。

速率限制

计划

每日限额

突发限制

每分钟限制

免费版

5,000 请求/天

10 请求

60 请求/分钟

支持者版

50,000 请求/天

15 请求

60 请求/分钟

  • 每日限额:硬性限制。一旦达到,所有请求将返回 429,直到 UTC 午夜。

  • 突发限额:限流前可连续发出的请求数量。每分钟动态补充。

  • 每分钟限额:所有套餐均为 60 请求/分钟(令牌桶)。

  • 单次请求限额:一个 GraphQL 请求最多包含 5 个顶层查询。超出会返回 403 而非 429。

  • Personal Access Tokens 在同一套餐下,其突发容量为旧版 JWT 认证的两倍。

该 MCP 服务器会在返回 429 时给出 retry_after 提示,方便 AI 助手从容退出。

商业使用

根据 Hardcover API 政策:

  • 用户自有数据(藏书、评分、书评、日志、列表、目标)不得用于商业产品,除非你代表明确授权的用户行动。

  • 聚合、匿名化数据(如 Hardcover 读者数量、Hardcover 平均评分)可用于商业用途,但需要注明来源。

  • Hemat from Hardcover 的图片为普通用户上传。如果你公开展示,必须提供 DMCA 删除政策。

禁止的查询模式

以下 GraphQL 运算符已被 API 禁用:

_like, _nlike, _ilike, _niregex, _nregex, _iregex, _regex, _nsimilar, _similar

查询必须在服务端执行

Hardcover API 不得从浏览器调用。API 密钥必须保存在安全的服务器环境中。

更多详情请参阅官方 入门指南。


免责声明

这是一个测试版(v0.1.0)。 它是独立的社区构建软件,不隶属于 Hardcover,也不受其认可或支持。

  • Hardcover API 本身也处于 beta 阶段,并可能发生破坏性变更。

  • 此 MCP 服务器中的工具名称、查询结构和响应结构在不同版本之间可能会发生变化。

  • 在生产环境或商业环境中使用,风险完全由你自己承担。

  • 通过此服务器使用 Hardcover API,即表示你同意 Hardcover 的政策。


开发

git clone https://github.com/YOUR_USERNAME/hardcover-mcp
cd hardcover-mcp

# Create virtualenv and install with dev deps
uv sync --extra dev
# or: pip install -e ".[dev]"

# Run tests
uv run pytest
# or: python -m pytest

# Run the server locally (needs HARDCOVER_API_KEY in environment)
HARDCOVER_API_KEY=your_key hardcover-mcp

项目结构

hardcover-mcp/
├── hardcover/
│   ├── __init__.py
│   ├── client.py      # GraphQL HTTP client, rate-limit handling, error mapping
│   ├── queries.py     # All GraphQL query strings
│   └── server.py      # MCP server, tool definitions, dispatch
├── tests/
│   ├── conftest.py    # Shared fixtures
│   ├── test_client.py # 30 client tests (HTTP errors, rate limits, response parsing)
│   └── test_server.py # 51 server tests (tool dispatch, error formatting)
├── .env.example
├── .gitignore
├── pyproject.toml
└── README.md

运行测试

pytest                  # all tests
pytest tests/test_client.py   # client only
pytest tests/test_server.py   # server only
pytest -v               # verbose

贡献

欢迎贡献。请遵循以下要求:

  1. 先打开一个 issue 来讨论重大变更

  2. 遵循现有的代码风格

  3. 为任何行为变更添加或更新测试

  4. 保持 PR 聚焦 —— 每个 PR 只涉及一个功能或修复


许可证

MIT —— 详见 LICENSE。

Available Tools

25 tools
get_author_booksA

Get books written by a specific author, ordered by popularity.

Inputs: author_id (required), limit, offset.

get_author_by_idA

Get an author's profile by Hardcover author ID.

Inputs: id (required).

get_author_by_slugA

Get an author's profile by URL slug (e.g. 'brandon-sanderson').

Inputs: slug (required).

get_book_activitiesA

Get recent user activity for a specific book (ratings, reviews, status changes).

Inputs: book_id (required), limit, offset.

get_book_by_idB

Get full book details by Hardcover book ID.

Inputs: id (required).

get_book_by_slugA

Get full book details by Hardcover URL slug (e.g. 'the-name-of-the-wind').

Inputs: slug (required).

get_books_in_seriesA

Get the ordered, deduplicated list of books in a series. Merges duplicates, excludes partial books and compilations.

Inputs: series_id (required).

get_books_read_betweenA

List books marked as Read with a finish date between two dates, ordered most-recent first.

Inputs: since (required), until (required), user_id (required), limit, +1 more.

get_edition_by_idA

Get detailed information about a specific edition by its ID.

Inputs: id (required).

get_editions_by_isbnB

Look up an edition by ISBN-10 or ISBN-13.

Inputs: isbn (required).

get_editions_by_titleA

Get all known editions of a book by exact title match.

Inputs: title (required).

get_library_by_statusA

Get the authenticated user's books filtered by reading status. Status IDs: 1=Want to Read, 2=Currently Reading, 3=Read, 4=Did Not Finish, 5=Owned.

Inputs: status_id (required), limit, offset.

get_list_by_idA

Get a Hardcover list's details and its books (up to 50 books).

Inputs: id (required).

get_meA

Get the currently authenticated Hardcover user's profile (id, username, name, book counts).

Inputs: no named parameters.

get_my_activitiesA

Get a user's recent activity feed (books added, rated, reviewed, goals, lists). Requires the user's numeric ID.

Inputs: user_id (required), limit, offset.

get_my_goalsA

Get the authenticated user's reading goals (progress, target, state, dates).

Inputs: no named parameters.

get_my_libraryA

Get the authenticated user's full library (all statuses), paginated.

Inputs: limit, offset.

get_my_reading_journalB

Get reading journal entries and session history for a specific book.

Inputs: book_id (required).

get_reading_progressB

Get all books currently being read with their page-level progress.

Inputs: no named parameters.

get_reading_statsA

Get reading statistics: total books read all-time AND since an optional date (e.g. '2026-01-01' for this year, '2026-08-01' for this month), plus average rating for each window. Requires the user's numeric ID (use get_me to find it).

Inputs: user_id (required), since.

get_series_by_idA

Get series metadata (name, description, book count) by series ID.

Inputs: id (required).

get_user_bookA

Get the authenticated user's relationship with a specific book (status, rating, review, read sessions).

Inputs: book_id (required).

get_user_by_usernameB

Look up a public Hardcover user profile by username.

Inputs: username (required).

get_user_libraryA

Get another user's library filtered by reading status. Status IDs: 1=Want to Read, 2=Currently Reading, 3=Read, 4=Did Not Finish, 5=Owned.

Inputs: user_id (required), status_id (required), limit, offset.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools map cleanly to distinct resources: books, editions, authors, series, users, libraries, progress, stats, and activities. The main minor ambiguities are the parallel id/slug lookups for books/authors and the broad `search` tool, but these are clearly separated by input type.

    Naming Consistency5/5

    The overwhelming majority of tools follow a predictable `get_<resource>` or `get_<resource>_by_<key>` snake_case pattern. The single standalone `search` tool is a minor but logical exception, and it does not disrupt the overall consistency.

    Tool Count3/5

    25 tools is at the boundary where a server starts to feel heavy, though each tool is a distinct read-only lookup in a rich book/reading domain. Some consolidation, especially around edition lookups and library/status variants, could reduce redundancy without losing functionality.

    Completeness4/5

    The read-only surface is strong: it covers books, editions, authors, series, users, libraries, reading progress, stats, lists, and activities. However, it offers no create/update/delete capabilities for library status, ratings, reviews, or lists, so users expecting a full reading-app workflow will hit dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to help users manage their reading experience by searching books, tracking reading progress, managing bookmarks, and generating personalized recommendations and summaries.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Connects AI assistants to the Hardcover book library, enabling natural language book searches, reading status updates, list management, and library exploration.
      28
      107 PyPI
      10
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Connects MCP clients to a Calibre ebook library for semantic search, metadata curation, and library management via natural language.
      19
      304 npm
      33
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude, ChatGPT, and other MCP clients to read and manage a Hardcover account's library, reading progress, reviews, journal, lists, goals, follows, and notifications through 53 read/write tools. It is a hosted remote server that connects each user to their own account via Hardcover's OAuth sign-in, with six raw GraphQL tools reaching anything else in the API.
      3
      MIT