Back to MCP directory
publicPublicdnsLocal runtime

mcp-server-template-v4w

一个基于Bun运行时的MCP服务器模板,专门用于构建AI问答工具,提供多类别、多难度的交互式测验功能。

article

README

🚀 MCP 服务器模板

本项目是一个专为构建 AI 工具而设计的、基于 Bun 运行时的_quiz_聚焦型 MCP 服务器启动套件,能助力开发者高效搭建相关服务器。

🚀 快速开始

本 MCP 服务器模板可帮助你快速搭建基于 Bun 运行时的 AI 工具服务器。以下是快速启动的基本步骤:

# 克隆仓库
git clone https://github.com/username/quiz-mcp-template.git
cd quiz-mcp-template

# 安装依赖项
bun install

# 启动服务器
bun start

✨ 主要特性

  • 精准聚焦:专门针对_quiz_实现聚焦型 MCP 服务器。
  • 丰富测验:具备多个类别和难度级别的测验工具,满足多样化需求。
  • 全面测试:带有 MCP 集成测试的 Jest 测试设置,确保全面的测试覆盖范围。

📦 安装指南

环境要求

  • Bun:v1.0.0 或更高版本,安装方式请参考:https://bun.sh/docs/installation
  • Node.js:v18.0.0 或更高版本(用于某些依赖项)
  • 操作系统
    • macOS 12+
    • Linux glibc 2.31+
    • Windows 10+(通过 WSL)

安装步骤

# 克隆仓库
git clone https://github.com/username/quiz-mcp-template.git
cd quiz-mcp-template

# 安装依赖项
bun install

Claude 桌面设置

{
  "quiz": {
    "command": "<your path>/.bun/bin/bun",
    "args": ["run", "<your path>/bun-mcp-template/src/index.ts"]
  }
}

💻 使用示例

基础用法

运行服务器

# 启动服务器
bun start

# 开发模式(带自动重启)
bun dev

测试

# 运行所有测试
bun test

高级用法

本服务器提供一个交互式测验工具 get_quiz,可提供不同类别和难度级别的测验问题。

{
  "method": "tools/call",
  "params": {
    "name": "get_quiz",
    "arguments": {
      "category": "science",
      "difficulty": "medium"
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}

可用类别:

  • general
  • science
  • history
  • geography
  • entertainment

难度级别:

  • easy
  • medium
  • hard

📚 详细文档

项目结构

quiz-mcp-template/
├── src/
│   └── index.ts       # 主 Quiz MCP 服务器实现文件
├── tests/
│   └── cli-mcp.test.ts # MCP 集成测试文件
├── package.json
├── tsconfig.json
└── README.md

开发

扩展测验类别

要添加新的测验类别或问题,请修改 src/index.ts 中的 quizQuestions 对象:

// 添加新类别
quizQuestions.newCategory = {
  easy: [
    { question: "Easy question 1?", answer: "Answer 1" },
    { question: "Easy question 2?", answer: "Answer 2" },
    // 添加更多问题...
  ],
  medium: [
    { question: "Medium question 1?", answer: "Answer 1" },
    { question: "Medium question 2?", answer: "Answer 2" },
    // 添加更多问题...
  ],
  hard: [
    { question: "Hard question 1?", answer: "Answer 1" },
    { question: "Hard question 2?", answer: "Answer 2" },
    // 添加更多问题...
  ],
};

// 不要忘记更新模式来包含新类别
const QuizSchema = z.object({
  category: z
    .enum([
      "general",
      "science",
      "history",
      "geography",
      "entertainment",
      "newCategory",
    ])
    .optional()
    .describe("The category of questions to ask"),
  // ...
});

📄 许可证

本项目采用 MIT 许可证。

致谢

该项目使用了由 Anthropic 开发的模型上下文协议(MCP),并提供了一个教育测验工具,供 AI 助手使用。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client