fanfou-mcp

fanfou-mcp

基于 FastMCP 构建的饭否 MCP 服务器,提供饭否时间线、用户、发布等工具和服务。

Category
Visit Server

README


title: 饭否 MCP 服务器 emoji: 🍚 colorFrom: blue colorTo: purple sdk: gradio sdk_version: "5.36.2" app_file: app.py pinned: false

饭否 MCP 服务器

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

Publish to PyPI

Deploy on Spaces

功能特性

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

演示效果

Claude 中使用效果:

Claude 中使用 fanfou-mcp 演示

Cursor 中使用效果:

Cursor 中使用 fanfou-mcp 演示

快速开始

前提条件

  • Python 3.11+
  • uv 包管理器(用于 uvx 命令)
  • 饭否账号和 API 密钥

客户端配置

MCP 配置

方式1:使用 SSE 方式(基于 Huggingface)

{
  "mcpServers": {
    "fanfou-mcp": {
      "url": "https://kingcos-fanfou-mcp.hf.space/gradio_api/mcp/sse",
      "headers": {
        "X-Fanfou-Api-Key": "your_api_key_here",
        "X-Fanfou-Api-Secret": "your_api_secret_here",
        "X-Fanfou-OAuth-Token": "your_oauth_token_here",
        "X-Fanfou-OAuth-Token-Secret": "your_oauth_token_secret_here"
      }
    }
  }
}

Huggingface 项目地址: https://huggingface.co/spaces/kingcos/fanfou-mcp

注意,首次登录可使用用户名密码,以获取 OAuth Token 与 OAuth-Token-Secret,例如:

{
  "mcpServers": {
    "fanfou-mcp": {
      "url": "https://kingcos-fanfou-mcp.hf.space/gradio_api/mcp/sse",
      "env": {
        "X-Fanfou-Api-Key": "your_api_key_here",
        "X-Fanfou-Api-Secret": "your_api_secret_here",
        "X-Fanfou-Username": "your_username_here",
        "X-Fanfou-Password": "your_password_here"
      }
    }
  }
}

方式2:使用 STDIO 方式

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

如果遇到导入错误,请使用强制更新版本

{
  "mcpServers": {
    "fanfou-mcp": {
      "command": "uvx",
      "args": ["--force-reinstall", "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"
      }
    }
  }
}

注意,首次登录可使用用户名密码,以获取 OAuth Token 与 OAuth-Token-Secret,例如:

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

配置说明:

  • 推荐使用方式1uvx 会自动从 PyPI 下载和运行最新版本,无需本地安装
  • 方式1(SSE):基于 Huggingface 部署的 Web 服务,通过 HTTP 头传递认证信息,支持多用户隔离
  • 缓存问题:如果遇到导入错误,可能是 uvx 缓存了旧版本,请在配置中将 "args": ["fanfou-mcp"] 改为 "args": ["--force-reinstall", "fanfou-mcp"] 来强制更新
  • OAuth Token 方式:避免每次都需要登录,更安全便捷
  • 首次使用:如果没有 OAuth Token,系统会自动生成并显示 OAuth Token,然后再切换
  • 本地开发:如果你需要修改代码或调试,可以使用方式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 文档

文档

许可证

本项目采用 MIT 许可证。详见 LICENSE 文件。

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured