Skip to main content

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

  • OAuth-based user authentication
  • Automatic token refresh and expiration management
  • Customizable OAuth callback server

Error Handling

  • Comprehensive error reporting for authentication issues
  • Clear feedback for invalid document URLs
  • Detailed error messages for troubleshooting

Installation

uvx mcp-server-lark-docx

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:

  1. Create a Lark application in Lark Open Platform
  2. Get your App ID and App Secret
  3. Configure environment variables:
export LARK_APP_ID="your_app_id"
export LARK_APP_SECRET="your_app_secret"
export OAUTH_HOST="localhost"               # OAuth callback server host (default: localhost)
export OAUTH_PORT="9997"                   # OAuth callback server port (default: 9997)

Usage

Configure in Claude desktop:

"mcpServers": {
    "lark_doc": {
        "command": "uvx",
        "args": ["mcp-server-lark-docx"],
        "env": {
            "LARK_APP_ID": "your app id",
            "LARK_APP_SECRET": "your app secret",
            "OAUTH_HOST": "localhost",   // optional   
            "OAUTH_PORT": "9997"        // optional  
        }
    }
}

Available Tools

  1. get_lark_doc_content

  2. 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
  • "Authorization timeout": ser didn't complete authorization within 5 minutes

Development Notes

OAuth Callback Server

Default configuration:

  • Host: localhost

  • Port: 9997 Customize via environment variables:

  • OAUTH_HOST: Set callback server host

  • OAUTH_PORT: Set callback server port

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

mcp_server_lark_docx-0.0.4.tar.gz (66.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_lark_docx-0.0.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_lark_docx-0.0.4.tar.gz.

File metadata

  • Download URL: mcp_server_lark_docx-0.0.4.tar.gz
  • Upload date:
  • Size: 66.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for mcp_server_lark_docx-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4073e76f7f4fedf5c552f5d3412f07071ec92c8e5044b52061570a478fbaa522
MD5 36ae42b39bac05aabf875a01133299e7
BLAKE2b-256 11248a7cd54e9cef11cee70ee6f4955716ac01aeb0bc4e17cebf54c4da7eacb9

See more details on using hashes here.

File details

Details for the file mcp_server_lark_docx-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_lark_docx-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f76d705877c79f89f4569f3e25fdf300ea6551efd20835e97493a51d207194d8
MD5 b7c34445437d0d565e4a08f016c91af3
BLAKE2b-256 aa4fbf5611c798328d82cecc235b29a69b1cfae78b5bb931cb593934bbd80e03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page