Skip to main content
Glama

📝 作业批改 MCP

npm version License: MIT Node.js Version TypeScript MCP Downloads Last Commit

🌟 项目简介

作业批改 MCP 是一个基于 Model Context Protocol (MCP) 的智能作业批改服务,通过集成魔搭社区的 Qwen3-VL-235B-A22B-Instruct 多模态模型,实现对学生作业图片的智能识别和批改。

✨ 核心功能

  • 🎯 智能识别: 自动识别作业图片中的题目和学生答案

  • 🔍 精准批改: 逐题判断答案正确性,提供详细评分

  • 💡 智能解析: 为每道题提供简洁明了的解析说明

  • 📊 结构化输出: 按照标准格式输出批改结果

  • 🚀 批量处理: 支持同时批改多份作业

  • 🎨 多科支持: 支持数学、语文、英语等多个学科

  • 🌐 URL支持: 支持Base64和URL两种方式上传图片

  • CDN兼容: 支持各种CDN图片链接,自动处理重定向

Related MCP server: Qwen Video Understanding MCP Server

🚀 快速开始

📋 环境要求

  • Node.js >= 18.0.0

  • npm 或 pnpm 包管理器

  • 魔搭社区 API 密钥

📦 安装

全局安装(推荐)

npm install -g @pickstar-2002/homework-grading-mcp@latest

本地安装

npm install @pickstar-2002/homework-grading-mcp@latest

⚙️ 配置

  1. 获取魔搭社区 API 密钥

  2. 设置环境变量

    创建 .env 文件:

    cp .env.example .env

    编辑 .env 文件,填入你的 API 密钥:

    MODELSCOPE_API_KEY=your-modelscope-api-key-here

🔧 使用说明

🏃‍♂️ 命令行启动

# 直接运行
homework-grading-mcp

# 或使用 npx(推荐)
npx @pickstar-2002/homework-grading-mcp@latest

🔌 IDE 集成配置

VS Code + Cline 配置

  1. 安装 Cline 插件:在 VS Code 扩展商店搜索并安装 "Cline" 插件

  2. 配置 MCP 服务器:在 VS Code 设置中搜索 "MCP",找到 Cline 的 MCP 配置

  3. 添加服务器配置

{
  "mcpServers": {
    "homework-grading": {
      "command": "npx",
      "args": ["@pickstar-2002/homework-grading-mcp@latest"],
      "env": {
        "MODELSCOPE_API_KEY": "your-modelscope-api-key-here"
      }
    }
  }
}
  1. 重启 VS Code:配置完成后重启 VS Code 使配置生效

Claude Desktop 配置

  1. 找到配置文件

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  2. 编辑配置文件,添加 MCP 服务器配置:

{
  "mcpServers": {
    "homework-grading": {
      "command": "npx",
      "args": ["@pickstar-2002/homework-grading-mcp@latest"],
      "env": {
        "MODELSCOPE_API_KEY": "your-modelscope-api-key-here"
      }
    }
  }
}
  1. 重启 Claude Desktop:保存配置后重启应用

其他 MCP 客户端

任何支持 MCP 协议的客户端都可以使用,配置方式类似:

{
  "command": "npx",
  "args": ["@pickstar-2002/homework-grading-mcp@latest"],
  "env": {
    "MODELSCOPE_API_KEY": "your-api-key"
  }
}

🎯 使用示例

方式1:使用图片URL(推荐)

{
  "tool": "grade_homework",
  "arguments": {
    "imageUrl": "https://example.com/homework.jpg",
    "subject": "数学",
    "studentName": "张三"
  }
}

方式2:使用Base64图片数据

{
  "tool": "grade_homework",
  "arguments": {
    "imageData": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
    "subject": "数学",
    "studentName": "张三"
  }
}

方式3:批量批改作业

{
  "tool": "batch_grade_homework",
  "arguments": {
    "submissions": [
      {
        "imageUrl": "https://example.com/student1-homework.jpg",
        "subject": "数学",
        "studentName": "张三"
      },
      {
        "imageUrl": "https://example.com/student2-homework.jpg",
        "subject": "数学",
        "studentName": "李四"
      }
    ]
  }
}

方式4:指定题目信息(可选)

{
  "tool": "grade_homework",
  "arguments": {
    "imageUrl": "https://example.com/homework.jpg",
    "subject": "数学",
    "studentName": "张三",
    "questions": [
      {
        "id": "q1",
        "type": "calculation",
        "content": "计算 2 + 3 = ?",
        "standardAnswer": "5",
        "points": 5
      },
      {
        "id": "q2", 
        "type": "choice",
        "content": "下列哪个是偶数?A. 3 B. 4 C. 5",
        "standardAnswer": "B",
        "points": 5
      }
    ]
  }
}

实际使用场景示例

场景1:数学老师批改几何作业

{
  "tool": "grade_homework",
  "arguments": {
    "imageUrl": "https://5b0988e595225.cdn.sohucs.com/images/20180108/86e7ed5ce5154f5e8df5ae422ce61f93.jpeg",
    "subject": "数学",
    "studentName": "王同学"
  }
}

场景2:语文老师批改作文

{
  "tool": "grade_homework",
  "arguments": {
    "imageData": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
    "subject": "语文",
    "studentName": "李同学"
  }
}

📊 返回结果格式

批改结果结构

interface HomeworkGradingResponse {
  submissionId: string;          // 提交ID
  totalScore: number;            // 总得分
  maxTotalScore: number;         // 满分
  grade: 'A' | 'B' | 'C' | 'D' | 'F';  // 等级
  results: GradingResult[];      // 每题详细结果
  overallFeedback: string;       // 总体反馈
  gradedAt: string;              // 批改时间
}

interface GradingResult {
  questionId: string;            // 题目ID
  isCorrect: boolean;            // 是否正确
  studentAnswer: string;         // 学生答案
  correctAnswer: string;         // 正确答案
  explanation: string;           // 解析说明
  score: number;                 // 得分
  maxScore: number;              // 满分
  feedback: string;              // 反馈意见
}

🛠️ 开发指南

📁 项目结构

├── src/
│   ├── config.ts              # 配置文件
│   ├── types.ts               # TypeScript 类型定义
│   ├── index.ts               # 主入口文件
│   ├── services/              # 服务层
│   │   ├── modelService.ts    # 模型服务
│   │   └── gradingService.ts  # 批改服务
│   ├── tools/                 # MCP工具
│   │   └── gradingTools.ts    # 批改工具定义
│   └── utils/                 # 工具函数
│       ├── logger.ts          # 日志工具
│       └── image.ts           # 图片处理工具
├── package.json
├── tsconfig.json
└── README.md

🏗️ 本地开发

  1. 克隆项目

    git clone https://github.com/pickstar-2002/homework-grading-mcp.git
    cd homework-grading-mcp
  2. 安装依赖

    npm install
  3. 配置环境

    cp .env.example .env
    # 编辑 .env 文件,填入 API 密钥
  4. 开发运行

    npm run dev
  5. 构建项目

    npm run build

🧪 测试

# 运行测试(如果有)
npm test

# 启动开发服务器进行测试
npm run dev

🔧 环境变量

变量名

说明

默认值

MODELSCOPE_API_KEY

魔搭社区 API 密钥

必填

MCP_SERVER_NAME

MCP 服务器名称

homework-grading-mcp

MCP_SERVER_VERSION

MCP 服务器版本

1.0.0

LOG_LEVEL

日志级别

info

🎨 支持的题型

  • 选择题 (choice)

  • 填空题 (fill)

  • 计算题 (calculation)

  • 作文题 (essay)

📚 支持的科目

  • 📐 数学 - 计算题、应用题、几何题等

  • 📖 语文 - 阅读理解、作文、古诗词等

  • 🌍 英语 - 语法、翻译、作文等

  • 🧪 物理 - 计算题、实验题等

  • ⚗️ 化学 - 方程式、计算题等

  • 🌏 地理 - 地图题、简答题等

  • 🏛️ 历史 - 简答题、材料题等

  • 🧬 生物 - 简答题、实验题等

🤝 贡献指南

欢迎提交 Issue 和 Pull Request!

  1. Fork 本仓库

  2. 创建特性分支 (git checkout -b feature/amazing-feature)

  3. 提交更改 (git commit -m 'Add some amazing feature')

  4. 推送到分支 (git push origin feature/amazing-feature)

  5. 创建 Pull Request

📝 更新日志

v1.0.0 (2025-01-01)

  • 🎉 初始版本发布

  • ✨ 支持单份作业批改

  • 📚 支持批量作业批改

  • 🎯 支持多种题型

  • 📊 提供详细批改结果

🐛 常见问题

Q: 模型连接失败怎么办?

A: 请检查:

  1. API 密钥是否正确配置

  2. 网络连接是否正常

  3. 魔搭社区服务是否可用

Q: 支持哪些图片格式?

A: 支持 JPEG、PNG、GIF、BMP、WebP 等常见格式

Q: 批改准确率如何?

A: 基于 Qwen3-VL 多模态模型,准确率较高,但建议人工复核重要作业

Q: 可以自定义评分标准吗?

A: 目前使用内置评分标准,后续版本将支持自定义评分规则

📄 许可证

本项目基于 MIT 许可证 开源。

👤 作者

pickstar-2002

🙏 致谢


⭐ 如果这个项目对你有帮助,请给个 Star!

Made with ❤️ by pickstar-2002

Available Tools

1 tool
grade_homeworkB

📝 智能批改学生作业图片,支持Base64和URL两种方式,自动识别题目并给出评分和解析

ParametersJSON Schema
NameRequiredDescriptionDefault
imageDataNoBase64编码的作业图片数据(支持PNG、JPG、JPEG格式),与imageUrl二选一
imageUrlNo作业图片的URL地址,与imageData二选一

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions automatic question recognition and scoring/analysis output, it doesn't describe important behavioral aspects like accuracy limitations, processing time, error handling, authentication requirements, or rate limits. For an AI-powered grading tool with no annotation coverage, this represents significant gaps in behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with a single sentence that efficiently communicates core functionality. The emoji adds visual emphasis but doesn't detract from clarity. Every element serves a purpose, though the structure could be slightly improved by separating input methods from core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (AI-powered image analysis for grading), no annotations, and no output schema, the description provides adequate basic information about what the tool does but lacks details about output format, accuracy, limitations, and error conditions. It's minimally viable but leaves important contextual gaps for an agent to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (imageData and imageUrl) including their formats and mutual exclusivity. The description mentions '支持Base64和URL两种方式' (supports Base64 and URL two methods) which aligns with but doesn't add meaningful semantic value beyond what the schema provides, justifying the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('智能批改' - intelligent grading) and resources ('学生作业图片' - student homework images), including the key functionality of automatic question recognition and providing scores/analysis. It distinguishes itself by specifying support for both Base64 and URL input methods.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through '智能批改学生作业图片' (intelligent grading of student homework images) but provides no explicit guidance on when to use this tool versus alternatives. With no sibling tools mentioned, there's no differentiation guidance, though the tool's specialized purpose is reasonably clear from the description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool update
    • First observedgrade_homework

TDQS

B3.4/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or confusion between tools. The tool's purpose is clearly defined as grading homework from images, making it impossible to misselect among non-existent alternatives.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare against. The name 'grade_homework' follows a clear verb_noun pattern, which would be consistent if more tools were added.

Tool Count2/5

A single tool is too few for a server labeled 'Homework Grading MCP', which implies a broader scope. While the tool handles grading, typical grading workflows might require additional operations like listing assignments, managing students, or reviewing grades, making this feel incomplete.

Completeness2/5

The tool surface is severely incomplete for a homework grading domain. It only provides grading functionality, missing essential operations such as creating assignments, retrieving past grades, updating scores, or managing student data, which will likely cause agent failures in comprehensive tasks.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/homework-grading-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server