MCP Express服务器
使用Node.js、Express和TypeScript实现的模型上下文协议(MCP)服务器。
特性
- 实施MCP工具、资源和提示
- 支持StdioServerTransport命令行使用
- 用于测试和调试的Express HTTP服务器
可用MCP功能
工具
echo-回复一条消息getCurrentTime-以ISO格式返回当前时间
资源
example://resource-一个简单的示例资源
鼓励
greeting-一个简单的问候提示模板
设置
# Install dependencies
npm install
# Build the TypeScript code
npm run build运行服务器
使用StdioServerTransport(适用于MCP客户端)
npm start运行Express服务器进行测试
npm run dev添加到光标
要将此服务器添加到Cursor,请将以下内容添加到您的 ~/.cursor/mcp.json 文件:
{
"mcpServers": {
"Express MCP Server": {
"command": "node",
"args": ["path/to/dist/index.js"],
"transport": "stdio"
}
}
}替换 path/to/dist/index.js 使用构建的index.js文件的实际路径。
测试API端点
- 健康检查:
http://localhost:3000/health - 服务器信息:
http://localhost:3000/info
发展
# Run in development mode
npm run dev