# mcp-server-weread

> MCP Server

WeChat Read MCP Server. Handles Model Context Protocol for WeChat Reading app.

## Overview

- **Category:** Developer Tools
- **Language:** JavaScript
- **Stars:** 571
- **Forks:** 43
- **Owner:** freestylefly
- **GitHub:** https://github.com/freestylefly/mcp-server-weread
- **Created:** 2025-04-12T12:51:14+00:00
- **Updated:** 2025-07-07T05:29:14+00:00
- **Source:** https://model-context-protocol.com/servers/mcp-server-weread

## Setup

## Setup

This section details how to install and configure `mcp-server-weread` to work with WeChat Read and integrate with LLM clients like Claude Desktop.

### Prerequisites

*   **Node.js:** Version 16.x or higher is required. You can download it from [nodejs.org](https://nodejs.org/).
*   **WeChat Read Account:** You need an active WeChat Read account.
*   **Valid WeChat Read Cookie:**  A valid cookie is necessary to authenticate with WeChat Read. See "Cookie Acquisition" for instructions.

### Installation

There are two primary methods for installing and using `mcp-server-weread`: using `npx` (recommended for simplicity) or installing it globally.

#### Method 1: Using `npx` (Recommended)

This method avoids global installation and is generally easier to manage.

1.  **Open Claude Desktop:** Launch your Claude Desktop application.
2.  **Navigate to MCP Configuration:** Go to the settings or configuration section within Claude Desktop and find the MCP configuration area.
3.  **Add a New Tool:** Add a new tool with the following JSON configuration:

    ```json
    {
      "mcpServers": {
        "mcp-server-weread": {
          "command": "npx",
          "args": ["-y", "mcp-server-weread"],
          "env": {
            // Option 1: Using CookieCloud (Recommended)
            "CC_URL": "https://cc.chenge.ink",  // CookieCloud URL (or your self-hosted URL)
            "CC_ID": "your_cookiecloud_id",    // Your CookieCloud ID
            "CC_PASSWORD": "your_cookiecloud_password" // Your CookieCloud Password
    
            // Option 2: Directly provide the WeChat Read Cookie (Alternative)
            // "WEREAD_COOKIE": "your_weread_cookie"
          }
        }
      }
    }
    ```

    *   **CookieCloud (Recommended):**  Using CookieCloud is the preferred method for managing your WeChat Read cookie, as it automatically updates the cookie when it expires.  See the "CookieCloud Configuration" section for setup instructions.  Replace `"your_cookiecloud_id"` and `"your_cookiecloud_password"` with your actual CookieCloud credentials.
    *   **Direct Cookie (Alternative):** If you choose not to use CookieCloud, you can directly provide your WeChat Read cookie.  Replace `"your_weread_cookie"` with the actual cookie value.

#### Method 2: Global Installation

1.  **Install Globally:** Open your terminal and run the following command:

    ```bash
    npm install -g mcp-server-weread
    ```

2.  **Configure in Claude Desktop:**  In Claude Desktop's MCP configuration, add a new tool with the following JSON:

    ```json
    {
      "mcpServers": {
        "mcp-server-weread": {
          "command": "mcp-server-weread",
          "env": {
            // Option 1: Using CookieCloud (Recommended)
            "CC_URL": "https://cc.chenge.ink",  // CookieCloud URL (or your self-hosted URL)
            "CC_ID": "your_cookiecloud_id",    // Your CookieCloud ID
            "CC_PASSWORD": "your_cookiecloud_password" // Your CookieCloud Password
    
            // Option 2: Directly provide the WeChat Read Cookie (Alternative)
            // "WEREAD_COOKIE": "your_weread_cookie"
          }
        }
      }
    }
    ```

    *   As with the `npx` method, configure either CookieCloud or provide the WeChat Read cookie directly.

### CookieCloud Configuration

CookieCloud helps manage WeChat Read cookies automatically.

1.  **Install Browser Extension:**
    *   **Edge:** [CookieCloud for Edge](https://microsoftedge.microsoft.com/addons/detail/cookiecloud/bffenpfpjikaeocaihdonmgnjjdpjkeo)
    *   **Chrome:** [CookieCloud for Chrome](https://chromewebstore.google.com/detail/cookiecloud/ffjiejobkoibkjlhjnlgmcnnigeelbdl)
2.  **Configure the Extension:**
    *   **Server Address:** Use the default server `https://cc.chenge.ink` or your self-hosted server address.
    *   **Generate Password:** Click "自动生成密码" (automatically generate password).
    *   **Synchronization Domain Keyword:** Enter `weread`.
    *   **Save and Synchronize:** Click "保存" (save), then "手动同步" (manually synchronize) to ensure the configuration takes effect.
    *   **Optional: Auto-Keep Alive:**  Enter `https://weread.qq.com` in the "保活" (keep alive) field to automatically refresh the cookie.
3.  **Configure Environment Variables:** In the MCP JSON configuration (as shown in the Installation section), set the following environment variables:

    *   `CC_URL`: Your CookieCloud server address (e.g., `https://cc.chenge.ink`).
    *   `CC_ID`: Your CookieCloud user UUID.
    *   `CC_PASSWORD`: Your CookieCloud password.

    **Note:** If CookieCloud is configured, the system will prioritize using it to obtain the cookie. If CookieCloud fails, it will fall back to the `WEREAD_COOKIE` environment variable.

### Cookie Acquisition

If you choose not to use CookieCloud, you need to manually obtain the WeChat Read cookie.

1.  **Log in to WeChat Read Web:** Use Chrome or another browser to log in to the [WeChat Read web version](https://weread.qq.com/).
2.  **Open Developer Tools:** Press F12 to open the browser's developer tools.
3.  **Navigate to Network Tab:** Switch to the "Network" tab.
4.  **Refresh the Page:** Refresh the page.
5.  **Find WeChat Read Request:** In the request list, find a request to `weread.qq.com`.
6.  **Copy Cookie:** In the "Headers" section of the request, find the "Cookie" field and copy its entire content.
7.  **Set `WEREAD_COOKIE`:** Add the copied cookie content to the `WEREAD_COOKIE` environment variable in your MCP JSON configuration (as shown in the Installation section).

### Environment Variables

The following environment variables are used by `mcp-server-weread`:

*   `WEREAD_COOKIE`: (Optional, if not using CookieCloud) Your WeChat Read cookie.
*   `CC_URL`: (Optional, if using CookieCloud) The URL of your CookieCloud server. Defaults to `https://cc.chenge.ink`.
*   `CC_ID`: (Optional, if using CookieCloud) Your CookieCloud user ID.
*   `CC_PASSWORD`: (Optional, if using CookieCloud) Your CookieCloud password.

**Important Notes:**

*   **Security:**  Treat your WeChat Read cookie and CookieCloud credentials as sensitive information.  Avoid committing them to public repositories.
*   **Cookie Expiration:** WeChat Read cookies expire periodically.  Using CookieCloud is highly recommended to automate cookie renewal.
*   **Troubleshooting:** If you encounter issues, double-check that your Node.js version meets the requirements, that your cookie is valid, and that your CookieCloud configuration is correct.

## Tools

## Available Tools

This tool provides the following functionalities to interact with your WeChat Read library:

- **Get Bookshelf Information:**
  - Tool: `get_bookshelf`
  - Description: Retrieves a list of all books on your WeChat Read bookshelf.
  - Output: Returns basic information for each book, including title, author, translator, and category.
  - Example Usage: An LLM can use this to provide a summary of your library or to allow you to select a book for further analysis.

- **Search Books:**
  - Tool: `search_books`
  - Description: Searches your WeChat Read bookshelf for books matching a given keyword.
  - Features:
    - Supports both fuzzy and exact matching.
    - Can include detailed book information in the results.
    - Allows setting a maximum number of results.
  - Example Usage:
    ```
    User: "Find books about psychology."
    LLM: "[LLM calls search_books tool with keyword='psychology']"
    LLM: "I found 3 books related to psychology: Thinking, Fast and Slow; The Crowd; Psychology and Life."
    ```

- **Get Book Notes and Highlights:**
  - Tool: `get_book_notes_and_highlights`
  - Description: Retrieves all highlights and notes for a specified book.
  - Features:
    - Organizes results by chapter.
    - Supports filtering by highlight style.
    - Returns structured data suitable for LLM processing.
  - Example Usage:
    ```
    User: "Summarize my notes from 'Thinking, Fast and Slow'."
    LLM: "[LLM calls get_book_notes_and_highlights tool for 'Thinking, Fast and Slow']"
    LLM: "Here are your notes and highlights from 'Thinking, Fast and Slow', organized by chapter:"
    LLM: "Chapter 1: System 1 and System 2 - Highlight: 'System 1 operates automatically and quickly, with little or no effort and no sense of voluntary control.' - Note: 'System 1 is responsible for intuition and quick judgments, while System 2 is responsible for slow, rational thinking.'"
    ```

- **Get Book Best Reviews:**
  - Tool: `get_book_best_reviews`
  - Description: Retrieves popular reviews for a specified book.
  - Features:
    - Supports setting the number of reviews to return.
    - Supports paginated browsing.
    - Includes rating, number of likes, and reviewer information.
  - Example Usage:
    ```
    User: "What are some popular reviews for 'Principles'?"
    LLM: "[LLM calls get_book_best_reviews tool for 'Principles']"
    LLM: "Here are some popular reviews for 'Principles': Reviewer 'Thinker' (5 stars): 'A book about how to think. Dalio summarizes his years of experience into actionable principles to help us make better decisions...' (182 likes, 23 comments)"
    ```
