Skip to main content
Glama

Feishu MCP Server

index.ts1.56 kB
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { FeishuMcpServer } from "./server.js"; import { Config } from "./utils/config.js"; import { fileURLToPath } from 'url'; import { resolve } from 'path'; export async function startServer(): Promise<void> { // Check if we're running in stdio mode (e.g., via CLI) const isStdioMode = process.env.NODE_ENV === "cli" || process.argv.includes("--stdio"); // 获取配置实例 const config = Config.getInstance(); // 打印配置信息 config.printConfig(isStdioMode); // 验证配置 if (!config.validate()) { console.error("配置验证失败,无法启动服务器"); process.exit(1); } // 创建MCP服务器 const server = new FeishuMcpServer(); console.log(`isStdioMode:${isStdioMode}`) if (isStdioMode) { const transport = new StdioServerTransport(); await server.connect(transport); } else { console.log(`Initializing Feishu MCP Server in HTTP mode on port ${config.server.port}...`); await server.startHttpServer(config.server.port); } } // 跨平台兼容的方式检查是否直接运行 const currentFilePath = fileURLToPath(import.meta.url); const executedFilePath = resolve(process.argv[1]); console.log(`meta.url:${currentFilePath} argv:${executedFilePath}` ); if (currentFilePath === executedFilePath) { console.log(`startServer`); startServer().catch((error) => { console.error('Failed to start server:', error); process.exit(1); }); } else { console.log(`not startServer`); }

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