Skip to main content

豆瓣公开内容 MCP Server

概述

Astron-douban-mcp 是一个基于 MCP 协议的豆瓣工具服务,直接调用豆瓣游客态公开接口、公开资料页和公开 RSS 获取公开内容,无需额外部署后端服务。

当前工程形态:

  • 使用 MCP Python SDK
  • 使用单文件 server.py 承载工具定义和 HTTP 调用
  • 通过独立 pyproject 打包
  • 支持 uvx 一键启动
  • 通过环境变量配置超时和 User-Agent

当前提供 6 个原子工具:

  • get_hot_list
  • get_feed_list
  • search_content
  • get_content_detail
  • get_author_profile
  • get_author_content_list

工具列表

1. 获取热榜 get_hot_list

  • 描述:读取豆瓣热榜,默认使用电影热榜。
  • 参数:
    • limit:返回条数,默认 20
    • refresh:是否刷新,默认 False

2. 获取内容流 get_feed_list

  • 描述:读取豆瓣公开内容流。
  • 参数:
    • channel:可选 tv_hot、movie_hot、book_hot
    • cursor:分页游标,默认空,内部按 start 偏移处理
    • limit:返回条数,默认 20
    • refresh:是否刷新,默认 False

3. 搜索内容 search_content

  • 描述:搜索豆瓣公开内容。
  • 参数:
    • query:搜索词,必填
    • cursor:分页游标,默认空,内部按 start 偏移处理
    • limit:返回条数,默认 20

4. 获取内容详情 get_content_detail

  • 描述:读取豆瓣 subject 或 topic 详情。
  • 参数:
    • content_id:subject/topic ID
    • url:内容完整 URL

5. 获取用户主页 get_author_profile

  • 描述:读取豆瓣用户公开主页。
  • 参数:
    • author_id:用户 slug 或数字用户 ID
    • url:用户主页 URL

6. 获取用户公开内容列表 get_author_content_list

  • 描述:读取豆瓣用户公开内容列表。
  • 参数:
    • author_id:用户 slug 或数字用户 ID
    • url:用户主页 URL,或显式收藏页 URL
    • cursor:分页游标,默认空,内部按 start 偏移处理
    • limit:返回条数,默认 20

环境变量

这个包默认不需要认证信息。

可选环境变量:

export DOUBAN_MCP_TIMEOUT_SECONDS="30"
export DOUBAN_MCP_USER_AGENT="Mozilla/5.0 ..."

说明:

  • DOUBAN_MCP_TIMEOUT_SECONDS 控制公开接口请求超时。
  • DOUBAN_MCP_USER_AGENT 用于覆盖默认请求头。

安装与启动

推荐方式:使用 uvx 一键启动

uvx --from astron-douban-mcp astron-douban-mcp

如果你还没有安装 uv / uvx,可先执行:

curl -fsSL https://install.astral.sh/uv | bash

使用 pip 安装

pip install astron-douban-mcp
douban-mcp

本地源码运行

cd MCP/douban-mcp
PYTHONPATH=src python3 -m douban_mcp.server

客户端配置

使用 uvx

{
  "mcpServers": {
    "douban-mcp": {
      "command": "uvx",
      "args": ["--from", "astron-douban-mcp", "astron-douban-mcp"],
      "env": {
        "DOUBAN_MCP_TIMEOUT_SECONDS": "30"
      }
    }
  }
}

使用本地源码

{
  "mcpServers": {
    "douban-mcp": {
      "command": "python3",
      "args": ["-m", "douban_mcp.server"],
      "env": {
        "PYTHONPATH": "/path/to/MCP/douban-mcp/src",
        "DOUBAN_MCP_TIMEOUT_SECONDS": "30"
      }
    }
  }
}

平台差异说明

  1. 这个 MCP 直接请求豆瓣游客态公开接口、公开资料页和公开 RSS,不依赖额外的 Astron 后端服务。
  2. 当前仅面向公开内容能力,不包含登录态、私有内容或用户专属数据。
  3. 作者内容列表优先使用 interests JSON 接口,必要时回退到 RSS 或显式收藏页。
  4. 游客态公开接口可能受网络、地区或平台风控影响,偶发失败时建议稍后重试。

发布说明

cd MCP/douban-mcp
rm -rf build dist src/*.egg-info
python3 -m build --no-isolation
python3 -m twine check dist/*
python3 -m twine upload dist/*

License

Apache License 2.0. See LICENSE.

Metadata

Release files for astron-douban-mcp 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for astron-douban-mcp 0.1.4
File Size Uploaded
astron_douban_mcp-0.1.4.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astron-douban-mcp 0.1.4
File Interpreter ABI Platform
astron_douban_mcp-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / astron_douban_mcp-0.1.4.tar.gz

Download URL astron_douban_mcp-0.1.4.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20a2b5dbc63f4d7313f731f8f4be125f1cd98415a6b533fc1d2e0ebe581c30cf
BLAKE2b-256 checksum
How to use checksums
1abd071a89dfe159e3b9d1df977b69b29f559671eeb9c6271ba632083c786a9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0rc1

Release files / astron_douban_mcp-0.1.4-py3-none-any.whl

Download URL astron_douban_mcp-0.1.4-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9df94bd093dc8151036a591a7a7122666d9679ab8f19741a70dbeb8540611b81
BLAKE2b-256 checksum
How to use checksums
fd87afcb96afaa6e421a7dd3245da729062c2297bf150b7050db8c5c7e214263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0rc1

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page