🚀 从任何 MCP(模型上下文协议)服务器生成类型安全的 TypeScript 客户端。
import { notion, github, slack } from "./src/mcp-client";
// 具有完整 IntelliSense 的类型安全客户端调用
const page = await notion.createPage({
title: "会议记录",
content: "关于第四季度路线图的讨论...",
});
const issue = await github.createIssue({
title: "错误:登录失败",
body: "用户无法进行身份验证...",
});
await slack.notify({
channel: "#dev",
message: `新问题已创建:${issue.url}`,
});
✨ 类型安全 - 完整的 TypeScript 支持,带有生成的类型
🔄 多提供商 - 同时连接多个 MCP 服务器
🎯 树摇 - 只捆绑你使用的函数
⚡ 快速 - 使用 Bun 构建以实现最佳性能
🛠️ 交互式 CLI - 智能提示,带有合理的默认值
⚙️ 灵活 - 支持多种 MCP 配置格式
npm install -g mcp-client-gen
# 或直接使用
npx mcp-client-gen
创建一个 .mcp.json 文件,其中包含你的 MCP 服务器端点:
{
"mcpServers": {
"notion": {
"type": "http",
"url": "https://mcp.notion.com/mcp",
},
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
},
},
}
交互模式(推荐):
npx mcp-client-gen # 启动交互式提示
npx m[...]