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
9.1K downloads
238 stars

The Feishu MCP Server is a tool that provides AI-powered coding tools like Cursor, Windsurf, and Cline with capabilities to access, edit, and process Feishu documents. Based on the Model Context Protocol (MCP), it enables structured document processing with support for folders, content retrieval, document editing, and searching.

Installation

Using NPM (Recommended)

The quickest way to get started is using NPX:

npx feishu-mcp@latest --feishu-app-id=<YOUR_APP_ID> --feishu-app-secret=<YOUR_APP_SECRET> --feishu-auth-type=<tenant/user>

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 Copy .env.example to .env and edit with your Feishu credentials:

    FEISHU_APP_ID=cli_xxxxx
    FEISHU_APP_SECRET=xxxxx
    PORT=3333
    FEISHU_AUTH_TYPE=tenant/user
    
  4. Start the server

    pnpm run dev
    

Configuration

Environment Variables

Variable Required Description Default
FEISHU_APP_ID Feishu application ID -
FEISHU_APP_SECRET Feishu application secret -
PORT Server port 3333
FEISHU_AUTH_TYPE Authentication type: user or tenant tenant

Configuration for AI Tools

For tools like Cursor or Cline, add this to your configuration:

{
  "mcpServers": {
    "feishu-mcp": {
      "command": "npx",
      "args": ["-y", "feishu-mcp", "--stdio"],
      "env": {
        "FEISHU_APP_ID": "<YOUR_APP_ID>",
        "FEISHU_APP_SECRET": "<YOUR_APP_SECRET>",
        "FEISHU_AUTH_TYPE": "<tenant/user>"
      }
    },
    "feishu_local": {
      "url": "http://localhost:3333/sse?userKey=123456"
    }
  }
}

Feishu Application Setup

⚠️ Important: Before using this tool, you must configure a Feishu application.

You can find the official guide on creating a Feishu application at Feishu's official documentation.

Usage Tips

Specifying Folders

When creating new documents, it's recommended to provide a Feishu folder token (either a specific folder or root folder) for better document organization. If unsure about which subfolder to use, the LLM can automatically find the most suitable subfolder within your specified folder.

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

Image Upload Paths

When running MCP locally, both local absolute paths and http/https network image URLs are supported. In a server environment, only network image links are supported.

Formula Usage

Mathematical formulas can be used within text blocks using LaTeX syntax, such as 1+2=3, \frac{a}{b}, \sqrt{x}, etc. Multiple formulas can be included in a single text block alongside regular text.

Using Feishu User Authentication

When switching from tenant to user authentication, you need to configure appropriate permissions. To distinguish between different users, add a userKey query parameter to the MCP server URL. This value should be a unique user identifier, so make it as random as possible.

Troubleshooting

Permission Issues

  1. Check application permissions: Ensure your app has the necessary document access permissions
  2. Verify document authorization: Confirm the target document has been authorized for the application or its group
  3. Check availability scope: Ensure the application's published version scope includes the document owner

Permission Verification

  1. Get a token: Get app_access_token
  2. Use the token to verify access to the document: Get document info

Common Issues

  • Application not found: Check if the app is published and has the correct scope configuration
  • Insufficient permissions: Refer to Cloud Documents FAQ
  • Knowledge base access issues: Refer to Knowledge Base FAQ

Supported Features

The server supports a wide range of document management and editing features:

Document Management

  • Creating new documents
  • Getting document information
  • Retrieving document block structure
  • Batch creating multiple blocks
  • Updating block text
  • Deleting document blocks

Folder Management

  • Getting folder file listings
  • Creating new folders

Advanced Features

  • Table creation and editing
  • Flowchart insertion
  • Image insertion (local and remote)
  • Formula support

Text Styling

  • Bold, italic, underline, strikethrough, inline code
  • Text colors (gray, brown, orange, yellow, green, blue, purple)
  • Alignment (left, center, right)
  • Heading levels (1-9)
  • Code blocks with syntax highlighting
  • Ordered and unordered lists
  • Images (local and remote)
  • Math formulas with LaTeX syntax
  • Mermaid charts (flowcharts, sequence diagrams, mind maps, class diagrams, etc.)
  • Tables with multi-row lists and various content types

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