Skip to main content

A Model Context Protocol (MCP) server for Lark (Feishu) integration

Project description

Lark Helper MCP Server

一个用于 Lark (飞书) 集成的 Model Context Protocol (MCP) 服务器。

功能特性

  • 🚀 基于 FastMCP 构建的高性能 MCP 服务器
  • 📱 支持向飞书用户和群聊发送文本消息
  • 🔐 安全的环境变量配置管理
  • 🛠 支持多种安装和运行方式

环境要求

  • Python 3.12+
  • 有效的飞书应用凭据(App ID 和 App Secret)

安装

方法一:使用 uvx(推荐)

# 临时运行
uvx lark-helper-mcp

# 或永久安装
uv tool install lark-helper-mcp

方法二:使用 pip

pip install lark-helper-mcp

方法三:开发安装

git clone <repository-url>
cd lark-helper-mcp
uv sync
uv run python main.py

配置

在运行之前,需要设置以下环境变量:

export LARK_APP_ID=your_app_id_here
export LARK_APP_SECRET=your_app_secret_here

或者创建 .env 文件:

LARK_APP_ID=your_app_id_here
LARK_APP_SECRET=your_app_secret_here

获取飞书应用凭据

  1. 访问 飞书开放平台
  2. 创建一个新的应用或选择现有应用
  3. 在应用详情页面获取 App ID 和 App Secret
  4. 确保应用有发送消息的权限

使用方法

作为独立服务器运行

# 使用 uvx
uvx lark-helper-mcp

# 或使用已安装的命令
lark-helper-mcp

# 或使用 Python 模块
python -m lark_helper_mcp

在 Claude Desktop 中使用

在 Claude Desktop 的配置文件中添加:

{
  "mcpServers": {
    "lark-helper": {
      "command": "uvx",
      "args": ["lark-helper-mcp"],
      "env": {
        "LARK_APP_ID": "your_app_id_here",
        "LARK_APP_SECRET": "your_app_secret_here"
      }
    }
  }
}

可用工具

send_text_message

向指定的飞书用户或群聊发送文本消息。

参数:

  • receive_id (string): 接收者 ID
  • receive_id_type (string): 接收者 ID 类型,支持:
    • user_id: 用户 ID
    • open_id: Open ID
    • chat_id: 群聊 ID
  • text_content (string): 要发送的文本内容

示例使用:

# 发送消息给用户
send_text_message(
    receive_id="user123", 
    receive_id_type="user_id", 
    text_content="Hello from MCP!"
)

# 发送消息到群聊
send_text_message(
    receive_id="oc_chat456", 
    receive_id_type="chat_id", 
    text_content="团队通知:会议将在10分钟后开始"
)

开发

环境设置

# 克隆仓库
git clone <repository-url>
cd lark-helper-mcp

# 创建虚拟环境并安装依赖
uv venv
uv sync

# 运行开发服务器
uv run python main.py

代码质量检查

# 运行 linter
ruff check

# 格式化代码
ruff format

构建和发布

# 构建包
uv build

# 发布到 PyPI(需要配置 PyPI 凭据)
twine upload dist/*

许可证

MIT License - 详见 LICENSE 文件。

贡献

欢迎提交 Issue 和 Pull Request!

支持

如有问题,请在 GitHub Issues 中提出。

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

lark_helper_mcp-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

lark_helper_mcp-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lark_helper_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for lark_helper_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f6e7c140c3e5d3285be11ef04327b0c8e4e1a157fb1ea64d641bdca14f0f3cb
MD5 66df5ffb7311674e25a1dd674b9286a4
BLAKE2b-256 8c85de58054fb37dd9ef1b0278d36b8e3cf3a73e44de9080a15a33efbc34330d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lark_helper_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef18e7bff9725b04011f56bf0de35f6f86e5016a1f559860099399e3095d273e
MD5 500614aad6ed556685bf1e92c47222b8
BLAKE2b-256 b61b175ab6280583f072b8eed08274ec31d1993a513e3d1f3217282a08e8d33f

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