# SVG math mcp **Repository Path**: Pm-Moded/svg-math-mcp ## Basic Information - **Project Name**: SVG math mcp - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-09 - **Last Updated**: 2026-03-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Math Drawing MCP - 模块化几何绘图工具 一个专为高考数学备考设计的模块化几何绘图MCP工具,提供精细化的几何图形绘制能力。 ## 功能特点 ### 模块化设计 - **基础图形模块**: 点、线段、直线、射线、向量、圆、弧 - **多边形模块**: 三角形、矩形、正方形、正多边形、平行四边形、菱形、梯形 - **曲线模块**: 椭圆、抛物线、双曲线、正弦曲线、余弦曲线 - **函数模块**: 二次函数、指数函数、对数函数、多项式函数 - **标注模块**: 坐标轴、网格、标签、尺寸标注、角度标注 ### 精细化绘图 - 支持通过坐标点精确定义图形 - 支持显示/隐藏各种特征点(焦点、顶点、圆心等) - 支持显示/隐藏辅助线(渐近线、准线、对称轴等) - 支持角度测量和标注 ## 安装 ```bash cd c:\Users\ruilo\Documents\TRAE\mathMM pip install fastmcp ``` ## 使用方法 ### 1. 创建画布 ``` math_create_canvas( canvas_id="my_canvas", x_min=-10, x_max=10, y_min=-10, y_max=10, show_grid=True ) ``` ### 2. 绘制图形示例 #### 绘制点和线段 ``` math_draw_point(x=2, y=3, label="A") math_draw_segment(x1=0, y1=0, x2=4, y2=3, show_endpoints=True) ``` #### 绘制三角形 ``` math_draw_triangle( x1=0, y1=0, x2=4, y2=0, x3=2, y2=3, labels=["A", "B", "C"], show_angles=True ) ``` #### 绘制圆 ``` math_draw_circle( center_x=0, center_y=0, radius=3, show_center=True ) ``` #### 绘制抛物线 ``` math_draw_parabola( vertex_x=0, vertex_y=0, a=0.5, direction="up", show_focus=True, show_directrix=True ) ``` #### 绘制双曲线 ``` math_draw_hyperbola( center_x=0, center_y=0, a=2, b=1.5, show_foci=True, show_asymptotes=True ) ``` #### 绘制二次函数 ``` math_draw_quadratic( a=1, b=-2, c=1, show_vertex=True, show_roots=True ) ``` ### 3. 导出图像 ``` math_export_canvas( canvas_id="my_canvas", output_path="output.svg", format="svg" ) ``` ## 工具列表 ### 画布管理 | 工具名 | 功能 | |--------|------| | math_create_canvas | 创建新画布 | | math_export_canvas | 导出画布为SVG/Base64 | | math_clear_canvas | 清空画布 | | math_list_canvases | 列出所有画布 | ### 基础图形 | 工具名 | 功能 | |--------|------| | math_draw_point | 绘制点 | | math_draw_points | 绘制多个点 | | math_draw_line | 绘制直线 | | math_draw_segment | 绘制线段 | | math_draw_vector | 绘制向量 | | math_draw_circle | 绘制圆 | | math_draw_arc | 绘制弧 | ### 多边形 | 工具名 | 功能 | |--------|------| | math_draw_polygon | 绘制多边形 | | math_draw_triangle | 绘制三角形 | | math_draw_rectangle | 绘制矩形 | | math_draw_square | 绘制正方形 | | math_draw_regular_polygon | 绘制正多边形 | ### 圆锥曲线 | 工具名 | 功能 | |--------|------| | math_draw_ellipse | 绘制椭圆 | | math_draw_parabola | 绘制抛物线 | | math_draw_hyperbola | 绘制双曲线 | ### 函数图像 | 工具名 | 功能 | |--------|------| | math_draw_quadratic | 绘制二次函数 | | math_draw_sine | 绘制正弦曲线 | | math_draw_cosine | 绘制余弦曲线 | | math_draw_exponential | 绘制指数函数 | | math_draw_logarithm | 绘制对数函数 | ### 标注工具 | 工具名 | 功能 | |--------|------| | math_draw_axes | 绘制坐标轴 | | math_draw_grid | 绘制网格 | | math_add_label | 添加标签 | | math_add_title | 添加标题 | | math_draw_angle | 绘制角度标记 | ## 目录结构 ``` mathMM/ ├── __init__.py # 包初始化 ├── server.py # MCP服务器主文件 ├── mcp.json # MCP配置文件 ├── core/ │ └── __init__.py # 核心绘图引擎 └── tools/ ├── __init__.py # 工具包初始化 ├── basic_shapes.py # 基础图形工具 ├── polygons.py # 多边形工具 ├── curves.py # 曲线工具 ├── functions.py # 函数图像工具 └── annotations.py # 标注工具 ``` ## 配置到Claude Desktop 在Claude Desktop的配置文件中添加: ```json { "mcpServers": { "math-drawing": { "command": "python", "args": ["c:\\Users\\ruilo\\Documents\\TRAE\\mathMM\\server.py"] } } } ```