Mokei
使用模型上下文协议创建、交互和监控客户端及服务器的TypeScript工具包。
简介
Mokei 是一个基于模型上下文协议 (MCP)的 TypeScript 工具包,用于创建、交互和监控 AI 模型的客户端与服务器。
安装
npm install @mokei/core
基本使用
import { createClient } from '@mokei/core';
// 创建客户端连接
const client = createClient({
endpoint: 'https://your-mcp-server.com/api'
});
// 发送请求
const response = await client.chat.completions.create({
messages: [
{ role: 'system', content: '你是一个有用的助手' },
{ role: 'user', content: '请简要介绍MCP协议' }
]
});
console.log(response.choices[0].message.content);
高级功能
- 请求监控与日志
- 自定义服务器实现
- 上下文管理
- 流式响应处理
了解更多
详细文档请访问: https://mokei.dev
由模型上下文协议(MCP)提供支持