Skip to main content
Glama

Feishu MCP Server

feishuAuthService.ts1.71 kB
import axios from 'axios'; import { Config } from '../utils/config.js'; import { Logger } from '../utils/logger.js'; export class AuthService { public config = Config.getInstance(); // 获取用户信息 public async getUserInfo(access_token: string): Promise<any> { Logger.warn('[AuthService] getUserInfo called'); try { const response = await axios.get( 'https://open.feishu.cn/open-apis/authen/v1/user_info', { headers: { Authorization: `Bearer ${access_token}` } } ); Logger.debug('[AuthService] getUserInfo response', response.data); return response.data; } catch (error) { Logger.error('[AuthService] getUserInfo error', error); throw error; } } // 通过授权码换取user_access_token public async getUserTokenByCode({ client_id, client_secret, code, redirect_uri, code_verifier }: { client_id: string; client_secret: string; code: string; redirect_uri: string; code_verifier?: string; }) { Logger.warn('[AuthService] getUserTokenByCode called', { client_id, code, redirect_uri }); const body: any = { grant_type: 'authorization_code', client_id, client_secret, code, redirect_uri }; if (code_verifier) body.code_verifier = code_verifier; Logger.debug('[AuthService] getUserTokenByCode request', body); const response = await fetch('https://open.feishu.cn/open-apis/authen/v2/oauth/token', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }); const data = await response.json(); Logger.debug('[AuthService] getUserTokenByCode response', data); return data; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cso1z/Feishu-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server