edupaper-mcp
v1.0.6
Published
A Model Context Protocol (MCP) server for generating exam papers and questions.
Readme
edupaper-mcp 是一个基于 Model Context Protocol (MCP) 的试卷生成助手工具。
它可以帮助 AI 快速生成考试试卷,支持多种题型、Markdown 格式排版以及 LaTeX 数学公式渲染,最终输出为 DOCX 文档。
适用于:
- 🤖 与 AI 对话助手的集成(如 Claude Desktop、OpenAI MCP 客户端等)
- 🎓 教师或教育工作者快速出题
- 📝 自动化生成练习题
🚀 Features
- 📄 自动生成 DOCX 试卷:根据 JSON 输入自动排版并生成 Word 文档。
- 🎯 全题型支持:
- 单选题 (
single_choice) - 多选题 (
multiple_choice) - 判断题 (
true_false) - 填空题 (
fill_in_blank) - 名词解释 (
noun_explanation) - 简答题 (
short_answer) - 计算题 (
calculation)
- 单选题 (
- 🧮 数学公式支持:完美支持 LaTeX 公式渲染(基于 Katex),支持行内公式 (
$E=mc^2$) 和块级公式 ($$...$$)。 - 📝 Markdown 排版:题目内容支持 Markdown 格式(粗体、斜体、列表等)。
- ✅ 答案解析:支持附带答案,自动显示在题目下方。
- ☁️ 临时链接生成:生成的试卷会自动上传并返回有效期为 7 天的下载链接。
📦 Installation & Usage
使用 npx 直接运行(无需安装):
npx edupaper-mcp或者添加到你的 MCP 客户端配置中(如 claude_desktop_config.json):
{
"mcpServers": {
"edupaper": {
"command": "npx",
"args": ["-y", "edupaper-mcp"]
}
}
}🛠️ Tool Definition
generate_exam_paper
生成一份包含指定题目的考试试卷 (DOCX)。
参数 (Parameters)
| 参数名 | 类型 | 必填 | 描述 |
| :--- | :--- | :--- | :--- |
| title | string | 是 | 试卷标题,显示在文档顶部。 |
| questions | Array<Question> | 是 | 题目列表,具体结构见下文。 |
题目对象 (Question Object)
| 字段 | 类型 | 必填 | 描述 |
| :--- | :--- | :--- | :--- |
| type | string | 是 | 题目类型(见下方枚举值)。 |
| content | string | 是 | 题目内容,支持 Markdown 和 LaTeX 公式。 |
| options | Array<string> | 否 | 选项列表(仅用于选择题)。会自动添加 A/B/C/D 标签。 |
| answer | string | 否 | 参考答案,将显示在题目下方。 |
| points | number | 否 | 题目分值,显示为 (x分)。 |
支持的题型 (Question Types)
single_choice(单选题)multiple_choice(多选题)true_false(判断题)fill_in_blank(填空题)short_answer(简答题)noun_explanation(名词解释)calculation(计算题)
🧮 Math & Formatting Guide
本工具支持在题目内容 (content) 和选项 (options) 中使用 Markdown 和 LaTeX。
数学公式 (LaTeX)
- 行内公式:使用单美元符号包裹,例如
$E = mc^2$。 - 块级公式:使用双美元符号包裹,例如:
$$ \int_{0}^{\infty} x^2 dx $$
Markdown 格式
- 加粗:
**重点内容** - 斜体:
*斜体内容* - 代码:
`code`
💡 Example Usage
以下是一个调用 generate_exam_paper 工具的 JSON 示例:
{
"title": "高中物理与数学联合测试",
"questions": [
{
"type": "single_choice",
"content": "已知质能方程 $E=mc^2$,其中 $c$ 代表什么?",
"options": [
"光速 (Speed of Light)",
"声速 (Speed of Sound)",
"电子速度 (Electron Speed)",
"地球公转速度 (Earth Revolution Speed)"
],
"points": 5,
"answer": "A"
},
{
"type": "calculation",
"content": "请计算以下定积分的值:\n$$ \\int_{0}^{\\pi} \\sin(x) dx $$",
"points": 10,
"answer": "2"
},
{
"type": "short_answer",
"content": "请简述 **牛顿第二定律** ($F=ma$) 的物理意义。",
"points": 10,
"answer": "物体加速度的大小跟作用力成正比,跟物体的质量成反比..."
},
{
"type": "fill_in_blank",
"content": "在三角形中,若三边长分别为 $a, b, c$,则余弦定理公式为 $c^2 = $ ______ 。",
"points": 5,
"answer": "a^2 + b^2 - 2ab \\cos C"
}
]
}输出结果
工具将返回一个 JSON,包含生成的 DOCX 文件的下载链接:
{
"content": [
{
"type": "text",
"text": "Successfully generated exam paper: \"高中物理与数学联合测试\"\n\nDownload Link: https://tmp.link/f/...\nFile Size: 12345 bytes\n\n(Note: This link is valid for 7 days)"
}
]
}