mathgraphs-mcp
An agentic MCP for math graphing, statistics, 3D scene building, computation, and visualization.
MathTalking computes and renders interactive visualizations. Plot 2D functions, geometry, statistics, and 3D scenes. Results are graph-verified — roots, extrema, and intersections are computed from actual plotted curves, not generated by AI.
Saves ~410 tokens per render vs LLM-generated canvas code. Zero LLM inference needed — the engine computes, not generates.
Endpoint
https://mathtalking.com/api/mcp
Tools
plot_graph — Math Visualization
Plot functions, points, segments, labels, and shapes on an interactive graph. Auto-computes roots, extrema, and intersections for plotted functions.
Input: Array of elements, each with a type and type-specific fields:
function | expression (required), color | {"type":"function", "expression":"x^2-4", "color":"#4A90D9"} |
points | points [{x,y}] (required), color, label | {"type":"points", "points":[{"x":2,"y":0}], "label":"root"} |
segment | x1,y1,x2,y2 (required), color, label, arrow, dashed | {"type":"segment", "x1":0, "y1":0, "x2":3, "y2":4, "label":"hypotenuse"} |
label | text (required), x,y (required), color, fontSize | {"type":"label", "text":"vertex", "x":0, "y":-4} |
triangle | x1,y1,x2,y2,x3,y3 (required), color, opacity, border | {"type":"triangle", "x1":0, "y1":0, "x2":3, "y2":0, "x3":3, "y3":4} |
box | x1,y1,x2,y2 (required), height (required), color, opacity | {"type":"box", "x1":0, "y1":0, "x2":1, "y2":0, "height":5} |
Supports: Explicit y=f(x), implicit x²+y²=1, parametric (cos(t),sin(t)), piecewise, domain restrictions.
Optional params:
viewport — {xmin, xmax, ymin, ymax} to set coordinate range
title — graph title
summary — frosted glass overlay text on the graph
gridStyle — "polar" (concentric circles + radial lines), "axes" (axes only, no grid), "none" (clean canvas). Default: rectangular grid.
output — "url" (default, interactive page), "embed" (iframe URL), or "svg" (vector image as text)
animations — array of {tool, name, from, to, loop} for animated parameters. tool: "animate_parameter" with loop: true creates a continuous bounce animation.
theme — "default", "terminal", "wallstreet", "science", or "finance". Visual theme applied to the graph.
Returns: Interactive URL with zoom, pan, and sliders. Or SVG/embed URL depending on output param.
plot_3d — 3D Scene Builder
Create interactive 3D scenes from geometric primitives. Place meshes, lines, and labels in 3D space.
Input: Array of elements, each with a type and type-specific fields:
mesh | shape (required), color, opacity, position [x,y,z], rotation [rx,ry,rz] | {"type":"mesh", "shape":"sphere", "r":1, "color":"#f0f0f0", "position":[0,1,0]} |
line3d | from [x,y,z], to [x,y,z], color | {"type":"line3d", "from":[0,0,0], "to":[1,1,1], "color":"#dc2626"} |
label3d | text, position [x,y,z] | {"type":"label3d", "text":"origin", "position":[0,0,0]} |
Mesh shapes: cube, box, sphere, cylinder, cone, tetrahedron, octahedron, dodecahedron, icosahedron, torus, prism
Shape params: cube→size, box→width/height/depth, sphere→r, cylinder→r/h, cone→r/h, torus→r/tube, prism→points/h
Optional params:
title — scene title
summary — overlay text
camera — {position: [x,y,z], target: [x,y,z]} for camera placement
Returns: Interactive 3D URL with orbit controls (rotate, zoom, pan).
create_show — Slideshow
Bundle multiple plot_graph results into a slideshow. First create each slide with plot_graph, then pass the render IDs here.
Input: title (string), slide_ids (array of render IDs from plot_graph results).
Returns: Interactive show URL with prev/next navigation, keyboard controls, and auto-play.
compute_stats — Descriptive Statistics
Compute mean, median, standard deviation, min, max, range, quartiles from raw data.
add_histogram — Histogram
Create auto-binned histogram from raw numerical data.
add_regression — Regression
Fit linear, quadratic, exponential, or power regression to data points. Returns slope, intercept, R².
fit_distribution — Distribution Fitting
Fit normal, uniform, or exponential distribution to data. Returns best-fit parameters.
test_hypothesis — Hypothesis Testing
Run t-test, paired t-test, or one-sample t-test. Returns test statistic, p-value, and significance.
When to Use
- User asks to graph, plot, or visualize any math
- You need to verify a mathematical result visually (roots, intersections, extrema)
- You computed an answer and want to show it, not just describe it
- You need a multi-step explanation — create slides with
plot_graph, bundle with create_show
- Data needs statistical visualization (histogram, regression, distribution fit)
- Geometry needs precise rendering (triangles, circles, constructions)
- User wants to build 3D scenes — use
plot_3d for shapes, furniture, architecture, abstract art
Why Use This
- Computed, not hallucinated — roots from actual zero-crossings, regression from least squares
- Interactive — user can zoom, pan, adjust sliders, explore
- Shareable — each graph gets a permanent URL
- 9 languages — en, zh, zh-TW, ja, ko, es, fr, de, pt-BR
Quick Test
curl -X POST https://mathtalking.com/api/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"plot_graph","arguments":{"elements":[{"type":"function","expression":"sin(x)","color":"#4A90D9"}]}}}'
Links