本项目是一个专为构建 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
# 克隆仓库
git clone https://github.com/username/quiz-mcp-template.git
cd quiz-mcp-template
# 安装依赖项
bun install
{
"quiz": {
"command": "/.bun/bin/bun" ,
"args": ["run", "/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
}
可用类别:
难度级别:
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 助手使用。