Express-REST-API-and-MCP-Server-Framework
by iolufemi·★ 147·综合分 48
Express 框架,可从同一代码库生成双重 REST API 和 MCP 服务器。
概述
这个全面的开发框架可快速创建具有内置 MCP 服务器功能的 RESTful API。它生成完整的 CRUD 服务,同时包含 REST 端点和 MCP 工具/资源,使 LLM 能够直接与应用程序交互。该框架支持多种数据库选项,包括 MongoDB、SQL 和外部 API,在数据管理方面提供灵活性,同时保持一致的接口。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要从同一代码库同时为传统应用程序构建 REST API 和为 AI 客户端构建 MCP 接口时,选择它。
什么时候不要选它
如果您只需要一个简单的 MCP 服务器而不需要 REST API,或者您不使用 Node.js/Express,请不要选择它。
此 server 暴露的工具
从 README 抽取出 12 个工具create_itemsCreate one record in the items collection
create_many_itemsBulk create multiple records in the items collection
update_itemsUpdate a record by id and data
delete_itemsDelete a record by id
items://listList all records in the items collection
items://searchSearch for items in the collection
items://{id}Get one record by id from items collection
create_usersCreate one record in the users collection
update_usersUpdate a user record by id and data
users://listList all records in the users collection
users://searchSearch for users in the collection
users://{id}Get one user record by id
可对比工具
安装
安装
- 克隆存储库并安装依赖项:
$ git clone https://github.com/iolufemi/Express-REST-API-and-MCP-Server-Framework.git ./yourProjectName
$ cd yourProjectName
$ npm install- 生成您的第一个服务:
$ npm run generate -- --name yourFirstEndpoint- 启动开发服务器:
$ npm run devClaude Desktop 集成
将以下内容添加到您的 Claude Desktop 配置中:
{
"mcpServers": {
"express-mcp": {
"command": "node",
"args": ["path/to/your/project/dist/server.js"],
"env": {}
}
}
}FAQ
- 支持哪些数据库?
- 该框架支持 MongoDB(Mongoose)、SQL 数据库(Sequelize)以及外部 API 作为数据源。
- 如何向现有 API 添加 MCP 工具?
- 使用 'npm run generate' 命令创建新服务,这些服务会自动包含 MCP 工具和资源。
Express-REST-API-and-MCP-Server-Framework 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。