使用说明
简单MCP服务器
具有SQLite数据库日志和web仪表板的模型上下文协议(MCP)服务器实现。
特性
- 数学工具:加、减、乘数字
- API工具:从外部API(JSONPlaceholder)获取数据
- 数据库工具:查看使用统计数据和历史记录
- Web仪表板:监视localhost:8000上的工具使用情况
- SQLite日志记录:自动记录所有工具的使用情况和执行时间
部署
Vercel(推荐)
- 推送到GitHub
- 连接到Vercel
- 自动部署
地方发展
# Install dependencies
npm install
# Run all services (MCP server, Inspector, Web dashboard)
npm run dev
# Run individual services
npm run inspector # MCP Inspector
npm run web # Web dashboard only
npm start # MCP server only
用法
Claude桌面配置
本地使用:
{
"mcpServers": {
"simple-mcp-server": {
"command": "node",
"args": ["/absolute/path/to/index.js"]
}
}
}
Vercel用法:
{
"mcpServers": {
"simple-mcp-server": {
"command": "curl",
"args": [
"-X", "POST",
"-H", "Content-Type: application/json",
"-d", "@-",
"https://your-app.vercel.app/api/mcp"
]
}
}
}
可用工具
add-加两个数字subtract-减去两个数字multiply-将两个数字相乘get_posts-从JSONPlaceholder API获取帖子get_tool_usage_stats-查看使用统计数据get_tool_usage_history-查看最近的使用历史记录
Web仪表板
访问地址: https://your-app.vercel.app/ 查看:
- 使用统计
- 最近的工具使用历史
- 实时监控
项目结构
├── api/ # Vercel API routes
│ ├── mcp.js # MCP server endpoint
│ └── web/ # Web dashboard APIs
├── mcp/ # MCP implementation
│ ├── tools/ # Tool implementations
│ ├── database/ # Database logic
│ └── resources/ # MCP resources
├── public/ # Web dashboard
└── index.js # Local MCP server
发展
- Node.js:18.x或更高
- 数据库:SQLite(自动创建)
- 框架:MCP TypeScript SDK
脚本
npm run dev-所有具有自动重启功能的服务npm run vercel-dev-Vercel开发服务器npm run deploy-部署到Vercelnpm run inspector-仅限MCP检查员npm run web-仅限Web仪表板
