模型上下文协议服务器

一个带有SQLite数据库日志记录和Web仪表板的模型上下文协议(MCP)服务器实现,提供数学工具、API工具、数据库工具和实时监控功能。

  • by FullPokerFace
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 fullpokerface/simple-mcp-server

使用说明

简单MCP服务器

具有SQLite数据库日志和web仪表板的模型上下文协议(MCP)服务器实现。

特性

  • 数学工具:加、减、乘数字
  • API工具:从外部API(JSONPlaceholder)获取数据
  • 数据库工具:查看使用统计数据和历史记录
  • Web仪表板:监视localhost:8000上的工具使用情况
  • SQLite日志记录:自动记录所有工具的使用情况和执行时间

部署

Vercel(推荐)

  1. 推送到GitHub
  2. 连接到Vercel
  3. 自动部署

地方发展

# 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 -部署到Vercel
  • npm run inspector -仅限MCP检查员
  • npm run web -仅限Web仪表板