The Feishu MCP Server is a service based on the Model Context Protocol that provides seamless integration with Feishu APIs. It enables AI models to interact effortlessly with Feishu services, offering features like document management, bot messaging, chat operations, and multi-dimensional table handling.
/src
/client # API client implementations
/documents # Document-related API clients
/bots # Bot API clients
/chats # Chat-related API clients
/services # Service layer (business logic and error handling)
/documents # Document-related services
/bots # Bot-related services
/chats # Chat-related services
/server # MCP server implementation
/tools # MCP tool registration and implementation
/typings # Type definitions
/utils # Utility functions
/http # HTTP server implementation
/logger # Logging service
/consts # Constant definitions
config.ts # Configuration management
index.ts # Entry point
FeiShuApiError
for unified API error handling.shell
git clone https://github.com/sdd330/feishu-mcp-server.git
cd feishu-mcp-server
shell
pnpm install
.env
file:env
FEISHU_APP_ID=your_app_id
FEISHU_APP_SECRET=your_app_secret
PORT=3344
LOG_LEVEL=info
pnpm dev
pnpm build
node dist/index.js
NODE_ENV=cli node dist/index.js
Option | Environment Variable | CLI Argument | Default | Description |
---|---|---|---|---|
Feishu App ID | FEISHU_APP_ID |
--feishu-app-id |
- | App ID of the Feishu custom app |
Feishu App Secret | FEISHU_APP_SECRET |
--feishu-app-secret |
- | App Secret of the Feishu custom app |
Server Port | PORT |
--port |
3344 | HTTP server port |
Log Level | LOG_LEVEL |
--log-level |
info | Logging level (debug/info/warn/error) |
get_feishu_doc_raw
Fetch raw content of a Feishu document.
Parameters:
- docId
: Document ID (found in the URL).
Returns: Document text content.
get_feishu_doc_info
Fetch metadata of a Feishu document.
Parameters:
- docId
: Document ID.
Returns: Document metadata in JSON format.
send_feishu_text_message
Send a text message to a Feishu chat.
Parameters:
- chatId
: Chat ID.
- text
: Text content to send.
Returns: Sending status and message ID.
send_feishu_card
Send an interactive card to a Feishu chat.
Parameters:
- chatId
: Chat ID.
- cardContent
: Card content in JSON string.
Returns: Sending status and message ID.
get_feishu_chat_info
Fetch basic information of a Feishu chat.
Parameters:
- chatId
: Chat ID.
Returns: Chat information in JSON format.
get_feishu_sheet_meta
Fetch metadata of a Feishu multi-dimensional table.
Parameters:
- appToken
: Table ID (found in the URL).
Returns: Table metadata in JSON format.
any
type.Record<string, unknown>
instead of object
.Use FeiShuApiError
for all Feishu API-related errors:
try {
// API operation
} catch (error) {
if (error instanceof FeiShuApiError) {
logger.error(`FeiShu API Error (${error.code}): ${error.message}`);
} else {
logger.error('Unexpected error:', error);
}
throw new FeiShuApiError('Operation failed', { cause: error });
}
git checkout -b feature/amazing-feature
).git commit -m 'feat: add some amazing feature'
).git push origin feature/amazing-feature
).MIT