LA

Lark Feishu MCP Server for Sheets, Docs, Messages

Integrate Lark (Feishu) Sheets, Docs, and Messages with an MCP server to enable model-context workflows and seamless AI-driven content management.

Quick Install
npx -y @kone-net/mcp_server_lark

Overview

This MCP (Model Context Protocol) server connects Lark (Feishu) applications — Sheets, Docs, and Messages — to model-driven workflows. It implements a set of HTTP endpoints that expose Lark resources as “tools” for a model context system, enabling language models to request, retrieve, and modify content inside Lark workspaces in a structured, auditable way.

By running this server alongside a model orchestration layer (or exposing it to a model runtime that supports MCP), you can build AI agents that read spreadsheet ranges, summarize or edit documents, and post messages into chats or groups — all with proper authentication and permission handling. The server abstracts the Feishu/Lark APIs and maps them to MCP-style tool endpoints so models and orchestration layers have a consistent interface for context operations.

Features

  • Exposes Lark Sheets, Docs, and Messaging as MCP-compatible tools
  • OAuth/tenant token management to authenticate against Lark/Feishu API
  • Endpoints to read/write Sheets ranges, fetch and edit Docs, and send messages
  • Webhook or callback support for events (optional)
  • Docker-ready and configurable with environment variables
  • Simple manifest describing available tools for model integrations

Installation / Configuration

Prerequisites:

  • Node.js (>= 16) or Docker
  • A Lark/Feishu app with app_id and app_secret (for tenant access tokens)

Clone and install:

git clone https://github.com/kone-net/mcp_server_lark.git
cd mcp_server_lark

# If the project uses npm
npm install

# Or if using yarn
yarn install

Create a .env with your credentials (example):

PORT=3000
LARK_APP_ID=cli_a1b2c3d4e5f6g7
LARK_APP_SECRET=your_app_secret_here
LARK_VERIFICATION_TOKEN=optional_verification_token
LARK_ENCRYPT_KEY=optional_encrypt_key
MCP_BASE_URL=https://your-server.example.com

Start the server:

npm start
# or for development
npm run dev

Run with Docker:

# Build
docker build -t mcp_server_lark .

# Run
docker run -e LARK_APP_ID=... -e LARK_APP_SECRET=... -p 3000:3000 mcp_server_lark

Configuration notes:

  • Provide the Lark app_id and app_secret so the server can obtain tenant_access_tokens.
  • If using event-driven features, configure LARK_VERIFICATION_TOKEN and LARK_ENCRYPT_KEY per Feishu webhook docs.
  • Set MCP_BASE_URL to the externally reachable URL so manifest links are correct.

Available Resources

This server exposes a manifest and a set of tool endpoints that map to Lark features. Typical endpoints include:

  • GET /mcp/manifest — MCP manifest describing tools and capabilities
  • POST /tools/sheets/read — Read a range from a Sheet
  • POST /tools/sheets/write — Write values to a Sheet range
  • POST /tools/docs/get — Fetch document content or structured blocks
  • POST /tools/docs/update — Apply edits to a Doc
  • POST /tools/messages/send — Send a message to a chat or user
  • POST /webhooks/events — (Optional) receive Lark event callbacks

Example tool table:

ToolPurposeTypical Inputs
sheetsRead/write spreadsheet rangessheet_id, range, values
docsFetch/update document contentdoc_id, query, delta edits
messagesSend chat messages or cardschat_id, open_id, content

All tool endpoints authenticate requests coming from your orchestration layer; the server handles exchanging your app credentials for tenant tokens when calling Lark APIs.

Use Cases

  1. Auto-summarize weekly report (Sheets → Doc → Message)
  • A model reads a “Weekly metrics” sheet range via POST /tools/sheets/read.
  • The model synthesizes a summary and writes a summary doc via POST /tools/docs/update.
  • A concise summary card is posted to a team chat via POST /tools/messages/send.
  1. Collaborative document drafting
  • An assistant fetches the current doc blocks with POST /tools/docs/get, proposes edits, and submits structured updates with POST /tools/docs/update. Edits are auditable because they go through the MCP tool interface.
  1. Data-driven notifications
  • A scheduler queries Sheets periodically (POST /tools/sheets/read). If thresholds are exceeded, the server (or model workflow) composes an explanation and sends it to a group as a message or card (POST /tools/messages/send), including links back to the source doc or sheet.

Example Requests

Fetch an MCP manifest:

curl https://your-server.example.com/mcp/manifest

Read a sheet range (example):

curl -X POST https://your-server.example.com/tools/sheets/read \
  -H "Content-Type: application/json" \
  -d '{
    "sheet_id": "sheet-123",
    "range": "A1:D20"
  }'

Send a message (example):

curl -X POST https://your-server.example.com/tools/messages/send \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": "oc_xxx",
    "content": {
      "type": "text",
      "text": "Automated summary: Q1 revenue increased 12%."
    }
  }'

Next Steps

  • Register the server manifest with your model orchestration layer so tools are discoverable.
  • Secure the server endpoint (TLS, IP allowlists) before exposing it to public model runtimes.
  • Extend or customize tool mappings to support additional Lark APIs (calendar, contacts, etc.).

Repository and source code: https://github.com/kone