Skip to main content
Glama
FishClaw MCP

FishClaw MCP

by TnoobT

FishClaw MCP


有兴趣可以看一下Agno智能体调用FishClaw工具链接


免责声明

警告:本项目仅供学习交流使用,请勿用于任何商业或非法用途,否则后果自负。

本项目仅供学习交流使用,请勿用于任何商业或非法用途。任何违反法律法规、侵犯他人合法权益的行为,均与本项目及其开发者无关,后果由用户自行承担。

下载、保存或使用本项目源代码,即表示您已阅读并同意本声明的全部内容。


Related MCP server: Xiaohongshu MCP Python

工具列表

工具

说明

注意

login

检查登录状态;未登录则弹出浏览器等待扫码

search_market

关键词搜索闲鱼商品,采集标题、价格、链接

draft_item

填写商品草稿(图片/描述/分类/价格)并截图

publish_item

点击发布按钮完成商品发布

⚠️ 不可撤销

get_selling_items

获取所有在售商品列表

manage_item

对指定商品执行下架或永久删除

⚠️ 不可撤销

get_page_content

读取当前浏览器页面可见文字

simulate_farming

模拟真人随机浏览养号

需 ENABLE_FARMING=true

generate_image

调用 DashScope 生成商品封面图

generate_image_prompt

根据技术主题生成科技感英文生图提示词

generate_product_description

根据技术主题生成闲鱼商品描述文案


快速开始

1. 克隆项目

git clone https://github.com/your-username/fishclaw-mcp.git
cd fishclaw-mcp

2. 安装依赖

# 推荐使用 uv
uv sync

# 或使用 pip
pip install -e .

3. 安装 Playwright 浏览器

playwright install chromium

4. 配置环境变量

cp .env.example .env

编辑 .env,至少填写 AGENT_LLM_API_KEY:

# 必填:用于 LLM 推理和文案生成
AGENT_LLM_API_KEY=your-dashscope-api-key

# 可选:用于生成商品封面图(不填则使用内置默认图片)
IMAGE_API_KEY=your-dashscope-api-key

5. 验证服务器可以启动

python server.py

看到 Starting MCP server 字样即表示启动成功,Ctrl+C 退出。


6. 上架示例

接入 MCP 客户端

Claude Desktop

找到配置文件(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json,Windows: %APPDATA%\Claude\claude_desktop_config.json),添加以下内容:

推荐方式:python 直接运行

{
  "mcpServers": {
    "fishclaw": {
      "command": "python",
      "args": ["D:/acode/py/study/FishClaw_MCP/server.py"],
      "env": {
        "AGENT_LLM_API_KEY": "your-dashscope-api-key"
      }
    }
  }
}

或使用 uv

{
  "mcpServers": {
    "fishclaw": {
      "command": "uv",
      "args": ["--directory", "/your/path/to/fishclaw-mcp", "run", "server.py"]
    }
  }
}

将路径替换为本项目的实际绝对路径。环境变量也可以在 .env 文件中配置。

Cursor

在 ~/.cursor/mcp.json(或项目级 .cursor/mcp.json)中添加同上的配置。


使用示例

接入后,在对话中直接用自然语言操作即可:

帮我发布一个 Python 爬虫技术服务,价格 99 元
→ 自动生成封面图 → 生成文案 → 填写表单 → 截图确认 → 发布

查看我现在在售的商品
→ 跳转个人中心,列出所有在售商品

把第二个商品下架
→ 进入商品详情,点击下架并确认

搜索 Python 教程,看看竞品定价
→ 采集前 20 条结果的标题和价格

项目结构

fishclaw-mcp/
├── server.py                   # MCP 服务器入口(使用 FastMCP)
├── pyproject.toml              # 项目依赖
├── .env.example                # 环境变量模板
├── assets/
│   └── default_agent.png       # 生图 API 不可用时的兜底图片
└── tools/
    ├── xianyu_tools.py         # 闲鱼 Playwright 自动化(纯 Python 类)
    ├── generate_image_tools.py # DashScope 图像生成(纯 Python 类)
    ├── prompt_tools.py         # LLM 提示词与文案生成(纯 Python 类)
    └── xconfig.py              # 日志配置

环境变量说明

变量

必填

默认值

说明

AGENT_LLM_API_KEY

是

—

阿里云 DashScope API Key

AGENT_LLM_MODEL

否

qwen-max

推理模型名称

AGENT_LLM_BASE_URL

否

DashScope 兼容地址

LLM 接口地址

AGENT_LLM_TEMPERATURE

否

0.5

推理温度

IMAGE_API_KEY

否

—

图像生成 API Key(不填用默认图片)

PLAYWRIGHT_HEADLESS

否

false

是否无头模式(建议保持 false 降低风控)

PROXY

否

—

代理地址,如 http://127.0.0.1:7890

COOKIES_PATH

否

.cache/cookies/xianyu_cookies.json

Cookie 持久化路径

XIANYU_HOME_URL

否

https://www.goofish.com

闲鱼首页地址

ENABLE_FARMING

否

false

设为 true 时注册 simulate_farming 工具


技术栈

层次

技术

MCP 协议

MCP Python SDK — FastMCP

浏览器自动化

Playwright + playwright-stealth

工具实现

纯 Python 类,不依赖任何 Agent 框架

LLM / 图像生成

阿里云 DashScope(qwen-max + z-image-turbo)

Available Tools

11 tools
draft_itemA
Read-only

在闲鱼发布页面填写商品草稿(图片、描述、分类、价格),填写完成后自动截图。 返回文本中包含截图路径,确认无误后调用 publish_item 正式发布。

Args: image: 商品图片,支持本地绝对路径或网络 URL(http/https)。 description: 商品描述文字。 price: 商品售价(元),默认 100.0。

Inputs: image (required), description (required), price. Returns: result

generate_imageA

根据文本提示词调用阿里云 DashScope 生成图像,图像缓存到本地后返回路径。 未配置 IMAGE_API_KEY 时自动回退到项目内置的默认图片。

Args: prompt: 图像生成的文本描述(支持中英文混合)。 size: 图像尺寸,格式为"宽高",如"11201440",默认"1024*1024"。

Inputs: prompt (required), size. Returns: result

generate_image_promptA
Read-only

根据技术主题生成适合图像生成模型的英文提示词(赛博朋克/科技感风格)。 生成结果可直接传入 generate_image 工具使用。

Args: topic: 技术主题,如"AIGC"、"Python爬虫"、"区块链"等。

Inputs: topic (required). Returns: result

generate_product_descriptionB
Read-only

根据技术主题生成闲鱼商品描述文案(自我介绍 + 服务分类 + 技术关键词三段式)。 生成结果可直接传入 draft_item 的 description 参数。

Args: topic: 技术主题或服务内容,如"AIGC绘画"、"Python爬虫"等。

Inputs: topic (required). Returns: result

get_page_contentA
Read-only

读取当前浏览器页面的可见文字内容(最多 3000 字符),供分析页面状态或提取信息。 可在导航到某个页面后调用,让 AI 感知当前浏览器状态。

Inputs: no named parameters. Returns: result

get_selling_itemsA
Read-only

获取当前账号所有在售商品列表(标题、价格、链接)。 内部自动跳转个人中心并滚动加载全部商品,无需手动导航。

Inputs: no named parameters. Returns: result

loginA

检查闲鱼登录状态。已登录则直接返回;未登录则打开浏览器展示二维码, 等待用户手动扫码,登录成功后自动保存 Cookies。

Args: timeout_seconds: 等待扫码的最大秒数,默认 180。

Inputs: timeout_seconds. Returns: result

manage_itemA
Destructive

对指定商品执行下架或删除操作,内部自动跳转商品详情页并处理确认弹窗。 ⚠️ delete 操作永久删除商品,不可恢复。 请先调用 get_selling_items 获取商品链接,再传入此工具。

Args: item_url: 商品详情页 URL(从 get_selling_items 结果中获取)。 action: delist=下架(转为草稿,可重新上架);delete=永久删除。

Inputs: item_url (required), action (required). Returns: result

publish_itemA
Destructive

点击发布按钮完成商品发布。 ⚠️ 不可撤销操作,请先调用 draft_item 填写草稿并确认截图后再调用。

Inputs: no named parameters. Returns: result

restart_browserA

重新初始化 Playwright 浏览器进程,无需重启 MCP 服务器。 当出现以下情况时调用:

  • 浏览器窗口已被手动关闭

  • 页面长时间无响应或报错

  • 提示"浏览器进程已关闭"等异常 重启后需重新调用 login 验证登录状态,再继续执行后续操作。

Inputs: no named parameters. Returns: result

search_marketA
Read-only

在闲鱼搜索指定关键词,采集结果列表(标题、价格、链接),用于竞品调研和定价参考。

Args: keyword: 搜索关键词,不能为空。 max_results: 最多返回结果数量,默认 20。

Inputs: keyword (required), max_results. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool targets a distinct action or resource: login, item drafting/publishing/managing, search, page reading, image generation, etc. There is no overlap that would confuse an agent.

    Naming Consistency5/5

    All tools follow a consistent verb_noun snake_case pattern (e.g., draft_item, generate_image, get_selling_items). Multi-word verbs like generate_image_prompt are uniform.

    Tool Count5/5

    With 11 tools, the server covers the core workflow of listing items on Xianyu (including image and description generation) without excess or missing critical steps.

    Completeness4/5

    The tool set covers the full listing lifecycle: login, draft, publish, manage, search, and list. Minor gaps exist (no update for published items, no order management), but agents can work around them.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI-powered browser automation, web scraping, and testing using Playwright across Chromium, Firefox, and WebKit. It allows users to perform actions like navigation, clicking, typing, and taking screenshots through natural language interfaces.
      24 npm
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      A Python implementation of an MCP server for Xiaohongshu that enables AI models to browse feeds, search content, and manage interactions like liking or commenting. It leverages Playwright for browser automation to support account management and content publishing features.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with Xiaohongshu to publish image notes, search content, and manage account details. It uses Playwright to securely handle session authentication and API signatures through the platform's internal network context.
      88 PyPI
      2
      MIT
    • A
      license
      B
      quality
      A
      maintenance
      MCP server for automating Xianyu (Goofish) marketplace operations: publish, manage items, handle IM messages, and more via CLI or AI agents.
      17
      787 PyPI
      473
      Apache 2.0