快速搭建MCP服务器模板
用于快速搭建您自己的MCP服务器的模板。
快速入门
-
使用以下命令创建项目:
npx @mcpdotdirect/create-mcp-server # 或者使用 npm npm init @mcpdotdirect/mcp-server
-
安装依赖:
npm install # 或使用 yarn、pnpm、bun 等包管理工具
-
启动服务器:
- stdio 模式(本地 CLI):
npm start
- HTTP 模式(网络模式):
npm run start:http
- stdio 模式(本地 CLI):
-
开发模式(支持热重载):
npm run dev # 或 HTTP 模式 npm run dev:http
-
配置环境变量,例如更改端口:
PORT=8080 npm run start:http
-
在 Cursor 中连接:
- stdio 模式:添加
npm start
命令。 - SSE 模式:URL 为
http://localhost:3001/sse
。
- stdio 模式:添加
更多信息请参考 FastMCP 文档 和 MCP 协议文档。