Skip to main content
Glama
larksuite

Feishu/Lark OpenAPI MCP

Official
by larksuite
cli.test.ts1.94 kB
import { LoginHandler } from '../src/cli/login-handler'; import * as server from '../src/mcp-server'; // 模拟 LoginHandler jest.mock('../src/cli/login-handler', () => ({ LoginHandler: { handleLogin: jest.fn(), handleLogout: jest.fn(), }, })); // 模拟server模块 jest.mock('../src/mcp-server', () => ({ initMcpServerWithTransport: jest.fn(), })); describe('CLI Commands', () => { beforeEach(() => { jest.clearAllMocks(); }); describe('Login Command', () => { it('应该调用 LoginHandler.handleLogin', async () => { const options = { appId: 'test-app-id', appSecret: 'test-app-secret', domain: 'https://open.feishu.cn', scope: 'test-scope', }; // 模拟login命令的action回调 const loginActionCallback = jest.fn(async (options) => { await LoginHandler.handleLogin(options); }); await loginActionCallback(options); expect(LoginHandler.handleLogin).toHaveBeenCalledWith(options); }); }); describe('Logout Command', () => { it('应该调用 LoginHandler.handleLogout', async () => { // 模拟logout命令的action回调 const logoutActionCallback = jest.fn(async () => { await LoginHandler.handleLogout(); }); await logoutActionCallback(); expect(LoginHandler.handleLogout).toHaveBeenCalledWith(); }); }); describe('MCP Command', () => { it('应该调用 initMcpServerWithTransport', async () => { const options = { appId: 'test-app-id', appSecret: 'test-app-secret', mode: 'stdio', }; // 模拟mcp命令的action回调 const mcpActionCallback = jest.fn(async (options) => { await server.initMcpServerWithTransport('oapi', options); }); await mcpActionCallback(options); expect(server.initMcpServerWithTransport).toHaveBeenCalledWith('oapi', options); }); }); });

Latest Blog Posts

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/larksuite/lark-openapi-mcp'

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