饭否 MCP 服务器
基于 FastMCP 构建的饭否(Fanfou)MCP 服务器,提供饭否相关的工具和服务。
功能特性
- 🛠️ 基于 FastMCP 框架构建
- 🔧 提供饭否相关的工具函数
- 📡 支持 MCP (Model Context Protocol) 协议
- 🐍 使用 Python 3.11+ 开发
快速开始
前提条件
- Python 3.11+
- uv 包管理器(用于
uvx命令) - 饭否账号和 API 密钥
使用方式
推荐:直接使用 uvx(无需本地安装)
# uvx 会自动从 PyPI 下载并运行最新版本
uvx fanfou-mcp
本地开发模式
如果你需要修改代码或进行开发:
# 克隆仓库
git clone https://github.com/kingcos/fanfou-mcp.git
cd fanfou-mcp
# 安装依赖
uv sync
# 运行服务器
python main.py
# 或者使用 uv
uv run main.py
客户端配置
MCP 配置
方式1:使用 uvx(推荐,无需本地安装)
{
"mcpServers": {
"fanfou-mcp": {
"command": "uvx",
"args": ["fanfou-mcp"],
"env": {
"FANFOU_API_KEY": "your_api_key_here",
"FANFOU_API_SECRET": "your_api_secret_here",
"FANFOU_OAUTH_TOKEN": "your_oauth_token_here",
"FANFOU_OAUTH_TOKEN_SECRET": "your_oauth_token_secret_here"
}
}
}
}
方式2:使用 uvx + 用户名密码(首次登录)
{
"mcpServers": {
"fanfou-mcp": {
"command": "uvx",
"args": ["fanfou-mcp"],
"env": {
"FANFOU_API_KEY": "your_api_key_here",
"FANFOU_API_SECRET": "your_api_secret_here",
"FANFOU_USERNAME": "your_username_here",
"FANFOU_PASSWORD": "your_password_here"
}
}
}
}
方式3:本地开发模式
{
"mcpServers": {
"fanfou-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/your/fanfou-mcp", "run", "python", "main.py"],
"env": {
"FANFOU_API_KEY": "your_api_key_here",
"FANFOU_API_SECRET": "your_api_secret_here",
"FANFOU_OAUTH_TOKEN": "your_oauth_token_here",
"FANFOU_OAUTH_TOKEN_SECRET": "your_oauth_token_secret_here"
}
}
}
}
注意:
- 推荐使用方式1:
uvx会自动从 PyPI 下载和运行最新版本,无需本地安装 - OAuth Token 方式:避免每次都需要登录,更安全便捷
- 首次使用:如果没有 OAuth Token,请先使用方式2,系统会自动生成并显示 OAuth Token,然后切换到方式1
- 本地开发:如果你需要修改代码或调试,可以使用方式3
- 请将环境变量中的占位符替换为你的实际饭否 API 凭据
可用工具
本服务器提供以下工具:
认证相关
generate_oauth_token- 生成 OAuth Token
时间线相关
get_home_timeline- 获取首页时间线get_user_timeline- 获取用户时间线get_public_timeline- 获取公开时间线
用户和内容相关
get_user_info- 获取用户信息get_status_info- 获取饭否内容详情
互动相关
manage_favorite- 管理收藏状态manage_friendship- 管理关注状态
发布相关
publish_status- 发布文字内容publish_photo- 发布图片内容delete_status- 删除内容
详细的 API 文档请参考:API 文档
开发和发布
本地测试构建
# 测试包构建
python scripts/test_build.py
# 手动构建
uv build
发布到 PyPI
本项目使用 GitHub Actions 自动发布到 PyPI。详细信息请参考:发布指南
文档
许可证
本项目采用 MIT 许可证。详见 LICENSE 文件。
Metadata
Release files for fanfou-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fanfou_mcp-0.1.1.tar.gz | 19.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fanfou_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.2 kB
Release files / fanfou_mcp-0.1.1.tar.gz
| Download URL | fanfou_mcp-0.1.1.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2717eaa7c4a0ccab172da698cc3beca1701a2005b05ac1c609ff7b46c409f394
|
|
BLAKE2b-256 checksum How to use checksums |
33f62f013090482ad3bcd8b9cf3b5d97461f6d490e66ecb60682fa6c99c91bf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2025.
Transparency logRelease files / fanfou_mcp-0.1.1-py3-none-any.whl
| Download URL | fanfou_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca4646810ef7ff76e5fcc7595c02d707efb7e9d9b143e036fc4a81a0c7310cee
|
|
BLAKE2b-256 checksum How to use checksums |
6aaaa9128d4627c31f7d146166f5cdc06fc7fbdc3b7a18951a513b2058c211cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2025.
Transparency log