MSPaint MCP Server for AI-powered math drawing

MSPaint MCP Server for AI-powered math drawing

mspaint-mcp-server-v2•byshettysaish20

An MCP server that exposes tools for controlling Windows MSPaint and performing math operations, enabling a Gemini-powered agent to solve and draw math answers.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Implements MSPaint automation tools such as opening Paint, drawing rectangles, and adding text to the canvas.
  • •Provides math tools including add, subtract, multiply, divide, and calculation and consistency verification.
  • •Uses pywinauto to control the MSPaint application and exposes tools via the fastmcp library.

BEST FOR

  • •Having an AI agent solve multi-step math problems step by step and verify each calculation.
  • •Displaying a computed final answer visually in MSPaint by drawing a rectangle and adding text.

ABOUT MSPAINT-MCP-SERVER-V2

MSPaint MCP Server for AI-powered math drawing is cataloged as an MCP server attributed to shettysaish20. An MCP server that exposes tools for controlling Windows MSPaint and performing math operations, enabling a Gemini-powered agent to solve and draw math answers. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MSPaint MCP Server for AI-powered math drawing are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Which AI model powers the agent in this project?

The agent uses Google's Gemini model.

What platform does the MSPaint automation target?

It targets the legacy Windows MSPaint application.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 000a29e098d4 · 采集于 2026-11-13 10:59:18 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MSPaint MCP Server with AI-based Planning Algorithms

This project demonstrates how to use Advanced AI Prompting to make LLMs robust to handle complex math problems of multiple steps. It uses the Model Context Protocol (MCP) to allow an AI agent, powered by Google's Gemini model, to interact with a legacy Windows application (MSPaint). The AI agent leverages tools defined using fastmcp and implemented with pywinauto to solve math problems and then draw the solution on the Paint canvas.

Table of Contents

Introduction

This project showcases use of Advanced AI Prompting to make LLM robust to handle complex math problems of multiple steps.

Structured Prompting for This Problem Statement

You are a math agent with painting skills, solving complex math expressions step-by-step.
You have access to various mathematical tools for calculations and verifications, as well as an MSPaint application to draw and present your solution on a canvas.

Available Tools:
{tools_description}

MSPaint Application Information:
- Rectangle coordinates: x1 = 763, y1 = 595, x2 = 1788, y2 = 1123

You must respond with EXACTLY ONE LINE in one of these formats (no additional text):

1. For function calls:
FUNCTION_CALL: {{"name": function_name, "arguments": {{"param1": value1, "param2": value2}}}}

2. For final answers:
FINAL_ANSWER: <NUMBER>

3. For completing the task:
COMPLETE_RUN

Instructions:
- Start by calling the show_reasoning tool ONLY ONCE with a list of all step-by-step reasoning steps explaining how you will solve the problem. Once called, NEVER CALL IT AGAIN UNDER ANY CIRCUMSTANCES.
- When reasoning, tag each step with the reasoning type (e.g., [Arithmetic], [Logical Check]).
- Use all available math tools to solve the problem step-by-step.
- When a function returns multiple values, process all of them.
- Apply BODMAS rules: start with the innermost parentheses and work outward.
- Do not skip steps — perform all calculations sequentially.
- Respond only with one line at a time.
- Call only one tool per response.
- After calculating a number, verify it by calling:
FUNCTION_CALL: {{"name": "verify_calculation", "arguments": {{"expression": <MATH_EXPRESSION>, "expected": <NUMBER>}}}}
- If verify_calculation returns False, re-evaluate your previous steps.
- Once you reach a final answer, check for consistency of all steps and calculations by calling:
FUNCTION_CALL: {{"name": "verify_consistency", "arguments": {{"steps": [[<MATH_EXPRESSION1>, <ANSWER1>], [<MATH_EXPRESSION2>, <ANSWER2>], ...]}}}} 
- If verify_consistency returns False, re-evaluate your previous steps.
- Once verify_consistency return True, submit your final result as:
FINAL_ANSWER: <NUMBER>

Paint Instructions:
- To draw in Paint, follow this sequence strictly:
1. Call open_paint to start the Paint application.
2. Verify Paint is open using verify_paint_open.
3. If verify_paint_open returns False, retry opening Paint until it succeeds.
4. After Paint is open, draw a rectangle using draw_rectangle with correct parameters.
5. Add text using add_text_in_paint, inserting your FINAL_ANSWER: <NUMBER>.

Final Step:
- After completing all calculations, verifications, and drawings, call:
COMPLETE_RUN

Strictly follow the above guidelines.
Your entire response should always be a single line starting with either FUNCTION_CALL:, FINAL_ANSWER: or COMPLETE_RUN.

ChatGPT Structured Prompting Evaluation Result

{
  "explicit_reasoning": true,
  "structured_output": true,
  "tool_separation": true,
  "conversation_loop": true,
  "instructional_framing": true,
  "internal_self_checks": true,
  "reasoning_type_awareness": true,
  "fallbacks": true,
  "overall_clarity": "Extremely strong prompt — it carefully enforces step-by-step reasoning, structured outputs, error handling, and tool use separation. Very minor improvements could be to give a short worked-out example, but even without it, the robustness is excellent."
}

Project Structure

├── MSPaint-MCP-Server/
│ ├── mcp_server.py # Defines the MCP server with tools for Paint automation 
│ ├── mcp_client.py # Defines the MCP client that interacts with the server and AI model 
│ ├── requirements.txt # Lists the project dependencies 
│ └── .env # Stores the Gemini API key 
├── README.md # This file

Requirements

  • Python 3.11+
  • Conda (recommended for environment management)
  • Google Gemini API key
  • pywin32
  • pywinauto
  • fastmcp
  • python-dotenv
  • google-genai
  • rich

Setup

  1. Create a Conda environment:

    conda create -n eagenv python=3.11
    conda activate eagenv
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Set up the Gemini API key:

    • Create a .env file in the directory.

    • Add your Gemini API key to the .env file:

      GEMINI_API_KEY=YOUR_API_KEY
      

Usage

  1. Run the MCP client:

    python mcp_paint_app/mcp_client.py
    

    This will start the MCP client, which connects to the MCP server, initializes the AI agent, and begins the automation process.

How It Works

  1. MCP Server (mcp_server.py):

    • Defines the tools for interacting with MSPaint (e.g., open_paint, draw_rectangle, add_text_in_paint) and various mathematical operations (e.g., add, subtract, multiply, divide, verify_calculation, verify_consistency).
    • Uses pywinauto to control the MSPaint application.
    • Exposes these tools via the fastmcp library.
  2. MCP Client (mcp_client.py):

    • Connects to the MCP server.
    • Uses the Google Gemini model to generate instructions and solve the given math expression.
    • Parses the model's output to determine which tool to call.
    • Calls the appropriate tool on the MCP server with the required parameters.
    • Handles the response from the tool and feeds it back to the model for the next step.
    • Orchestrates the drawing of the final answer in MSPaint.
  3. AI Agent (Google Gemini):

    • Receives a complex math expression (e.g., ((3000 - (400+552)) / 2 + 1024).
    • Uses the available tools (defined in the system prompt) to solve the problem step by step.
    • Generates function calls (e.g., FUNCTION_CALL: {"name": "add", "arguments" {"a": 400, "b": 552}}) to use the tools.
    • Verifies each calculation using the verify_calculation tool.
    • Ensures the consistency of all steps using the verify_consistency tool.
    • Once the final answer is obtained and verified, it uses Paint to display the result by opening Paint, drawing a rectangle, and adding the final answer as text.
    • Completes the run by calling the COMPLETE_RUN command.

Key Components

  • mcp_server.py: Contains the core logic for automating MSPaint. The open_paint, draw_rectangle, and add_text_in_paint functions are the key tools used by the AI agent.
  • mcp_client.py: Manages the interaction between the AI agent and the MCP server. It sets up the system prompt, calls the tools, and handles the responses.
  • requirements.txt: Lists all the necessary Python packages for the project.
  • .env: Stores the Google Gemini API key.

Troubleshooting

  • Permission Issues: If you encounter permission issues, try running the scripts as an administrator.
  • Coordinate Issues: The coordinates used for clicking in MSPaint may need to be adjusted based on your screen resolution and window size. Use the debugging print statements in the code to identify the correct coordinates.
  • Tool Selection Issues: If the AI agent is not selecting the correct tools, review the system prompt and ensure that the tool descriptions are accurate.
  • API Key Issues: Ensure that your Gemini API key is correctly set in the .env file.

Contributing

Contributions are welcome! Please submit a pull request with your changes.

License

MIT License

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MSPaint MCP Server for AI-powered math drawing from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mspaint-mcp-server-v2)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools