模型上下文协议 (MCP) 服务器 + 飞书 OAuth logo

模型上下文协议 (MCP) 服务器 + 飞书 OAuth

Community
ztxtxwd

A remote Model Context Protocol (MCP) server with built-in Feishu OAuth authentication. Supports deployment on Cloudflare Workers and local development. Requires environment variables for Feishu app credentials and Cloudflare KV namespace configuration.

Publisherztxtxwd
Repositoryfeishu-mcp-server
LanguageTypeScript
Forks
10
Stars
86
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    模型上下文协议 (MCP) 服务器 + 飞书 OAuth exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    86 stars and 10 forks from the linked repository.

MCP Badge

Trust Score

飞书 MCP Server

English Documentation

这是一个支持远程连接的模型上下文协议 (MCP) 服务器,内置了飞书 OAuth 认证。

本项目修改自 cloudflare/ai/demos/remote-mcp-github-oauth,将 GitHub OAuth 替换为飞书 OAuth。

您可以将其部署到自己的 Cloudflare 账户,并在创建自己的飞书 OAuth 客户端应用后,拥有一个功能完整的远程 MCP 服务器。用户可以通过飞书账号登录连接到您的 MCP 服务器。

📋 目录

🆚 与飞书官方 MCP Server 的区别

虽然飞书官方也推出了 MCP Server,但本项目在以下几个方面具有显著优势:

🎯 零配置体验

  • 本项目:用户无需手动配置任何参数,全程使用 user_access_token,过期自动刷新
  • 官方项目:需要用户手动配置多个参数,配置复杂

🚀 极致的可用性优化

  • 本项目:深度优化工具尺寸和结构,特别是文档创建块工具、创建嵌套块工具等复杂功能,确保在 Cursor 等客户端中正常使用
  • 官方项目:简单的 API 到 MCP 工具转换,部分工具过于庞大,在实际使用中存在可用性问题

🌐 前沿基础设施

  • 支持部署在 Cloudflare Workers,享受业界最前沿的边缘计算基础设施

✨ 特性

  • 🎯 零配置体验:用户无需手动配置参数,自动管理 user_access_token 和刷新
  • 🔐 飞书 OAuth 认证:安全的用户身份验证
  • 🌐 远程 MCP 服务器:支持多客户端连接
  • 🚀 Cloudflare Workers:高性能、全球分布式部署,享受业界最前沿的边缘计算基础设施
  • 🛠️ 深度优化的工具集:特别优化文档创建、嵌套块等复杂工具,确保在各种客户端中正常使用
  • 🔧 本地开发支持:便于开发和测试的本地环境
  • 极致可用性:相比官方 MCP Server,大幅提升实际使用体验和稳定性

🚀 快速开始

前置要求

  • Node.js 18+ 和 npm
  • Cloudflare 账户
  • 飞书开放平台账户

安装

bash
# 克隆仓库
git clone <repository-url>
cd open-feishu-mcp-server

# 安装依赖
npm install

🚀 部署方式

生产环境部署

步骤 1: 创建飞书应用

  1. 访问飞书开放平台并登录
  2. 点击"开发者后台"并创建一个新应用
  3. 在应用设置中配置权限:
    • 进入"权限与功能"并添加以下权限:
      • "获取用户 ID" (auth:user.id:read)

      • "获取用户任务信息" (task:task:read)

      • "获取用户授权凭证" (offline_access)

      • "获取用户基本信息" (user_profile)

        ...

  4. 记下您的应用 ID应用密钥

步骤 2: 配置 Cloudflare 环境

bash
# 设置必要的密钥
wrangler secret put FEISHU_APP_ID
wrangler secret put FEISHU_APP_SECRET
wrangler secret put COOKIE_ENCRYPTION_KEY  # 使用 openssl rand -hex 32 生成

# 创建 KV 命名空间
wrangler kv namespace create "OAUTH_KV"

步骤 3: 更新配置文件

使用步骤 2 中获得的 KV ID 更新 wrangler.toml 文件中的 KV 命名空间配置。

步骤 4: 部署服务器

bash
npm run deploy

部署完成后,记下您的实际 subdomain(会在部署日志中显示)。

步骤 5: 配置重定向 URL

回到飞书应用设置:

  1. 进入"安全设置"
  2. 添加重定向 URL:https://feishu-mcp-server.<your-actual-subdomain>.workers.dev/callback

本地开发环境

配置本地环境

  1. 配置飞书应用

    • 在飞书应用的"安全设置"中添加:http://localhost:8788/callback
    • 确保拥有所需的权限(同生产环境)
  2. 创建环境变量文件: 在项目根目录创建 .dev.vars 文件:

    FEISHU_APP_ID=your_development_feishu_app_id
    FEISHU_APP_SECRET=your_development_feishu_app_secret
    COOKIE_ENCRYPTION_KEY=any_random_string_here

启动本地服务器

bash
npm run dev

服务器将在 http://localhost:8788 运行。

🔌 客户端集成

使用 Inspector 测试

使用官方的 MCP Inspector 测试您的服务器:

bash
npx @modelcontextprotocol/inspector@latest

连接地址

  • 生产环境:https://feishu-mcp-server.<your-subdomain>.workers.dev/sse
  • 本地环境:http://localhost:8788/sse

使用 Cursor

通过一键安装按钮快速配置:

Install MCP Server

或手动配置:

json
{
  "mcpServers": {
    "feishu": {
      "url": "http://localhost:8788/sse"
    }
  }
}

使用 ChatWise

  1. 配置步骤

    • 打开 ChatWise 设置界面
    • 导航到工具选项
    • 新增命令行输入输出(stdio)
    • 命令:npx -y mcp-remote ${URL}
  2. 连接地址

    • 本地:http://localhost:8788/sse
    • 生产:https://feishu-mcp-server.<your-subdomain>.workers.dev/sse
  3. 首次使用

    • 保存配置后会自动打开飞书 OAuth 登录页面
    • 完成授权即可使用飞书相关功能

🔐 访问控制

  • 身份验证:使用飞书 OAuth 进行用户身份验证
  • 权限范围:所有经过身份验证的飞书用户都可以访问所有工具

📋 工具开发路线图

🚧 当前开发中 (飞书文档)

  • 🔧开发辅助工具
    • ✅ 开发文档内容搜索与召回
  • 📄 文档基础操作
    • ✅ 文档块树结构获取
    • ✅ 获取块类型创建参数 schema
    • ✅ 创建文档块(支持各种块类型)
    • ✅ 更新文档块内容
    • ✅ 批量删除文档块
  • 🔧 文档高级功能
    • ✅ 表格创建与操作
    • ✅ 图片、视频、文件上传与插入
    • ✅ Markdown 导入功能
    • ✅ 素材上传与管理
    • ✅ 文档搜索

🎯 未来计划

  • 📊 电子表格(Sheets)

    • 📋 工作表基础操作(创建、删除、重命名)
    • 📋 单元格数据读写
    • 📋 公式计算与应用
    • 📋 图表创建与编辑
    • 📋 数据筛选与排序
    • 📋 协作与权限管理
  • 🗃️ 多维表格(Base/Bitable)

    • 📋 数据表基础操作
    • 📋 记录增删改查
    • 📋 字段类型管理
    • 📋 视图创建与配置
    • 📋 自动化规则设置
    • 📋 数据导入导出

    ...

图例:✅ 已完成 | 🔄 开发中 | 📋 计划中

🛠️ 技术原理

架构组件

OAuth Provider

完整的 OAuth 2.1 服务器实现,处理:

  • MCP 客户端身份验证
  • 飞书 OAuth 服务连接管理
  • KV 存储中的安全令牌管理

Durable MCP

基于 Cloudflare Durable Objects 的 MCP 扩展:

  • 持久状态管理
  • 身份验证上下文存储
  • 通过 this.props 访问用户信息
  • 基于用户身份的条件工具可用性

MCP Remote

支持远程 MCP 客户端连接:

  • 定义客户端-服务器通信协议
  • 提供结构化工具定义方式
  • 处理请求/响应序列化
  • 维护 SSE 连接

👨‍💻 开发指南

MCP 服务器(由 Cloudflare Workers 提供支持)

本项目实现了双重 OAuth 角色:

  • 对 MCP 客户端充当 OAuth 服务器
  • 对飞书 OAuth 服务充当 OAuth 客户端

工具开发

当前工具使用用户访问令牌进行身份验证,确保:

  • 安全访问飞书 API
  • 基于用户权限的功能访问
  • 完整的错误处理和日志记录

📝 注意:确保在部署前正确配置所有环境变量和飞书应用设置。如遇问题,请检查飞书应用权限配置和重定向 URL 设置。

Star History

Star History Chart

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "ztxtxwd-feishu-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

Use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once 模型上下文协议 (MCP) 服务器 + 飞书 OAuth is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add 模型上下文协议 (MCP) 服务器 + 飞书 OAuth as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "ztxtxwd-feishu-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "remote-mcp-github-oauth"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth to help me with this task?
模型上下文协议 (MCP) 服务器 + 飞书 OAuth
Sure. I read it.
Here is what I found using 模型上下文协议 (MCP) 服务器 + 飞书 OAuth.

Option 2: Add an MCP server URL

Use this when 模型上下文协议 (MCP) 服务器 + 飞书 OAuth is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for 模型上下文协议 (MCP) 服务器 + 飞书 OAuth.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth to help me with this task?
模型上下文协议 (MCP) 服务器 + 飞书 OAuth
Sure. I read it.
Here is what I found using 模型上下文协议 (MCP) 服务器 + 飞书 OAuth.

Frequently asked questions

What is the 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP server used for?

模型上下文协议 (MCP) 服务器 + 飞书 OAuth is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With 模型上下文协议 (MCP) 服务器 + 飞书 OAuth connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP to TypingMind?

模型上下文协议 (MCP) 服务器 + 飞书 OAuth can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP provide in TypingMind?

模型上下文协议 (MCP) 服务器 + 飞书 OAuth exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use 模型上下文协议 (MCP) 服务器 + 飞书 OAuth MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If 模型上下文协议 (MCP) 服务器 + 飞书 OAuth requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇