饭否 MCP 服务器 - 基于 FastMCP 构建的饭否(Fanfou)MCP 服务器
Project description
饭否 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 文件。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fanfou_mcp-0.1.1.tar.gz.
File metadata
- Download URL: fanfou_mcp-0.1.1.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2717eaa7c4a0ccab172da698cc3beca1701a2005b05ac1c609ff7b46c409f394
|
|
| MD5 |
e0326f69061f5c44b38d3eac1b039f38
|
|
| BLAKE2b-256 |
33f62f013090482ad3bcd8b9cf3b5d97461f6d490e66ecb60682fa6c99c91bf9
|
Provenance
The following attestation bundles were made for fanfou_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on kingcos/fanfou-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fanfou_mcp-0.1.1.tar.gz -
Subject digest:
2717eaa7c4a0ccab172da698cc3beca1701a2005b05ac1c609ff7b46c409f394 - Sigstore transparency entry: 272843155
- Sigstore integration time:
-
Permalink:
kingcos/fanfou-mcp@80e6ec91ba7e9b11e07c0d5e5f6e57e1824144fd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kingcos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@80e6ec91ba7e9b11e07c0d5e5f6e57e1824144fd -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fanfou_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fanfou_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca4646810ef7ff76e5fcc7595c02d707efb7e9d9b143e036fc4a81a0c7310cee
|
|
| MD5 |
8891941ba8f6c1847a7cff2c9dea3214
|
|
| BLAKE2b-256 |
6aaaa9128d4627c31f7d146166f5cdc06fc7fbdc3b7a18951a513b2058c211cd
|
Provenance
The following attestation bundles were made for fanfou_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on kingcos/fanfou-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fanfou_mcp-0.1.1-py3-none-any.whl -
Subject digest:
ca4646810ef7ff76e5fcc7595c02d707efb7e9d9b143e036fc4a81a0c7310cee - Sigstore transparency entry: 272843156
- Sigstore integration time:
-
Permalink:
kingcos/fanfou-mcp@80e6ec91ba7e9b11e07c0d5e5f6e57e1824144fd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kingcos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@80e6ec91ba7e9b11e07c0d5e5f6e57e1824144fd -
Trigger Event:
workflow_dispatch
-
Statement type: