xhs-mcp logo

xhs-mcp

Community
SoftEgLi

一个小红书的 MCP 服务器,支持通过对话的方式进行账号登陆、文案生成、以及自动发布。相比于已有的实现,优势在于登陆账号以及文案发布全部可以在对话过程中自动实现,并能支持多个账号批量发布文案。此外,在调用发表文章的接口时,该工具还支持自动根据文案内容生成小红书配图。

PublisherSoftEgLi
Repositoryxhs-mcp
LanguagePython
Forks
2
Stars
12
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    xhs-mcp exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    12 stars and 2 forks from the linked repository.

xhs-mcp

一个小红书的 MCP 服务器,支持通过对话的方式进行账号登陆、文案生成、以及自动发布。相比于已有的实现,优势在于登陆账号以及文案发布全部可以在对话过程中自动实现,并能支持多个账号批量发布文案。此外,在调用发表文章的接口时,该工具还支持自动根据文案内容生成小红书配图。

原理

使用浏览器模拟的方式,通过 Chrome 驱动启动浏览器,来自动进行账号登录(会发送验证码到手机上),以及发布文案。登录后,会将 Cookie 保存下来,之后发布文章就不再需要重新登录了。项目已集成 webdriver-manager,无需手动下载和配置 Chrome 驱动,只需下载并安装 Chrome 浏览器本体即可(下载地址:https://www.google.com/intl/zh-CN/chrome/)。

示例

环境配置

  1. 确保系统已安装 Chrome 浏览器(项目会自动管理对应的驱动程序,不需要手动下载驱动程序,只要手动下载并安装浏览器本体即可),下载地址(https://www.google.com/intl/zh-CN/chrome/)
  2. 安装 uv
pip install uv # 注意,如果使用conda进行环境管理,需要在base环境中pip

启动服务器

在发布图文时,必须有一张配图才可以发布。所以在调用发布文案工具时会自动根据文案生成一张小红书风格的配图。在生成小配图时,用到了 DeepSeek 的 chat 模型,所以需要配置 DEEPSEEK_API_KEY 这个环境变量。如果需要切换到其它模型,请配置 BASE_URL 环境变量(默认为 DEEPSEEK 的地址),,并将"DEEPSEEK_API_KEY"设为对应的密钥即可。

方式 1: 配置文件运行

在配置文件中添加

{
  "mcpServers": {
    "xhs": {
      "command": "uvx",
      "args": [
        "--from",
        "lcl_xhs_mcp@latest",
        "xhs-server"
      ],
      "env": {
        "DEEPSEEK_API_KEY": "xxxx",
        "BASE_URL": "https://api.deepseek.com"
      }
    }
  }
}

方式 2:直接运行命令

env DEEPSEEK_API_KEY=xxxx uvx --from lcl_xhs_mcp@latest xhs-server

若切换模型:

env DEEPSEEK_API_KEY=xxxx BASE_URL=xxxx uvx --from lcl_xhs_mcp@latest xhs-server

方式 3: 源码安装并运行

这种方式能够获得最新的代码。

git clone https://github.com/SoftEgLi/xhs-mcp.git
cd xhs-mcp
pip install -e . # 注意,如果安装了anaconda,需要在base环境中进行pip

MCP 配置文件:

{
  "mcpServers": {
    "xhs-test": {
      "command": "xhs-server",
      "args": [],
      "env": {
        "DEEPSEEK_API_KEY": "xxxx",
        "BASE_URL": "https://api.deepseek.com"
      }
    }
  }
}

注意事项

Cookie 的有效期是一个月,如果你自己在网页上登录了小红书,那么之前的 Cookie 有可能会失效,失效后在发布文章时,会重新走一遍 MCP 的登录流程。

开源协议

使用 MIT 协议。

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "softegli-xhs-mcp": {
      "command": "uvx",
      "args": [
        "lcl_xhs_mcp"
      ]
    }
  }
}

Use xhs-mcp MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once xhs-mcp is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add xhs-mcp as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the xhs-mcp MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "softegli-xhs-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "lcl_xhs_mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the xhs-mcp MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the xhs-mcp MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use xhs-mcp to help me with this task?
xhs-mcp
Sure. I read it.
Here is what I found using xhs-mcp.

Frequently asked questions

What is the xhs-mcp MCP server used for?

xhs-mcp is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use xhs-mcp MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use xhs-mcp with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use xhs-mcp MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With xhs-mcp connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect xhs-mcp MCP to TypingMind?

xhs-mcp runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does xhs-mcp MCP provide in TypingMind?

xhs-mcp exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use xhs-mcp MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If xhs-mcp requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇