Feishu (Lark) MCP server

Integrates with Feishu (Lark) to enable document retrieval, messaging, and collaborative features directly within workplace conversations through a TypeScript implementation that runs as either a CLI or HTTP server.
Back to servers
Setup instructions
Provider
cso1z
Release date
Mar 17, 2025
Language
TypeScript
Package
Stats
6.1K downloads
136 stars

This MCP server allows AI-powered coding tools to access, edit, and process Feishu documents using the Model Context Protocol. It provides structured content access and document management capabilities for tools like Cursor, Windsurf, and Cline.

Installation

Quick Start Options

Option 1: Using NPM

Run the server directly using npx:

npx feishu-mcp@latest --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>

Option 2: Using Smithery Platform

The server is available on Smithery platform at https://smithery.ai/server/@cso1z/feishu-mcp

Option 3: Local Installation

  1. Clone the repository

    git clone https://github.com/cso1z/Feishu-MCP.git
    cd Feishu-MCP
    
  2. Install dependencies

    pnpm install
    
  3. Configure environment variables

    For macOS/Linux:

    cp .env.example .env
    

    For Windows:

    copy .env.example .env
    
  4. Edit the .env file

    FEISHU_APP_ID=cli_xxxxx
    FEISHU_APP_SECRET=xxxxx
    PORT=3333
    
  5. Run the server

    pnpm run dev
    

Configuration

Environment Variables

Variable Required Description Default
FEISHU_APP_ID Feishu App ID -
FEISHU_APP_SECRET Feishu App Secret -
PORT Server port 3333
FEISHU_AUTH_TYPE Auth type: user (local) or tenant (production) tenant
FEISHU_TOKEN_ENDPOINT Custom token endpoint http://localhost:3333/getToken

Command Line Arguments

--port                  # Server port (default: 3333)
--log-level             # Log level: debug/info/log/warn/error/none (default: info)
--feishu-app-id         # Feishu App ID
--feishu-app-secret     # Feishu App Secret
--feishu-base-url       # Feishu API base URL (default: https://open.feishu.cn/open-apis)
--cache-enabled         # Enable caching (default: true)
--cache-ttl             # Cache TTL in seconds (default: 3600)
--stdio                 # Run in command mode
--help                  # Show help menu
--version               # Show version

Configuration File (for Cursor, Cline, etc.)

{
  "mcpServers": {
    "feishu-mcp": {
      "command": "npx",
      "args": ["-y", "feishu-mcp", "--stdio"],
      "env": {
        "FEISHU_APP_ID": "<YOUR_FEISHU_APP_ID>",
        "FEISHU_APP_SECRET": "<YOUR_FEISHU_APP_SECRET>"
      }
    },
    "feishu_local": {
      "url": "http://localhost:3333/sse"
    }
  }
}

Features

Document Management

Feature Description
Create document Create a new Feishu document
Get document info Retrieve basic document information
Get document blocks Get the document block structure
Batch create blocks Create multiple blocks at once
Update block text Update block text content
Delete document blocks Remove blocks from a document

Folder Management

Feature Description
Get folder files List files in a folder
Create folder Create a new folder

Search & Utilities

Feature Description
Search documents Find documents by content
Convert Wiki link Convert Wiki link to document ID
Get image resource Download images from documents
Get whiteboard content Retrieve whiteboard elements and structure
Upload and bind images Insert local and remote images

Supported Text Formatting

  • Text styles: Bold, italic, underline, strikethrough, inline code
  • Text colors: Gray, brown, orange, yellow, green, blue, purple
  • Alignment: Left, center, right
  • Headings: Heading levels 1-9
  • Code blocks: With syntax highlighting for various languages
  • Lists: Ordered (numbered) and unordered (bullet points)
  • Images: Support for local and web images
  • Formulas: Insert math formulas using LaTeX syntax

Usage Tips

Folder Specification

When creating new documents, it's recommended to provide a Feishu folder token (either a specific folder or root folder). This helps better locate and manage documents. If unsure about specific subfolders, the LLM can automatically find the most appropriate subdirectory under your specified folder.

How to get a folder token: Open the Feishu folder page and copy the link (e.g., https://.../drive/folder/xxxxxxxxxxxxxxxxxxxxxx). The token is the last string of characters in the URL.

Image Upload Path

When running MCP locally, image paths can be either local absolute paths or http/https URLs. In a server environment, only network image links are supported.

Formula Usage

Mathematical formulas can be mixed with regular text in text blocks. Formulas use LaTeX syntax (e.g., 1+2=3, \frac{a}{b}, \sqrt{x}). Multiple formulas and regular text can be included in the same text block.

Troubleshooting

Permission Issues

Verify issues:

  1. Ensure the app has necessary document access permissions
  2. Confirm target documents are authorized for the app or its group
  3. Verify the app's published version scope includes the document owner

Permission verification:

  1. Get token: Use the self-built app_access_token
  2. Use the token from step 1 to verify access: Get document information

Common Problems

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "feishu-mcp" '{"command":"npx","args":["-y","feishu-mcp","--stdio"],"env":{"FEISHU_APP_ID":"<\u4f60\u7684\u98de\u4e66\u5e94\u7528ID>","FEISHU_APP_SECRET":"<\u4f60\u7684\u98de\u4e66\u5e94\u7528\u5bc6\u94a5>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "feishu-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "feishu-mcp",
                "--stdio"
            ],
            "env": {
                "FEISHU_APP_ID": "<\u4f60\u7684\u98de\u4e66\u5e94\u7528ID>",
                "FEISHU_APP_SECRET": "<\u4f60\u7684\u98de\u4e66\u5e94\u7528\u5bc6\u94a5>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "feishu-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "feishu-mcp",
                "--stdio"
            ],
            "env": {
                "FEISHU_APP_ID": "<\u4f60\u7684\u98de\u4e66\u5e94\u7528ID>",
                "FEISHU_APP_SECRET": "<\u4f60\u7684\u98de\u4e66\u5e94\u7528\u5bc6\u94a5>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later