A Model Context Protocol server for accessing Lark documents
Project description
MCP Server My Lark Doc
A Model Context Protocol server for searching and accessing Lark(Feishu) documents.
Features
Document Content Access
- Supports both Lark Doc and Wiki document types
- Automatically handles document type detection and ID extraction
- Returns raw content in text format for LLM processing
Authentication
- Supports both tenant access token and user access token
- Provides API to set user access token dynamically
- Automatically handles token refresh and management
Error Handling
- Comprehensive error reporting for authentication issues
- Clear feedback for invalid document URLs
- Detailed error messages for troubleshooting
Installation
uvx mcp-server-my-lark-doc
Configuration
Get your Lark App ID and App Secret
Visit the Lark Open Platform: https://open.larkoffice.com/app
Make Sure your Lark App has Permissions below
wiki:wiki:readonly
wiki:node:read
docx:document:readonly
search:docs:read
Environment Variables
Before using this MCP server, you need to set up your Lark application credentials:
- Create a Lark application in Lark Open Platform
- Get your App ID and App Secret
- Configure environment variables:
export LARK_APP_ID="your_app_id"
export LARK_APP_SECRET="your_app_secret"
Usage
Configure in Claude desktop:
"mcpServers": {
"lark_doc": {
"command": "uvx",
"args": ["mcp-server-my-lark-doc"],
"env": {
"LARK_APP_ID": "your app id",
"LARK_APP_SECRET": "your app secret"
}
}
}
Available Tools
-
set_user_access_token
- Purpose: Set user access token for accessing private documents
- Args: token (string) - The user access token, according to lark setting, the user_access_token will expire in two hours.
- Returns: Confirmation message
-
get_lark_doc_content
- Purpose: Retrieve document content from Lark
- Args: documentUrl (string) - The URL of the Lark document
- Returns: Document content in text format
- Supports:
- Doc URLs: https://xxx.feishu.cn/docx/xxxxx
- Wiki URLs: https://xxx.feishu.cn/wiki/xxxxx
-
search_wiki
- Purpose: Search documents in Lark Wiki
- Args:
- query (string) - Search keywords
- page_size (int, optional) - Number of results to return (default: 10)
- Returns: JSON string containing search results with following fields:
- title: Document title
- url: Document URL
- create_time: Document creation time
- update_time: Document last update time
Error Messages
Common error messages and their solutions:
- "Lark client not properly initialized": Check your LARK_APP_ID and LARK_APP_SECRET
- "Invalid Lark document URL format": Verify the document URL format
- "Failed to get document content": Check document permissions and token validity
- "Failed to get app access token": Check your application credentials and network connection
- "Failed to get wiki document real ID": Check if the wiki document exists and you have proper permissions
- "Document content is empty": The document might be empty or you might not have access to its content
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_my_lark_doc-0.1.1.tar.gz.
File metadata
- Download URL: mcp_server_my_lark_doc-0.1.1.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60171ba4195d3d6139ff248b6679370682b07c7299a89cd8fde909d92c271ecf
|
|
| MD5 |
0c65e2a0c6b6895fbe8350110db60262
|
|
| BLAKE2b-256 |
da2f6df244bedaed5527e48defdf90045242d43dbcc46d13516706e4709f38f8
|
File details
Details for the file mcp_server_my_lark_doc-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_server_my_lark_doc-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e16ad1c9b88d9b8e4a4f5541b8e7576193a93d6217116874ff525aca8731a6f
|
|
| MD5 |
019a47134e0e0e8d93f8e94c72d17a64
|
|
| BLAKE2b-256 |
6b1ff476a2e10586be8fccf2ceb39c953a8fd750645975d5e468378a2f44a570
|