easy-mcp-generator
v2.0.0
Published
The simplest way to create Model Context Protocol (MCP) servers in JSON or JavaScript.
Maintainers
Readme
easy-mcp
一款通过 配置即可 生成 MCP 的工具
架构设计
- 1 参考了 vite-plugin-vue-mcp 的
pnpm + monorepo和 Figma-Context-MCP 的设计 - 2 参考了低代码的设计思路
engine
Node >= 22.12.0
配置案例
例如配置一个语料平台的 MCP 服务,可以获取语料列表
module.exports = {
name: 'language-mcp',
version: "1.0.0",
tools: [
{
name: 'get_language_list',
description: "获取语料列表",
parameters: {
},
// 获取语言配置
requestConfig: {
method: 'GET',
url: 'https://xxx.com/api/client/${appCode}/${env}/${locale}/default' // 获取语料的url
}
},
{
name: 'get_language_list',
description: "获取语料列表",
parameters: {
appCode: String,
env: String,
locale: String,
},
// 获取语言配置
requestConfig: (args) => {
const { appCode, env, locale } = args;
return {
method: 'GET',
url: `https://xxx.com/api/client/${appCode}/${env}/${locale}/default` // 获取语料的url
}
}
}
]
}
如果你使用的是 cursor 编辑器,只需要在 cursor 的设置中,添加一个 easy-mcp 的命令,然后就可以在 cursor 中使用 easy-mcp 命令了
{
"mcpServers": {
"language-mcp": {
"command": "npx",
"args": ["-y", "easy-mcp", "-c", "../.easy-mcp.js"]
}
}
}
| 标题 | 类型 | 是否必填 | 含义 |
| --- | --- | --- | --- |
| name | string | 是 | MCP 服务名称 |
| version | ${number}.${number}.${number} | 是 | MCP 版本 |
| tools | Array | 否 | MCP 中的工具允许服务器公开可由客户端调用并由 LLM 用于执行操作的可执行函数。 |
Itool 类型
| 标题 | 类型 | 是否必填 | 含义 |
| --- | --- | --- | --- |
| name | string | 是 | 工具名称 |
| description | string | 是 | 工具描述 |
| parameters | any | 否 | 参数类型描述 |
| requestConfig | Record<string, any> | ((args: any) => IRequestRes) | 是 | 获取数据的方法,axios 的配置 |
TODO
- [ ] 完善配置项,支持更多配置
- [ ] 自动配置 mcp.json, 例如 https://github.com/antfu/nuxt-mcp/blob/main/packages/vite-plugin-mcp/src/index.ts
参考
- https://github.com/webfansplz/vite-plugin-vue-mcp
- https://github.com/punkpeye/fastmcp-boilerplate
- https://github.com/GLips/Figma-Context-MCP/blob/main/src/mcp.ts
