Skip to main content

LingTai Feishu/Lark MCP server — message API client with LICC inbox callback.

Project description

lingtai-feishu

LingTai Feishu/Lark MCP server — Open API client with multi-account support and LICC inbox callback.

This is the canonical setup, configuration, and troubleshooting doc for the lingtai-feishu MCP. It is fetched by LingTai agents (or anyone else) when they need to install or configure this server.

MCP / LICC contract spec: see the lingtai-anatomy skill, reference/mcp-protocol.md, for the canonical specification of the catalog → registry → activation chain, environment-variable injection, and the LICC v1 inbox callback protocol. The reference client implementation is src/lingtai_feishu/licc.py in this repo (vendored verbatim into all first-party LingTai MCP repos — copy it if you're writing your own).

Tools

One omnibus MCP tool: feishu(action=...). Actions: send, check, read, reply, search, contacts, add_contact, remove_contact, accounts. Compound message IDs: account_alias:chat_id:feishu_message_id.

Inbound messages (LICC)

Inbound Feishu events flow into the host agent's inbox via the LingTai Inbox Callback Contract. Each new message is delivered as a LICC event with:

  • from — contact's display name (or open_id if no contact saved).
  • subject"feishu message from <name> via <account_alias>".
  • body — a ~300 char preview of the message text.
  • metadata.message_id — compound ID for reply.
  • metadata.account — which configured app received it.
  • metadata.chat_id, metadata.chat_type, metadata.from_open_id — routing keys.

Install

# Into the LingTai agent's venv (typically ~/.lingtai-tui/runtime/venv/)
pip install git+https://github.com/Lingtai-AI/lingtai-feishu.git

After install, python -m lingtai_feishu (or the lingtai-feishu script) starts the MCP server over stdio.

lark-oapi (Feishu's official Python SDK) is a hard dependency.

Configure

The server reads its app config from a JSON file pointed at by LINGTAI_FEISHU_CONFIG. Recommended path: .secrets/feishu.json inside the agent's working directory. Plaintext only — this MCP does not support *_env indirection.

Config schema

{
  "accounts": [
    {
      "alias": "myapp",
      "app_id": "cli_xxxxxxxxxxxx",
      "app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "allowed_users": ["ou_xxxxxxxxxxxxxxxxxxxxxxxx"]
    }
  ]
}
  • alias — human-friendly name; used as the account parameter in tool calls.
  • app_id / app_secret — issued by Feishu Open Platform when you create a custom app.
  • allowed_users — optional allow-list of user open_ids. When set, messages from other senders are silently ignored. Omit to accept any sender within your app's scope.

Activation in LingTai

{
  "addons": ["feishu"],
  "mcp": {
    "feishu": {
      "type": "stdio",
      "command": "/path/to/your/python",
      "args": ["-m", "lingtai_feishu"],
      "env": {
        "LINGTAI_FEISHU_CONFIG": ".secrets/feishu.json"
      }
    }
  }
}

Then run system(action="refresh") from the agent. The MCP subprocess starts, the per-account Feishu WebSocket clients connect, and the omnibus feishu tool becomes available.

Troubleshooting

  • LINGTAI_FEISHU_CONFIG env var not set — your init.json mcp.feishu.env entry is missing the LINGTAI_FEISHU_CONFIG key.
  • Feishu config not found — the path resolves but no file exists. Relative paths are resolved against LINGTAI_AGENT_DIR.
  • coroutine 'Client._connect' was never awaited warning — usually means invalid app_id/app_secret. The lark SDK fails the WebSocket handshake; tool calls still work for actions that don't require live connection (like accounts, check of cached state).
  • Server boots but no inbound messages — your app needs im:message and im:message:send_as_bot scopes in the Feishu Open Platform console. After enabling, re-publish the version.
  • MCP server failed to start — usually the command path in init.json doesn't have lingtai_feishu installed. Confirm with <command> -m lingtai_feishu --help from a shell.
  • Tool calls return Feishu manager not initialized — server boot failed (most often a malformed config). Check stderr.

License

MIT.

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

lingtai_feishu-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

lingtai_feishu-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file lingtai_feishu-0.1.0.tar.gz.

File metadata

  • Download URL: lingtai_feishu-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lingtai_feishu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ebbb5bec15a094c2026b7a766756da9e367576c5c1528be7aa703e4fd31d3495
MD5 2f59178d686b2dd21432989a9be716d2
BLAKE2b-256 d5f7777497774cf97283c8245775eb88caf15f46c4a387e255c5805c0533fd9f

See more details on using hashes here.

File details

Details for the file lingtai_feishu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lingtai_feishu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lingtai_feishu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f07be691f4cfdabb23541d2d9c7bc14669b990ec2d80c85ada187e16497ddb15
MD5 6be5081d581027dbb84af5c4a961adbc
BLAKE2b-256 bee4b9ecf5f80da7fac77dc85bb42231a9b1ac44e62ad293e75b9d558079929c

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