Skip to main content

饭否 MCP 服务器 - 基于 FastMCP 构建的饭否(Fanfou)MCP 服务器

Project description

饭否 MCP 服务器

基于 FastMCP 构建的饭否(Fanfou)MCP 服务器,提供饭否相关的工具和服务。

功能特性

  • 🛠️ 基于 FastMCP 框架构建
  • 🔧 提供饭否相关的工具函数
  • 📡 支持 MCP (Model Context Protocol) 协议
  • 🐍 使用 Python 3.11+ 开发

快速开始

前提条件

  • Python 3.11+
  • uv 包管理器
  • 饭否账号和 API 密钥

安装依赖

# 安装依赖
uv sync

运行服务器

# 直接运行
python main.py

# 或者使用 uv
uv run main.py

客户端配置

MCP 配置

方式1:使用 OAuth Token(推荐)

{
  "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"
      }
    }
  }
}

方式2:使用用户名密码(首次登录)

{
  "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_USERNAME": "your_username_here",
        "FANFOU_PASSWORD": "your_password_here"
      }
    }
  }
}

注意:

  • 请将 /path/to/your/fanfou-mcp 替换为你项目的实际路径
  • 推荐使用方式1:OAuth Token 方式避免每次都需要登录
  • 首次使用:如果没有 OAuth Token,请先使用方式2,系统会自动生成并显示 OAuth Token,然后切换到方式1
  • 请将环境变量中的占位符替换为你的实际饭否 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fanfou_mcp-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fanfou_mcp-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file fanfou_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: fanfou_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fanfou_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2345a44ee67adf398701072c023bf51fd7ba2eb41ca35c51ea3c0c37a4213cc7
MD5 3e3f769bddfebe76987ab8565dc3004a
BLAKE2b-256 f9d2add2d9477d00b7a867205df79730e4bf2902fd9d2f47ec33e2d0cb2cb1c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fanfou_mcp-0.1.0.tar.gz:

Publisher: publish.yml on kingcos/fanfou-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fanfou_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fanfou_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fanfou_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b87a99258afbf08130dec23dd204dd8b7682ba522b68df56f6f49215852f48
MD5 6bca090fc49e72cfa288990313e3d36b
BLAKE2b-256 ec32b1335a7a799501d364bb5e1173d0b0fdd63c93071e07fbd0009d1ae06a8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for fanfou_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kingcos/fanfou-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page