FishClaw MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/TnoobT/FishClaw_MCP.git
cd FishClaw_MCP
pip install -e .
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "AGENT_LLM_API_KEY=${AGENT_LLM_API_KEY}" fishclaw-mcp -- python "<FULL_PATH_TO_FISHCLAW_MCP>/dist/index.js"

Replace <FULL_PATH_TO_FISHCLAW_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:AGENT_LLM_API_KEY+ 3 optional
README.md

Automate Xianyu marketplace operations using natural language.

FishClaw MCP

通用 MCP 服务器,将闲鱼自动化工具封装为 MCP 协议。 纯 Python 实现,不依赖任何 Agent 框架,可供 Claude Desktop、Cursor 等 MCP 客户端直接调用。 用自然语言完成商品发布、在售管理、市场调研,无需编写任何代码。


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


免责声明

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

点击展开完整免责声明

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

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


工具列表

工具 说明 注意
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

Tools (11)

loginChecks login status or prompts for QR code scan.
search_marketSearches Xianyu for items and collects titles, prices, and links.
draft_itemFills out a product draft including images, description, category, and price.
publish_itemPublishes the drafted item to the marketplace.
get_selling_itemsRetrieves a list of all currently listed items.
manage_itemDeletes or takes down a specific item.
get_page_contentReads visible text from the current browser page.
simulate_farmingSimulates human-like browsing behavior for account maintenance.
generate_imageGenerates a product cover image using DashScope.
generate_image_promptGenerates tech-themed English image prompts.
generate_product_descriptionGenerates product descriptions for Xianyu.

Environment Variables

AGENT_LLM_API_KEYrequiredDashScope API Key for LLM inference and content generation
IMAGE_API_KEYDashScope API Key for image generation
PLAYWRIGHT_HEADLESSWhether to run browser in headless mode
ENABLE_FARMINGEnable account farming simulation

Configuration

claude_desktop_config.json
{"mcpServers": {"fishclaw": {"command": "python", "args": ["/path/to/FishClaw_MCP/server.py"], "env": {"AGENT_LLM_API_KEY": "your-dashscope-api-key"}}}}

Try it

Help me publish a Python crawler service for 99 yuan.
Show me all the items I currently have listed for sale.
Search for 'Python tutorial' on Xianyu and summarize the pricing of the top results.
Take down my second listed item.

Frequently Asked Questions

What are the key features of FishClaw MCP?

Automates Xianyu marketplace operations via Playwright. Generates AI-powered product descriptions and cover images. Supports natural language commands for listing and management. Includes account farming simulation for activity maintenance.

What can I use FishClaw MCP for?

Automating the listing of multiple second-hand items. Conducting market research on competitor pricing for specific keywords. Managing inventory and removing sold or unwanted listings. Generating professional-looking product images and descriptions automatically.

How do I install FishClaw MCP?

Install FishClaw MCP by running: git clone https://github.com/TnoobT/FishClaw_MCP.git && cd FishClaw_MCP && pip install -e .

What MCP clients work with FishClaw MCP?

FishClaw MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep FishClaw MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare