Lark Mcp
Automate and integrate Lark MCP collaboration tools into your workflows
Lark Mcp is a community skill for building MCP servers that integrate with Lark (Feishu) workspace APIs, covering message sending, document access, calendar operations, and bot interactions through the Model Context Protocol.
What Is This?
Overview
Lark Mcp provides patterns for creating MCP-compliant servers that expose Lark workspace functionality to AI assistants. It covers tool definitions for sending messages to Lark chats and groups, document retrieval and creation through the Lark Docs API, calendar event management for scheduling and queries, contact lookup for finding team members, and bot webhook integration for automated notifications. The skill enables developers to build AI assistants that interact with Lark workspaces through standardized MCP tool interfaces.
Who Should Use This
This skill serves developers building AI assistants for teams that use Lark as their primary workspace platform, engineers creating automation bots that bridge AI capabilities with Lark messaging and documents, and teams deploying MCP servers that need Lark integration.
Why Use It?
Problems It Solves
AI assistants cannot access Lark workspace data without explicit API integration. Building custom Lark bots from scratch requires understanding complex authentication flows and API conventions. Automating tasks across Lark documents, messages, and calendar requires separate integrations for each service. Without MCP standardization, each AI client needs its own Lark connector implementation.
Core Highlights
Message tools send text and rich content to Lark chats through MCP calls. Document tools read, create, and search Lark Docs for content management. Calendar tools query schedules and create events for meeting coordination. Authentication handling manages Lark API tokens with automatic refresh.
How to Use It?
Basic Usage
from dataclasses import dataclass, field
import httpx
@dataclass
class LarkConfig:
app_id: str
app_secret: str
base_url: str = "https://open.larksuite.com/open-apis"
token: str = ""
class LarkClient:
def __init__(self, config: LarkConfig):
self.config = config
self.http = httpx.Client(timeout=30)
def get_token(self) -> str:
url = (f"{self.config.base_url}"
f"/auth/v3/tenant_access_token/internal")
resp = self.http.post(url, json={
"app_id": self.config.app_id,
"app_secret": self.config.app_secret})
data = resp.json()
self.config.token = data.get(
"tenant_access_token", "")
return self.config.token
def send_message(self, chat_id: str,
text: str) -> dict:
if not self.config.token:
self.get_token()
url = (f"{self.config.base_url}"
f"/im/v1/messages")
headers = {"Authorization":
f"Bearer {self.config.token}"}
payload = {"receive_id": chat_id,
"msg_type": "text",
"content": f'{{"text":"{text}"}}'}
resp = self.http.post(
url, headers=headers, json=payload,
params={"receive_id_type": "chat_id"})
return resp.json()Real-World Examples
from dataclasses import dataclass, field
class LarkDocClient:
def __init__(self, client: LarkClient):
self.client = client
def get_document(self, doc_token: str) -> dict:
url = (f"{self.client.config.base_url}"
f"/docx/v1/documents/{doc_token}")
headers = {"Authorization":
f"Bearer {self.client.config.token}"}
resp = self.client.http.get(
url, headers=headers)
return resp.json()
def search_docs(self, query: str,
count: int = 10) -> list[dict]:
url = (f"{self.client.config.base_url}"
f"/suite/docs-api/search/object")
headers = {"Authorization":
f"Bearer {self.client.config.token}"}
resp = self.client.http.post(
url, headers=headers,
json={"search_key": query,
"count": count,
"docs_token_list": []})
data = resp.json()
return data.get("data", {}).get(
"docs_entities", [])
def list_tools(self) -> list[dict]:
return [
{"name": "send_message",
"description": "Send text to a Lark chat"},
{"name": "get_document",
"description": "Retrieve a Lark document"},
{"name": "search_docs",
"description": "Search Lark documents"}]Advanced Tips
Cache tenant access tokens and refresh them before expiry to avoid authentication failures during tool execution. Implement rate limiting on message sending tools to stay within Lark API quotas. Use webhook URLs for event subscriptions that trigger MCP tool calls when new messages arrive.
When to Use It?
Use Cases
Build an AI assistant that searches Lark Docs and summarizes relevant documents for team members. Create a meeting scheduler that checks calendar availability and sends invitations through Lark. Deploy a notification bot that sends automated alerts to Lark groups based on external triggers.
Related Topics
Model Context Protocol servers, Lark Open API, workplace automation, chatbot development, and enterprise messaging integration.
Important Notes
Requirements
A Lark developer account with an application configured for API access. App ID and App Secret for tenant-level authentication. MCP SDK for implementing the server-side tool definitions.
Usage Recommendations
Do: store API credentials securely and never expose them in tool responses. Handle token refresh automatically to maintain uninterrupted API access. Validate chat IDs and document tokens before making API calls to provide clear error messages.
Don't: send messages to chats without verifying the bot has been added to the group. Expose raw API error responses to AI clients without parsing them into readable messages. Ignore Lark API rate limits that can cause temporary blocks on the application.
Limitations
Lark API permissions must be configured per capability, requiring separate scopes for messaging, documents, and calendar. Bot permissions in group chats depend on admin settings that vary across organizations. API rate limits constrain throughput for high-frequency tool calls.
More Skills You Might Like
Explore similar skills to enhance your workflow
Benchling Integration
Benchling Integration automation and integration for streamlined scientific data workflows
Altoviz Automation
Automate Altoviz operations through Composio's Altoviz toolkit via Rube
Gget
Gget automation and integration for fast genomic data retrieval and analysis
Chmeetings Automation
Automate Chmeetings operations through Composio's Chmeetings toolkit
Eraser Diagrams
Automate and integrate Eraser Diagrams to create and manage visual diagrams with ease
Kommo Automation
1. Add the Composio MCP server to your client configuration: