feishu-user-token-mcp-v2
Version:
A Model Context Protocol (MCP) server for Feishu user token management and authentication
81 lines (56 loc) • 2.13 kB
Markdown
# Usage Guide
## Quick Start with npx
```bash
# Run directly with npx (recommended)
npx feishu-user-token-mcp
# Show help
npx feishu-user-token-mcp --help
```
## Command Line Arguments
**Note: Command line arguments only take effect at startup and cannot be modified after the service is running.**
When starting the MCP service, you can use the following command line arguments:
```bash
# Using npx
npx feishu-user-token-mcp [options]
# Or if installed globally
feishu-user-token-mcp [options]
# Or running locally
node ./dist/index.js [options]
```
### 可用参数
- `-v, --app_id <string>`: 飞书应用 ID
- `-s, --app_secret <string>`: 飞书应用密钥
- `-u, --user_token <string>`: 用户访问令牌
- `-r, --refresh_token <string>`: 刷新令牌
### 使用示例
```bash
# 指定应用 ID 和密钥
node ./dist/index.js -v your_app_id -s your_app_secret
# 指定所有参数
node ./dist/index.js -v your_app_id -s your_app_secret -u your_user_token -r your_refresh_token
```
## 配置管理
### 配置优先级
系统按以下优先级获取配置值:
1. **命令行参数**(最高优先级,仅在启动时生效)
2. **已保存的配置文件**
3. **用户输入**(最低优先级,会提示用户输入并保存)
### 自动保存
- 通过命令行参数或用户输入提供的配置会自动保存到 `mcp_config.json` 文件中
- 下次启动时会自动读取已保存的配置
- 用户可以随时通过输入框更新配置
## 配置文件格式
`mcp_config.json` 文件格式示例:
```json
{
"app_id": "your_app_id",
"app_secret": "your_app_secret",
"user_token": "your_user_token",
"refresh_token": "your_refresh_token"
}
```
## 注意事项
1. **安全性**: `app_secret` 是敏感信息,请确保 `mcp_config.json` 文件的安全性
2. **令牌管理**: 用户令牌和刷新令牌会在授权流程中自动获取和更新
3. **配置持久化**: 所有配置更改都会自动保存到配置文件中,下次启动时会自动加载
4. **交互式配置**: 如果缺少必需的配置项,系统会提示您输入,无需手动编辑配置文件