Skip to main content
Glama
muhenan

Xiaohongshu MCP Server

by muhenan

xiaohongshu_check_status

Check Xiaohongshu account login status using headless browser automation to verify authentication and access permissions.

Instructions

检查小红书登录状态

Args: headless: 是否使用无头模式,默认True(状态检查可使用无头模式) chrome_path: Chrome浏览器可执行文件路径,可选

Returns: 登录状态信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chrome_pathNo
headlessNo

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the xiaohongshu_check_status tool. It launches a browser, creates a XiaohongshuLogin instance, and checks the login status.
    @mcp.tool()
    async def xiaohongshu_check_status(
        headless: bool = True,
        chrome_path: Optional[str] = None
    ) -> str:
        """
        检查小红书登录状态
    
        Args:
            headless: 是否使用无头模式,默认True(状态检查可使用无头模式)
            chrome_path: Chrome浏览器可执行文件路径,可选
    
        Returns:
            登录状态信息
        """
        try:
            logger.info("检查小红书登录状态...")
    
            # 创建浏览器管理器
            browser_manager = BrowserManager(
                headless=headless,
                chrome_path=chrome_path
            )
    
            async with browser_manager.get_page() as page:
                # 创建登录处理器
                login_handler = XiaohongshuLogin(page)
    
                # 检查登录状态
                is_logged_in = await login_handler.check_login_status()
    
                if is_logged_in:
                    logger.success("✅ 已登录")
                    return "✅ 小红书已登录"
                else:
                    logger.info("❌ 未登录")
                    return "❌ 小红书未登录,请先执行登录操作"
    
        except Exception as e:
            error_msg = f"检查登录状态时发生错误: {e}"
            logger.error(error_msg)
            return f"❌ {error_msg}"
  • The @mcp.tool() decorator registers the xiaohongshu_check_status function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameters (headless: bool, chrome_path: Optional[str]) and return str, with docstring describing the tool.
    async def xiaohongshu_check_status(
        headless: bool = True,
        chrome_path: Optional[str] = None
    ) -> str:
        """
        检查小红书登录状态
    
        Args:
            headless: 是否使用无头模式,默认True(状态检查可使用无头模式)
            chrome_path: Chrome浏览器可执行文件路径,可选
    
        Returns:
            登录状态信息
        """

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/muhenan/xiaohongshu-mcp-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server