mcpField
M
Mcp Quiz Generator

Mcp Quiz Generator

本地服务
github.com/kkjzio开发工具661 周前更新

关于 Mcp Quiz Generator

将 Markdown 试题转换为互动 HTML 和 Word 文档的 MCP 服务,支持多种题型,并可生成学生版与答案版 Word 文件,适用于教师和试题编写者。

主要功能

  1. 01单选题和多选题
  2. 02判断题和简答题
  3. 03生成互动 HTML 文件
  4. 04生成学生版和答案版 Word
  5. 05设置输出格式和文件名

适用场景

  1. 01根据 Markdown 试题生成测验
  2. 02以 HTML 分享互动测验
  3. 03准备学生版和教师版 Word 文档

MCP 相关

向 MCP 客户端提供试题生成工具。客户端提交 Markdown 内容,并选择生成 HTML、Word 或两种格式。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"quiz-generator": {
"command": "uvx",
"args": [
"mcp-quiz-generator"
]
}
}
}
启动命令uvx mcp-quiz-generator

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
pypimcp-quiz-generator

工具

1

收录的工具列表 · 更新于 2 周前

参数类型必填说明
custom_filenamestring否
format_typestring否
markdown_contentstring是

详细介绍

此处为中文 README:

README_ZH.md

MCP Quiz Generator

一个基于 Model Context Protocol(MCP)的测验生成服务,可根据要求生成 Markdown 题目,并将其转换为 HTML 和 Word 格式的测验文件。

功能特性

  • 🎯 支持多种题型:单选题、多选题、判断题、简答题
  • 📄 生成交互式 HTML 测验文件
  • 📝 生成 Word 格式的测验文件(包括答案版和学生版)
  • 🔧 基于 MCP 协议,可与 Cursor、VSCode 等编辑器集成
  • ⚡ 使用 uv 快速管理依赖

支持的题目格式

单选题
1. Which testing automation frameworks has MaxSoft developed?
    - [x] IntelliAPI  (Correct answer marked with [x])
    - [ ] WebBot      (Incorrect answer marked with [ ])
    - [ ] Gauge
    - [ ] Selenium
多选题
2. Which testing automation frameworks has MaxSoft developed?
    - [x] IntelliAPI  (Multiple correct answers all marked with [x])
    - [x] WebBot      
    - [ ] Gauge       (Incorrect answer marked with [ ])
    - [ ] Selenium
判断题
3. MaxSoft is a software company.
    - (x) True        (Correct answer marked with (x))
    - ( ) False       (Incorrect answer marked with ( ))
简答题
4. Who is the co-founder of MaxSoft?
    - R:= Osanda      (Answer marked with R:= followed by correct answer)

安装与设置

前置条件
  • Python 3.10 或更高版本
  • uv 包管理器

在 Cursor/VSCode 中配置 MCP

方法 1:使用 uvx(推荐)
  1. 创建 MCP 配置文件:

    在 Cursor/VSCode 中,打开 MCP 设置并添加以下配置:

    {
      "mcpServers": {
        "mcp-quiz-generator": {
          "command": "uvx",
          "args": ["mcp-quiz-generator" , "--output-folder" , "{output-folder-path}"]
        }
      }
    }
    

注意:将 {output-folder-path} 替换为生成文件的存储路径。

方法 2:直接使用 Python
  1. 首先确保已安装依赖:

    uv sync
    
  2. 添加到 MCP 配置中:

    {
      "mcpServers": {
        "mcp-quiz-generator": {
          "command": "/path/to/mcp-quiz-generator/.venv/bin/python",
          "args": ["run", "mcp-quiz-generator" , "--output-folder" , "{output-folder-path}"]
        }
      }
    }
    

注意:将 {output-folder-path} 替换为生成文件的存储路径。

工具参数
  • markdown_content:Markdown 格式的测验内容
  • format_type:输出格式
    • "html":仅生成 HTML 文件
    • "word":仅生成 Word 文件
    • "both":同时生成 HTML 和 Word 文件(默认)
  • custom_filename:自定义文件名(可选,不含扩展名)

输出文件

如果未使用 --output-folder 参数,生成的文件默认保存在 data/ 目录中:

  • HTML 文件:支持在线答题的交互式测验

  • image-20250826102712411

  • Word 文件:

    image-20250826102752443

  • *_quiz.docx:学生版(不含答案)

  • *_answer_key.docx:教师版(含答案和标记)

项目结构
mcp-quiz-generator/
├── src/
│   └── quiz_mcp/
│       ├── __init__.py
│       ├── server.py          # MCP server main file
│       └── app/               # Application module directory
│           ├── extensions/    # Markdown extensions
│           └── static/        # Static resource files
├── data/                      # Output file directory (default)
├── pyproject.toml            # Project configuration
├── uv.lock                   # Dependency lock file
└── README.md                 # Project documentation

故障排查

常见问题
  1. 找不到 uv 命令

    • 确保 uv 已正确安装并已添加到 PATH
    • 重启终端或编辑器
  2. MCP 服务连接失败

    • 检查配置文件中的路径是否正确
    • 确保已创建虚拟环境:uv sync
    • 查看编辑器的 MCP 日志以获取详细错误信息
  3. 生成的文件格式不正确

    • 检查 Markdown 内容是否符合指定格式
    • 确保选项缩进正确(4 个空格)
--output-folder 参数说明

--output-folder 参数用于指定生成的测验文件的输出目录。

语法:

uv run mcp-quiz-generator --output-folder <directory-path>

参数说明:

  • <directory-path>:指定输出文件的目录路径
  • 默认值:data(如果未指定此参数,文件将保存到 data/ 目录)
  • 如果指定的目录不存在,程序会自动创建

使用示例:

# Use default output directory (data/)
uv run mcp-quiz-generator

# Specify custom output directory
uv run mcp-quiz-generator --output-folder ./my_quizzes

# Specify absolute path
uv run mcp-quiz-generator --output-folder /home/user/quiz_files

# Specify relative path
uv run mcp-quiz-generator --output-folder ../output

使用示例

完整对话示例:生成提示词工程测验

以下是一个完整的使用示例,展示如何通过 AI 助手生成关于提示词工程的测验:

用户问题:

Q: give me some quiz about Prompt Engineering then generate word and html file

AI 助手回复:

Of course, I can generate a quiz about Prompt Engineering for you. Here are a few questions. I will then use a tool to generate the Word and HTML files.

Here is the quiz content:

#### Single Choice Questions

1. What is a core principle of prompt engineering?
   -  Using the shortest prompt possible.
   -  Providing clear and specific instructions.
   -  Using complex vocabulary.
   -  Always asking for a single-word answer.

#### Multiple Choice Questions

1. Which of the following are common prompt engineering techniques?
   -  Zero-shot prompting
   -  Few-shot prompting
   -  Chain-of-thought prompting
   -  Random word generation

#### True/False Questions

1. "Few-shot prompting" involves giving the model several examples before asking the final question.
   - (x) True
   - ( ) False

#### Short Answer Questions

1. What technique encourages a model to explain its reasoning step-by-step before giving a final answer?
   - R:= Chain-of-thought prompting

Now, let me generate the files for you.

(mcp-quiz-generator : generate_quiz completed)

I have generated the quiz files for you in both Word and HTML formats. Here are the files that have been created:

- **HTML (Interactive Quiz):** `{output-folder-path}\Prompt_Engineering_Quiz.html`
- **Word (Quiz for students):** `{output-folder-path}\Prompt_Engineering_Quiz_quiz.docx`
- **Word (Answer Key):** `{output-folder-path}\Prompt_Engineering_Quiz_answer_key.docx`

Let me know if you need anything else

许可证

MIT License

贡献

欢迎提交 Issues 和 Pull Requests!

参考

https://github.com/osandadeshan/markdown-quiz-generator

更新日志

v0.1.0
  • 首次发布
  • 支持基本测验生成功能
  • 支持输出 HTML 和 Word 格式
  • 集成 MCP 协议
v0.1.1
  • 修复软件包中缺失的 app 文件夹文件

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。