Desmos MCP Server
This server gives AI assistants offline math formula validation, 2D plotting, symbolic analysis, and editable interactive Desmos graphs.
Validate or normalize math formulas with actionable syntax guidance (
validate_formula).Plot one function or multiple functions (1–12) as PNG images on shared axes, with optional saved files (
plot_math_function,plot_multiple_functions).Analyze a formula's domain, and optionally range, derivative, stationary points, and nondifferentiable corner candidates (
analyze_formula).Create a standalone interactive Desmos HTML graph with editable expressions, sliders, zoom, PNG export, and JSON state import/export (
create_interactive_graph), which requires a browser, internet, and the user's Desmos API key.Offline tools support real-valued functions of x such as sin, cos, sqrt, abs, pi, and e; interactive graphs accept Desmos LaTeX.
A simple greeting tool (
hello) is also available.Plotting returns native MCP PNG image content; interactive graphs return local HTML file paths/resource URIs rather than embedded browser sessions.
Provides mathematical formula validation, symbolic analysis, and local rendering capabilities for visualizing mathematical functions and calculating properties like domain, range, and critical points
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Desmos MCP Serverplot y = sin(x) + cos(2x) from -2π to 2π"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Desmos MCP
中文 · Client setup · Examples
Give an AI assistant offline function plots and symbolic analysis, plus editable Desmos graphs in a browser. Python 3.10+ · FastMCP 2.x · Apache-2.0 · Independent project, not affiliated with Desmos.
What works
Tool | Result | Requirements |
| Normalized formula or actionable syntax guidance | Offline |
| PNG image and optional saved file | Offline |
| 1–12 curves on shared axes | Offline |
| Domain; optionally range, derivative, stationary points and corner candidates | Offline |
| Standalone HTML with editable expressions, sliders, zoom, PNG export and JSON state import/export | Browser, internet and your own Desmos API key |
Offline tools accept y = x^2, 2*x + 1, sin(x), sqrt(x), abs(x), pi and e.
The interactive tool accepts Desmos LaTeX, including a=1, y=ax^2 and x^2+y^2=9.
These are separate syntax contracts. Interactive expressions are checked by Desmos when the page connects.
Related MCP server: GeoGebra MCP Server
What the assistant returns
An offline plotting call returns native MCP PNG image content plus text metadata containing the formula, warnings, and a saved file path when saving is enabled. Image-capable clients can show the plot directly in chat.
An interactive call returns an HTML file path and resource URI, not an embedded browser session. Open the file in a browser to connect to Desmos and edit the graph. A client may offer its own preview UI, but HTML resources are not automatically rendered by every MCP client. A local file URI is not a public share link.
The current tools are 2D. Three-dimensional plotting is not yet implemented.
Verification status
The 0.2 implementation passed 42 Python tests and 3 isolated JavaScript controller tests locally on macOS/Python 3.10. The CLI, native PNG output, and bundled HTML template were also checked from a separately installed wheel. CI is configured for Linux, macOS and Windows with Python 3.10/3.12; this is not a claim that all remote jobs have passed.
The HTML controller tests simulate the Desmos SDK. A live connection with a real API key and browser layout verification remain outstanding; automated navigation to the local HTML was blocked by the review environment's browser policy.
Quick start
Install uv if needed, then:
git clone https://github.com/TheGrSun/Desmos-MCP.git
cd Desmos-MCP
uv sync --locked
uv run desmos-mcp --helpConnect your MCP client using the copyable configuration. The server uses stdio:
uv run desmos-mcpWaiting for input is normal: this command starts an MCP server, not a command-line chat.
The compatibility command uv run src/main.py also works.
Try asking your assistant:
Plot sin(x) and cos(x) from -2pi to 2pi and explain where they cross.
Create a Desmos graph with a=1 and y=ax^2 so I can explore the parameter.
For the second request, open the returned HTML file, get your own key from Desmos, and enter it on the page. The key is used in memory to load the official SDK; it is not embedded in the generated file or included in exported state JSON. The page explains editing, sliders, reset, and saving. No browser opens automatically. Browser edits do not automatically sync to the assistant: save state before closing the page.
Configuration
Configuration priority: --config PATH → DESMOS_MCP_CONFIG → ./config.json → built-in defaults.
Relative output directories resolve against the configuration file, not the caller's current directory.
{
"output_dir": "graphs",
"timeout_seconds": 20,
"rendering": {
"default_width": 900,
"default_height": 600,
"samples": 1600,
"save_files": true
}
}Without a configuration file, artifacts go to the operating system's temporary directory under desmos-mcp.
Use an explicit directory for lasting files. File names contain UUIDs. save_files=false disables saved PNGs;
interactive HTML is always saved because it is the result of that tool. Images still return as native MCP content.
Generated files are not automatically deleted. Delete unwanted artifacts from the configured output directory.
Offline inputs have length, syntax, and range limits. Symbolic analysis and rendering run in disposable processes with a configurable timeout and at most two active workers. The whitelist parser never evaluates Python from user input. This is a local stdio service, not a hardened public multi-tenant computation service.
Accuracy and limits
Offline analysis supports real-valued functions of
xwith explicit multiplication and radians. Allowed functions:sin,cos,tan,asin,acos,atan,sinh,cosh,tanh,exp,log/ln,sqrt,abs/Abs.basicanalyzes the domain.detailedadds range and derivative analysis.critical_pointsreports stationary points and possible nondifferentiable points separately. Candidates are not classified extrema.Unresolved symbolic results include warnings; a
ConditionSetis not “no solutions.” Some requests can time out.Static PNG curves are sampled approximations; inspect a narrower range near discontinuities or rapid oscillations.
Desmos's public integration is a JavaScript SDK, not a REST PNG endpoint. No API key is needed for offline tools. Requests to the SDK happen only after connecting in the browser.
Returned file paths refer to the server machine. Remote clients need a separate file-transfer mechanism.
Tools do not provide symbolic integration, limits, 3D analysis, or automatic browser-to-MCP state synchronization.
Development
uv sync --locked
uv run pytest
uv run ruff check src tests
node --test tests/interactive.test.cjs
uv buildNode.js 22+ is needed only for the isolated interactive-controller tests, not for running the MCP server.
See CONTRIBUTING.md for module boundaries and validation requirements.
CHANGELOG.md documents the 0.2 migration, including removal of the old desmos configuration block.
The Python package includes the HTML template; the CLI works after wheel installation.
Licensed under Apache-2.0.
Available Tools
5 toolsanalyze_formulaB
Analyzes mathematical properties of a formula (domain, range, critical points).
| Name | Required | Description | Default |
|---|---|---|---|
| formula | Yes | ||
| analysis_type | No | basic |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
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. It states what the tool does but doesn't describe how it behaves: no information on computational complexity, error handling for invalid formulas, output format details (though an output schema exists), or whether this is a read-only operation. For a tool with no annotations, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose. Every word earns its place: 'analyzes' (verb), 'mathematical properties' (scope), 'formula' (resource), and specific examples in parentheses. There's zero waste or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, one with enum), no annotations, and the presence of an output schema, the description is minimally adequate. The output schema reduces the need to explain return values, but the description lacks details on behavioral traits and parameter usage. It's complete enough for basic understanding but has clear gaps in guidance and transparency.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'analysis_type' implicitly through the examples (domain, range, critical points), which correspond to the enum values, but doesn't explain the 'formula' parameter's format or constraints. It adds some meaning beyond the bare schema but doesn't fully compensate for the coverage gap, especially for the required 'formula' parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'analyzes' and the resource 'mathematical properties of a formula', with specific examples (domain, range, critical points). It distinguishes from siblings like 'plot_math_function' or 'validate_formula' by focusing on analysis rather than visualization or validation. However, it doesn't explicitly differentiate from all siblings (e.g., 'hello' is unrelated).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'analyze_formula' over 'validate_formula' for formula checking, or when analysis is preferred over plotting with 'plot_math_function'. There are no explicit when/when-not statements or named alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
helloB
A simple tool that returns a greeting.
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | World |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It states the tool returns a greeting but doesn't disclose any behavioral traits like whether it's idempotent, has side effects, or what the output format is. The description is minimal and lacks context beyond the basic action.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with no wasted words. It's appropriately sized for such a simple tool and front-loads the core purpose clearly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 optional parameter) and the presence of an output schema, the description is complete enough for basic understanding. However, it could benefit from slightly more context about the greeting format or usage scenarios to be fully comprehensive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 1 parameter with 0% description coverage, but the description doesn't mention parameters at all. Since there's only one parameter and the tool is very simple, the baseline is high. However, the description doesn't add meaning beyond the schema, so it doesn't fully compensate for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool 'returns a greeting', which is a clear purpose but vague about what kind of greeting or how it's generated. It doesn't differentiate from sibling tools (like analyze_formula or plot_math_function), but the purpose is understandable albeit basic.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description doesn't mention any context, prerequisites, or exclusions, leaving the agent to infer usage based on the simple purpose alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_math_functionB
Generates a 2D plot. Tries Desmos API if available, otherwise falls back to local rendering.
| Name | Required | Description | Default |
|---|---|---|---|
| formula | Yes | ||
| x_range | No | ||
| y_range | No | ||
| use_api | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the fallback behavior between Desmos API and local rendering, which is useful context. However, it doesn't mention other behavioral traits like performance implications, error handling, authentication needs, rate limits, or output format details, leaving gaps for a tool with 4 parameters.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is highly concise with two sentences that efficiently convey the core functionality and fallback mechanism. It's front-loaded with the main purpose and wastes no words, making it easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 4 parameters with 0% schema coverage and no annotations, the description is incomplete as it lacks parameter explanations and behavioral details. However, the presence of an output schema reduces the need to describe return values, and the purpose is clear, making it minimally adequate but with significant gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, but it adds no information about parameters beyond the general context of plotting. It doesn't explain what 'formula', 'x_range', 'y_range', or 'use_api' mean or how they affect the plot, leaving all 4 parameters semantically unclear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Generates a 2D plot' with a specific mathematical context. It distinguishes from siblings like 'analyze_formula' and 'validate_formula' by focusing on visualization rather than analysis or validation, though it doesn't explicitly contrast with 'plot_multiple_functions'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for plotting mathematical functions, with a fallback mechanism mentioned ('Tries Desmos API if available, otherwise falls back to local rendering'). However, it lacks explicit guidance on when to use this tool versus alternatives like 'plot_multiple_functions' or other siblings, and doesn't specify prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_multiple_functionsC
Plots multiple functions on the same graph.
| Name | Required | Description | Default |
|---|---|---|---|
| formulas | Yes | ||
| x_range | No | ||
| y_range | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on output format, error handling, or performance traits. It doesn't mention whether the plot is interactive, saved, or displayed, nor does it cover rate limits or authentication needs, which are critical for a plotting tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise with a single sentence that directly states the tool's function without any fluff or redundancy. It is front-loaded and wastes no words, making it efficient for quick comprehension, though this brevity contributes to gaps in other dimensions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is incomplete. It lacks details on parameter usage, behavioral traits, and differentiation from siblings, though the presence of an output schema mitigates the need to explain return values. This results in a minimally adequate but insufficiently informative description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage, so the description must compensate but adds no parameter semantics beyond implying 'formulas' are plotted. It doesn't explain what 'formulas' entail (e.g., mathematical expressions), the format of 'x_range' and 'y_range' (e.g., arrays of two numbers), or default behaviors, leaving significant gaps in understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
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 a specific verb ('plots') and resource ('multiple functions on the same graph'), making it immediately understandable. However, it doesn't explicitly distinguish itself from sibling tools like 'plot_math_function', which might handle single functions, leaving some ambiguity about when to choose one over the other.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, such as 'plot_math_function' for single functions or 'analyze_formula' for non-graphical analysis. It lacks explicit instructions on prerequisites, context, or exclusions, leaving the agent to infer usage based on the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_formulaB
Validates the syntax of a mathematical formula, offering intelligent help on failure.
| Name | Required | Description | Default |
|---|---|---|---|
| formula | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses that the tool validates syntax and provides 'intelligent help on failure', which adds behavioral context about error responses. However, it doesn't mention other traits like performance characteristics, rate limits, or authentication needs. The description adds some value but leaves gaps for a tool with mutation-like validation behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-constructed sentence that efficiently communicates the core functionality and error-handling behavior. Every word earns its place, with no redundancy or unnecessary elaboration. It's appropriately sized for a simple validation tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has an output schema (which should document return values), the description doesn't need to explain outputs. However, with no annotations and incomplete parameter documentation, the description provides adequate but minimal context for a validation tool. It covers the 'what' and error behavior but lacks details on formula requirements or validation rules.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage, with only one parameter 'formula' of type string. The description doesn't add any parameter-specific semantics beyond the tool's overall purpose. It doesn't explain what constitutes a valid formula, expected format, or examples. With low schema coverage, the description fails to compensate adequately.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Validates the syntax of a mathematical formula' with the specific verb 'validates' and resource 'mathematical formula'. It distinguishes from siblings like 'analyze_formula' (which might check semantics) and 'plot_math_function' (which visualizes), but doesn't explicitly name these alternatives. The addition of 'offering intelligent help on failure' adds useful context about error handling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context through 'validates the syntax' and 'on failure', suggesting it should be used to check formula correctness before further processing. However, it doesn't explicitly state when to use this vs. alternatives like 'analyze_formula' or provide clear exclusions. The guidance is present but not comprehensive.
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.
5 tool updates
- First observed
analyze_formula - First observed
hello - First observed
plot_math_function - First observed
plot_multiple_functions - First observed
validate_formula
TDQS
Scored across 5 tools
Most tools have distinct purposes: analyze_formula, plot_math_function, plot_multiple_functions, and validate_formula each target different mathematical tasks. However, analyze_formula and validate_formula could be slightly confused as both involve formula inspection, but their descriptions clarify analysis vs. syntax validation. The hello tool is clearly distinct but trivial.
Tools follow a consistent verb_noun pattern (e.g., analyze_formula, plot_math_function) with clear, descriptive names. The only minor deviation is hello, which is a simple noun without a verb, but this does not significantly disrupt the overall consistency.
With 5 tools, the count is reasonable for a mathematical plotting and analysis server. It covers core functionalities like plotting and formula handling without being overwhelming. However, it feels slightly thin for a full mathematical toolkit, as it lacks tools for operations like solving equations or data manipulation.
The server covers basic plotting and formula analysis well, but there are notable gaps. For a Desmos-like domain, missing operations include solving equations, manipulating graphs (e.g., zoom, pan), exporting plots, or handling parametric functions. The hello tool adds no functional value, and the set feels incomplete for advanced mathematical workflows.
Maintenance
Related MCP Connectors
Create interactive 2D and 3D graphs with validated equations, shareable links, and PNG previews.
AI-callable calculators and engineering models with real formulas. No hallucinated math.
Precision math engine for AI agents. 203 exact methods. Zero hallucination.
Integrates Wolfram Language and Wolfram|Alpha accessing curated data and sophisticated algorithms.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides advanced mathematical calculation capabilities including symbolic algebra, numerical computing, data analysis, and image processing through SymPy, NumPy, SciPy, and pandas integration.3MIT
- FlicenseNot gradedqualityDmaintenanceProvides access to GeoGebra's mathematical computation, geometry construction, and visualization capabilities. Enables mathematical calculations, CAS operations, geometric constructions, and exporting results as PNG or PDF images.11-
- AlicenseNot gradedqualityDmaintenanceEnables mathematical computation via Wolfram Language/Mathematica integration, supporting calculations, equation solving, calculus, matrix operations, and symbolic mathematics.13MIT
- AlicenseAqualityDmaintenanceProvides powerful symbolic mathematics and statistical analysis capabilities, enabling users to solve equations, compute derivatives and integrals, perform statistical tests, and analyze data through natural language requests.44MIT