The Feishu MCP Server is a service based on the Model Context Protocol that provides Feishu API integration, allowing AI models to easily interact with Feishu services. It offers capabilities for document access, chat management, and bot operations through both STDIO and HTTP interfaces.
git clone https://github.com/yourusername/feishu-mcp-server.git
cd feishu-mcp-server
pnpm install
.env
file# Feishu app credentials (required)
FEISHU_APP_ID=your_app_id
FEISHU_APP_SECRET=your_app_secret
# Server configuration (optional)
PORT=3344
LOG_LEVEL=info
# Development mode (auto-restart)
pnpm dev
# Or regular start
pnpm start
# Build the project
pnpm build
# Run the compiled code
node dist/index.js
# Method 1: Using environment variables
NODE_ENV=cli node dist/index.js
# Method 2: Using command line parameters
node dist/index.js --stdio
Option | Environment Variable | Command Line Arg | Default | Description |
---|---|---|---|---|
Feishu App ID | FEISHU_APP_ID |
--feishu-app-id |
- | App ID for your Feishu application |
Feishu App Secret | FEISHU_APP_SECRET |
--feishu-app-secret |
- | App Secret for your Feishu application |
Server Port | PORT |
--port |
3344 | HTTP server port number |
Log Level | LOG_LEVEL |
--log-level |
info | Log level (debug/info/warn/error) |
Token Cache Duration | TOKEN_CACHE_DURATION |
- | 7100 | Access token cache duration (seconds) |
get_feishu_doc_raw
Gets the raw content of a Feishu document.
Parameters:
docId
- Document ID, typically found in the URL (e.g., feishu.cn/docx/<documentId>)Returns:
get_feishu_doc_info
Gets metadata information about a Feishu document.
Parameters:
docId
- Document IDReturns:
send_feishu_text_message
Sends a text message to a Feishu chat.
Parameters:
chatId
- Chat IDtext
- Text content to sendReturns:
send_feishu_card
Sends an interactive card to a Feishu chat.
Parameters:
chatId
- Chat IDcardContent
- Card content (JSON string)Returns:
get_feishu_chat_info
Gets basic information about a Feishu chat.
Parameters:
chatId
- Chat IDReturns:
get_feishu_sheet_meta
Gets metadata about a Feishu Bitable.
Parameters:
appToken
- Bitable ID, typically found in the URL (e.g., feishu.cn/base/<appToken> or feishu.cn/app/<appToken>)Returns:
get_feishu_sheet_tables
Gets the list of tables in a Feishu Bitable.
Parameters:
appToken
- Bitable IDpageSize
- Number of tables to return per page (optional, default 20, max 100)pageToken
- Pagination token (optional, for getting the next page)Returns:
get_feishu_sheet_views
Gets the list of views in a Feishu Bitable table.
Parameters:
appToken
- Bitable IDtableId
- Table IDpageSize
- Number of views to return per page (optional, default 20, max 100)pageToken
- Pagination token (optional)Returns:
get_feishu_sheet_view
Gets detailed information about a specific view in a Feishu Bitable table.
Parameters:
appToken
- Bitable IDtableId
- Table IDviewId
- View IDReturns:
get_feishu_sheet_records
Gets records from a Feishu Bitable table.
Parameters:
appToken
- Bitable IDtableId
- Table IDviewId
- View ID (optional, uses default view if not specified)fieldIds
- List of field IDs to return (optional)filter
- Filter condition in FQL format (optional)sort
- Sort condition in JSON format (optional)pageSize
- Number of records to return per page (optional, default 20, max 100)pageToken
- Pagination token (optional)Returns:
get_feishu_sheet_record
Gets a single record from a Feishu Bitable table.
Parameters:
appToken
- Bitable IDtableId
- Table IDrecordId
- Record IDfieldIds
- List of field IDs to return (optional)Returns:
Problem: API requests return authentication errors
Solution:
Problem: Token refresh fails
Solution:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.