fanfou-mcp


Namefanfou-mcp JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
Summary饭否 MCP 服务器 - 基于 FastMCP 构建的饭否(Fanfou)MCP 服务器
upload_time2025-07-13 02:45:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2025 kingcos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords fanfou mcp model-context-protocol social-media
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 饭否 MCP 服务器

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

[![Publish to PyPI](https://github.com/kingcos/fanfou-mcp/actions/workflows/publish.yml/badge.svg)](https://github.com/kingcos/fanfou-mcp/actions/workflows/publish.yml)

## 功能特性

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

## 快速开始

### 前提条件

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

### 使用方式

#### 推荐:直接使用 uvx(无需本地安装)

```bash
# uvx 会自动从 PyPI 下载并运行最新版本
uvx fanfou-mcp
```

#### 本地开发模式

如果你需要修改代码或进行开发:

```bash
# 克隆仓库
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(推荐,无需本地安装)

```json
{
  "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 + 用户名密码(首次登录)

```json
{
  "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:本地开发模式

```json
{
  "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 文档](docs/API.md)

## 开发和发布

### 本地测试构建

```bash
# 测试包构建
python scripts/test_build.py

# 手动构建
uv build
```

### 发布到 PyPI

本项目使用 GitHub Actions 自动发布到 PyPI。详细信息请参考:[发布指南](docs/PUBLISHING.md)

## 文档

- [API 文档](docs/API.md) - 详细的工具函数说明
- [发布指南](docs/PUBLISHING.md) - 如何发布到 PyPI

## 许可证

本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fanfou-mcp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "fanfou, mcp, model-context-protocol, social-media",
    "author": null,
    "author_email": "kingcos <kingcos@foxmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/33/f6/2f013090482ad3bcd8b9cf3b5d97461f6d490e66ecb60682fa6c99c91bf9/fanfou_mcp-0.1.1.tar.gz",
    "platform": null,
    "description": "# \u996d\u5426 MCP \u670d\u52a1\u5668\n\n\u57fa\u4e8e FastMCP \u6784\u5efa\u7684\u996d\u5426\uff08Fanfou\uff09MCP \u670d\u52a1\u5668\uff0c\u63d0\u4f9b\u996d\u5426\u76f8\u5173\u7684\u5de5\u5177\u548c\u670d\u52a1\u3002\n\n[![Publish to PyPI](https://github.com/kingcos/fanfou-mcp/actions/workflows/publish.yml/badge.svg)](https://github.com/kingcos/fanfou-mcp/actions/workflows/publish.yml)\n\n## \u529f\u80fd\u7279\u6027\n\n- \ud83d\udee0\ufe0f \u57fa\u4e8e FastMCP \u6846\u67b6\u6784\u5efa\n- \ud83d\udd27 \u63d0\u4f9b\u996d\u5426\u76f8\u5173\u7684\u5de5\u5177\u51fd\u6570\n- \ud83d\udce1 \u652f\u6301 MCP (Model Context Protocol) \u534f\u8bae\n- \ud83d\udc0d \u4f7f\u7528 Python 3.11+ \u5f00\u53d1\n\n## \u5feb\u901f\u5f00\u59cb\n\n### \u524d\u63d0\u6761\u4ef6\n\n- Python 3.11+\n- uv \u5305\u7ba1\u7406\u5668\uff08\u7528\u4e8e `uvx` \u547d\u4ee4\uff09\n- \u996d\u5426\u8d26\u53f7\u548c API \u5bc6\u94a5\n\n### \u4f7f\u7528\u65b9\u5f0f\n\n#### \u63a8\u8350\uff1a\u76f4\u63a5\u4f7f\u7528 uvx\uff08\u65e0\u9700\u672c\u5730\u5b89\u88c5\uff09\n\n```bash\n# uvx \u4f1a\u81ea\u52a8\u4ece PyPI \u4e0b\u8f7d\u5e76\u8fd0\u884c\u6700\u65b0\u7248\u672c\nuvx fanfou-mcp\n```\n\n#### \u672c\u5730\u5f00\u53d1\u6a21\u5f0f\n\n\u5982\u679c\u4f60\u9700\u8981\u4fee\u6539\u4ee3\u7801\u6216\u8fdb\u884c\u5f00\u53d1\uff1a\n\n```bash\n# \u514b\u9686\u4ed3\u5e93\ngit clone https://github.com/kingcos/fanfou-mcp.git\ncd fanfou-mcp\n\n# \u5b89\u88c5\u4f9d\u8d56\nuv sync\n\n# \u8fd0\u884c\u670d\u52a1\u5668\npython main.py\n# \u6216\u8005\u4f7f\u7528 uv\nuv run main.py\n```\n\n## \u5ba2\u6237\u7aef\u914d\u7f6e\n\n### MCP \u914d\u7f6e\n\n#### \u65b9\u5f0f1\uff1a\u4f7f\u7528 uvx\uff08\u63a8\u8350\uff0c\u65e0\u9700\u672c\u5730\u5b89\u88c5\uff09\n\n```json\n{\n  \"mcpServers\": {\n    \"fanfou-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"fanfou-mcp\"],\n      \"env\": {\n        \"FANFOU_API_KEY\": \"your_api_key_here\",\n        \"FANFOU_API_SECRET\": \"your_api_secret_here\",\n        \"FANFOU_OAUTH_TOKEN\": \"your_oauth_token_here\",\n        \"FANFOU_OAUTH_TOKEN_SECRET\": \"your_oauth_token_secret_here\"\n      }\n    }\n  }\n}\n```\n\n#### \u65b9\u5f0f2\uff1a\u4f7f\u7528 uvx + \u7528\u6237\u540d\u5bc6\u7801\uff08\u9996\u6b21\u767b\u5f55\uff09\n\n```json\n{\n  \"mcpServers\": {\n    \"fanfou-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"fanfou-mcp\"],\n      \"env\": {\n        \"FANFOU_API_KEY\": \"your_api_key_here\",\n        \"FANFOU_API_SECRET\": \"your_api_secret_here\",\n        \"FANFOU_USERNAME\": \"your_username_here\",\n        \"FANFOU_PASSWORD\": \"your_password_here\"\n      }\n    }\n  }\n}\n```\n\n#### \u65b9\u5f0f3\uff1a\u672c\u5730\u5f00\u53d1\u6a21\u5f0f\n\n```json\n{\n  \"mcpServers\": {\n    \"fanfou-mcp\": {\n      \"command\": \"uv\",\n      \"args\": [\"--directory\", \"/path/to/your/fanfou-mcp\", \"run\", \"python\", \"main.py\"],\n      \"env\": {\n        \"FANFOU_API_KEY\": \"your_api_key_here\",\n        \"FANFOU_API_SECRET\": \"your_api_secret_here\",\n        \"FANFOU_OAUTH_TOKEN\": \"your_oauth_token_here\",\n        \"FANFOU_OAUTH_TOKEN_SECRET\": \"your_oauth_token_secret_here\"\n      }\n    }\n  }\n}\n```\n\n**\u6ce8\u610f**: \n- **\u63a8\u8350\u4f7f\u7528\u65b9\u5f0f1**\uff1a`uvx` \u4f1a\u81ea\u52a8\u4ece PyPI \u4e0b\u8f7d\u548c\u8fd0\u884c\u6700\u65b0\u7248\u672c\uff0c\u65e0\u9700\u672c\u5730\u5b89\u88c5\n- **OAuth Token \u65b9\u5f0f**\uff1a\u907f\u514d\u6bcf\u6b21\u90fd\u9700\u8981\u767b\u5f55\uff0c\u66f4\u5b89\u5168\u4fbf\u6377\n- **\u9996\u6b21\u4f7f\u7528**\uff1a\u5982\u679c\u6ca1\u6709 OAuth Token\uff0c\u8bf7\u5148\u4f7f\u7528\u65b9\u5f0f2\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u751f\u6210\u5e76\u663e\u793a OAuth Token\uff0c\u7136\u540e\u5207\u6362\u5230\u65b9\u5f0f1\n- **\u672c\u5730\u5f00\u53d1**\uff1a\u5982\u679c\u4f60\u9700\u8981\u4fee\u6539\u4ee3\u7801\u6216\u8c03\u8bd5\uff0c\u53ef\u4ee5\u4f7f\u7528\u65b9\u5f0f3\n- \u8bf7\u5c06\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u5360\u4f4d\u7b26\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u996d\u5426 API \u51ed\u636e\n\n## \u53ef\u7528\u5de5\u5177\n\n\u672c\u670d\u52a1\u5668\u63d0\u4f9b\u4ee5\u4e0b\u5de5\u5177\uff1a\n\n### \u8ba4\u8bc1\u76f8\u5173\n- `generate_oauth_token` - \u751f\u6210 OAuth Token\n\n### \u65f6\u95f4\u7ebf\u76f8\u5173\n- `get_home_timeline` - \u83b7\u53d6\u9996\u9875\u65f6\u95f4\u7ebf\n- `get_user_timeline` - \u83b7\u53d6\u7528\u6237\u65f6\u95f4\u7ebf\n- `get_public_timeline` - \u83b7\u53d6\u516c\u5f00\u65f6\u95f4\u7ebf\n\n### \u7528\u6237\u548c\u5185\u5bb9\u76f8\u5173\n- `get_user_info` - \u83b7\u53d6\u7528\u6237\u4fe1\u606f\n- `get_status_info` - \u83b7\u53d6\u996d\u5426\u5185\u5bb9\u8be6\u60c5\n\n### \u4e92\u52a8\u76f8\u5173\n- `manage_favorite` - \u7ba1\u7406\u6536\u85cf\u72b6\u6001\n- `manage_friendship` - \u7ba1\u7406\u5173\u6ce8\u72b6\u6001\n\n### \u53d1\u5e03\u76f8\u5173\n- `publish_status` - \u53d1\u5e03\u6587\u5b57\u5185\u5bb9\n- `publish_photo` - \u53d1\u5e03\u56fe\u7247\u5185\u5bb9\n- `delete_status` - \u5220\u9664\u5185\u5bb9\n\n\u8be6\u7ec6\u7684 API \u6587\u6863\u8bf7\u53c2\u8003\uff1a[API \u6587\u6863](docs/API.md)\n\n## \u5f00\u53d1\u548c\u53d1\u5e03\n\n### \u672c\u5730\u6d4b\u8bd5\u6784\u5efa\n\n```bash\n# \u6d4b\u8bd5\u5305\u6784\u5efa\npython scripts/test_build.py\n\n# \u624b\u52a8\u6784\u5efa\nuv build\n```\n\n### \u53d1\u5e03\u5230 PyPI\n\n\u672c\u9879\u76ee\u4f7f\u7528 GitHub Actions \u81ea\u52a8\u53d1\u5e03\u5230 PyPI\u3002\u8be6\u7ec6\u4fe1\u606f\u8bf7\u53c2\u8003\uff1a[\u53d1\u5e03\u6307\u5357](docs/PUBLISHING.md)\n\n## \u6587\u6863\n\n- [API \u6587\u6863](docs/API.md) - \u8be6\u7ec6\u7684\u5de5\u5177\u51fd\u6570\u8bf4\u660e\n- [\u53d1\u5e03\u6307\u5357](docs/PUBLISHING.md) - \u5982\u4f55\u53d1\u5e03\u5230 PyPI\n\n## \u8bb8\u53ef\u8bc1\n\n\u672c\u9879\u76ee\u91c7\u7528 MIT \u8bb8\u53ef\u8bc1\u3002\u8be6\u89c1 [LICENSE](LICENSE) \u6587\u4ef6\u3002",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 kingcos\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "\u996d\u5426 MCP \u670d\u52a1\u5668 - \u57fa\u4e8e FastMCP \u6784\u5efa\u7684\u996d\u5426\uff08Fanfou\uff09MCP \u670d\u52a1\u5668",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://github.com/kingcos/fanfou-mcp/blob/main/docs/API.md",
        "Homepage": "https://github.com/kingcos/fanfou-mcp",
        "Issues": "https://github.com/kingcos/fanfou-mcp/issues",
        "Repository": "https://github.com/kingcos/fanfou-mcp"
    },
    "split_keywords": [
        "fanfou",
        " mcp",
        " model-context-protocol",
        " social-media"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6aaaa9128d4627c31f7d146166f5cdc06fc7fbdc3b7a18951a513b2058c211cd",
                "md5": "8891941ba8f6c1847a7cff2c9dea3214",
                "sha256": "ca4646810ef7ff76e5fcc7595c02d707efb7e9d9b143e036fc4a81a0c7310cee"
            },
            "downloads": -1,
            "filename": "fanfou_mcp-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8891941ba8f6c1847a7cff2c9dea3214",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 16602,
            "upload_time": "2025-07-13T02:45:57",
            "upload_time_iso_8601": "2025-07-13T02:45:57.989250Z",
            "url": "https://files.pythonhosted.org/packages/6a/aa/a9128d4627c31f7d146166f5cdc06fc7fbdc3b7a18951a513b2058c211cd/fanfou_mcp-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "33f62f013090482ad3bcd8b9cf3b5d97461f6d490e66ecb60682fa6c99c91bf9",
                "md5": "e0326f69061f5c44b38d3eac1b039f38",
                "sha256": "2717eaa7c4a0ccab172da698cc3beca1701a2005b05ac1c609ff7b46c409f394"
            },
            "downloads": -1,
            "filename": "fanfou_mcp-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e0326f69061f5c44b38d3eac1b039f38",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 19648,
            "upload_time": "2025-07-13T02:45:59",
            "upload_time_iso_8601": "2025-07-13T02:45:59.522967Z",
            "url": "https://files.pythonhosted.org/packages/33/f6/2f013090482ad3bcd8b9cf3b5d97461f6d490e66ecb60682fa6c99c91bf9/fanfou_mcp-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-13 02:45:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kingcos",
    "github_project": "fanfou-mcp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fanfou-mcp"
}
        
Elapsed time: 0.42225s